Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
altuner committed Apr 21, 2023
1 parent 9a737c8 commit a9fa1ba
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion receiver/azuremonitorreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func createMetricsReceiver(ctx context.Context, params receiver.CreateSettings,
}

azureScraper := newScraper(cfg, params)
scraper, err := scraperhelper.NewScraper(typeStr, azureScraper.scrape, scraperhelper.WithStart(azureScraper.start))
scraper, err := scraperhelper.NewScraper(metadata.Type, azureScraper.scrape, scraperhelper.WithStart(azureScraper.start))
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion receiver/azuremonitorreceiver/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestNewFactory(t *testing.T) {
desc: "creates a new factory with correct type",
testFunc: func(t *testing.T) {
factory := NewFactory()
require.EqualValues(t, typeStr, factory.Type())
require.EqualValues(t, metadata.Type, factory.Type())
},
},
{
Expand Down
22 changes: 11 additions & 11 deletions receiver/azuremonitorreceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,10 @@ func (s *azureScraper) getResourceMetricsValues(ctx context.Context, resourceID

for _, metric := range result.Value {

for _, timeserie := range metric.Timeseries {
if timeserie.Data != nil {
for _, timeserieData := range timeserie.Data {
s.processTimeserieData(resourceID, metric, timeserieData, timeserie.Metadatavalues)
for _, timeseriesElement := range metric.Timeseries {
if timeseriesElement.Data != nil {
for _, metricValue := range timeseriesElement.Data {
s.processTimeseriesData(resourceID, metric, metricValue, timeseriesElement.Metadatavalues)
}
}
}
Expand Down Expand Up @@ -352,10 +352,10 @@ func getResourceMetricsValuesRequestOptions(
return filter
}

func (s *azureScraper) processTimeserieData(
func (s *azureScraper) processTimeseriesData(
resourceID string,
metric *armmonitor.Metric,
timeserieData *armmonitor.MetricValue,
metricValue *armmonitor.MetricValue,
metadataValues []*armmonitor.MetadataValue,
) {
s.mutex.Lock()
Expand All @@ -367,11 +367,11 @@ func (s *azureScraper) processTimeserieData(
name string
value *float64
}{
{"Average", timeserieData.Average},
{"Count", timeserieData.Count},
{"Maximum", timeserieData.Maximum},
{"Minimum", timeserieData.Minimum},
{"Total", timeserieData.Total},
{"Average", metricValue.Average},
{"Count", metricValue.Count},
{"Maximum", metricValue.Maximum},
{"Minimum", metricValue.Minimum},
{"Total", metricValue.Total},
}
for _, aggregation := range aggregationsData {
if aggregation.value != nil {
Expand Down

0 comments on commit a9fa1ba

Please sign in to comment.