Skip to content

Commit

Permalink
fix npe
Browse files Browse the repository at this point in the history
  • Loading branch information
weibaohui committed Aug 21, 2024
1 parent 67de4dd commit 78e8614
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions BlazorApp/Service/k8s/impl/KubeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ public async Task<List<IMetric>> ConvertStringToMetrics(string metricString)
public async Task<List<IMetric>> GetMetricsSlis()
{
var metricString = await GetStringAsync("/metrics/slis");
if (metricString.IsNullOrWhiteSpace())
{
return [];
}

var byteArray = Encoding.UTF8.GetBytes(metricString);
await using var ms = new MemoryStream(byteArray);
var metric = await PrometheusMetricsParser.ParseAsync(ms);
Expand Down

0 comments on commit 78e8614

Please sign in to comment.