Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.ArgumentNullException: Value cannot be null. (Parameter 'source') #2432

Open
Kamalika-saha opened this issue Dec 17, 2023 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@Kamalika-saha
Copy link

Report

I am trying to use promitor version 2.11.x with the following value file :
`azureAuthentication:
identity:
binding: -identity
id: xxxx
mode: UserAssignedManagedIdentity
azureMetadata:
subscriptionId: xx
tenantId: xx
metricDefaults:
aggregation:
interval: "00:02:00"
scraping:
schedule: "0 */2 * ? * *"
metrics:

  • azureMetricConfiguration:
    aggregation:
    type: Average
    metricName: Size
    description: Size of topic
    name: promitor_azure_service_bus_topic_size
    resourceType: ServiceBusNamespace
    resources:
    • namespace: bus-1
      topicName: recordstopic
      resourceGroupName: DataPartition-rg--dp1-xhgyrm
    • namespace: bus-2
      topicName: recordstopic
      resourceGroupName: DataPartition-rg--dp2-xhgyrm
      However it is failing to scrape the metric. The follow is the error message found on looking into kubectl logs : Failed to scrape resource for metric 'demo_queue_size'
      System.ArgumentNullException: Value cannot be null. (Parameter 'source')
      at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
      at System.Linq.Enumerable.Any[TSource](IEnumerable1 source) at Promitor.Core.Scraping.ResourceTypes.AzureMessagingScraper1.<>c.b__2_0(MeasuredMetric metricValue) in /src/Promitor.Core.Scraping/AzureMessagingScraper.cs:line 22
      at System.Linq.Enumerable.WhereListIterator1.MoveNext() at Promitor.Core.Scraping.ResourceTypes.AzureMessagingScraper1.EnrichMeasuredMetrics(TResourceDefinition resourceDefinition, List1 dimensionNames, List1 metricValues) in /src/Promitor.Core.Scraping/AzureMessagingScraper.cs:line 22
      at Promitor.Core.Scraping.AzureMonitorScraper1.ScrapeResourceAsync(String subscriptionId, ScrapeDefinition1 scrapeDefinition, TResourceDefinition resourceDefinition, AggregationType aggregationType, TimeSpan aggregationInterval) in /src/Promitor.Core.Scraping/AzureMonitorScraper.cs:line 71
      at Promitor.Core.Scraping.Scraper1.ScrapeAsync(ScrapeDefinition1 scrapeDefinition) in /src/Promitor.Core.Scraping/Scraper.cs:line 79
      has context menu`
      Is there any work around to this issue? Am I missing anything in the values file?
      I am prepared the values file according to the latest documentation of Promitor.

Expected Behavior

It should be able to scrape the required metrics.

Actual Behavior

However it is failing to scrape the metric. The follow is the error message found on looking into kubectl logs :
Failed to scrape resource for metric 'demo_queue_size' System.ArgumentNullException: Value cannot be null. (Parameter 'source') at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument) at System.Linq.Enumerable.Any[TSource](IEnumerable1 source)
at Promitor.Core.Scraping.ResourceTypes.AzureMessagingScraper1.<>c.<EnrichMeasuredMetrics>b__2_0(MeasuredMetric metricValue) in /src/Promitor.Core.Scraping/AzureMessagingScraper.cs:line 22 at System.Linq.Enumerable.WhereListIterator1.MoveNext()
at Promitor.Core.Scraping.ResourceTypes.AzureMessagingScraper1.EnrichMeasuredMetrics(TResourceDefinition resourceDefinition, List1 dimensionNames, List1 metricValues) in /src/Promitor.Core.Scraping/AzureMessagingScraper.cs:line 22 at Promitor.Core.Scraping.AzureMonitorScraper1.ScrapeResourceAsync(String subscriptionId, ScrapeDefinition1 scrapeDefinition, TResourceDefinition resourceDefinition, AggregationType aggregationType, TimeSpan aggregationInterval) in /src/Promitor.Core.Scraping/AzureMonitorScraper.cs:line 71 at Promitor.Core.Scraping.Scraper1.ScrapeAsync(ScrapeDefinition1 scrapeDefinition) in /src/Promitor.Core.Scraping/Scraper.cs:line 79 has context menu

Steps to Reproduce the Problem

...

Component

Scraper

Version

2.11.x

Configuration

azureAuthentication:
identity:
binding: -identity
id: xxxx
mode: UserAssignedManagedIdentity
azureMetadata:
subscriptionId: xx
tenantId: xx
metricDefaults:
aggregation:
interval: "00:02:00"
scraping:
schedule: "0 */2 * ? * *"
metrics:

  • azureMetricConfiguration:
    aggregation:
    type: Average
    metricName: Size
    description: Size of topic
    name: promitor_azure_service_bus_topic_size
    resourceType: ServiceBusNamespace
    resources:
    • namespace: bus-1
      topicName: recordstopic
      resourceGroupName: DataPartition-rg--dp1-xhgyrm
    • namespace: bus-2
      topicName: recordstopic
      resourceGroupName: DataPartition-rg--dp2-xhgyrm

Logs

However it is failing to scrape the metric. The follow is the error message found on looking into kubectl logs :
Failed to scrape resource for metric 'demo_queue_size' System.ArgumentNullException: Value cannot be null. (Parameter 'source') at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument) at System.Linq.Enumerable.Any[TSource](IEnumerable1 source)
at Promitor.Core.Scraping.ResourceTypes.AzureMessagingScraper1.<>c.<EnrichMeasuredMetrics>b__2_0(MeasuredMetric metricValue) in /src/Promitor.Core.Scraping/AzureMessagingScraper.cs:line 22 at System.Linq.Enumerable.WhereListIterator1.MoveNext()
at Promitor.Core.Scraping.ResourceTypes.AzureMessagingScraper1.EnrichMeasuredMetrics(TResourceDefinition resourceDefinition, List1 dimensionNames, List1 metricValues) in /src/Promitor.Core.Scraping/AzureMessagingScraper.cs:line 22 at Promitor.Core.Scraping.AzureMonitorScraper1.ScrapeResourceAsync(String subscriptionId, ScrapeDefinition1 scrapeDefinition, TResourceDefinition resourceDefinition, AggregationType aggregationType, TimeSpan aggregationInterval) in /src/Promitor.Core.Scraping/AzureMonitorScraper.cs:line 71 at Promitor.Core.Scraping.Scraper1.ScrapeAsync(ScrapeDefinition1 scrapeDefinition) in /src/Promitor.Core.Scraping/Scraper.cs:line 79 has context menu

Platform

Microsoft Azure

Contact Details

[email protected]

@Kamalika-saha Kamalika-saha added the bug Something isn't working label Dec 17, 2023
Copy link

Thank you for opening an issue! We rely on the community to maintain Promitor. (Learn more)

Is this something you want to contribute?

@Kamalika-saha
Copy link
Author

FYI: This same config file seems to be working perfectly fine with promitor verion 2.9.x

@tomkerkhove
Copy link
Owner

Thank you for opening an issue! We rely on the community to maintain Promitor. (Learn more)

Is this something you want to contribute?

Are you willing to contribute a fix?

@Kamalika-saha
Copy link
Author

Kamalika-saha commented Jan 18, 2024

From the error message, it seems that the error is coming from the following file : src/Promitor.Core.Scraping/ResourceTypes/AzureMessagingScraper.cs
Function:
`protected override List EnrichMeasuredMetrics(TResourceDefinition resourceDefinition, List dimensionNames, List metricValues)
{
// Change Azure Monitor Dimension name to more representable value
foreach (var measuredMetric in metricValues.Where(metricValue => metricValue.Dimensions.Any()))
{
measuredMetric.Dimensions[0].Name = EntityNameLabel;
}

        return metricValues;}`

We can include a null check in this function. Something like :
`
protected override List EnrichMeasuredMetrics(TResourceDefinition resourceDefinition, List dimensionNames, List metricValues)
{
if (metricValues == null)
{
// Handle the case where metricValues is null, if necessary
return null; // or return an empty list, depending on your requirements
}

// Change Azure Monitor Dimension name to a more representable value
foreach (var measuredMetric in metricValues.Where(metricValue => metricValue.Dimensions.Any()))
{
    measuredMetric.Dimensions[0].Name = EntityNameLabel;
}

return metricValues; }`

@tomkerkhove
Copy link
Owner

Are you willing to contribute a fix?

@rmacian
Copy link

rmacian commented Feb 27, 2024

Same error here but for Azure Service Bus metrics

[16:42:57 FTL] Failed to scrape resource for metric 'azure_servicebusnamespace_abandonmessage'
System.ArgumentNullException: Value cannot be null. (Parameter 'source')
   at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
   at Promitor.Core.Scraping.ResourceTypes.AzureMessagingScraper`1.<>c.<EnrichMeasuredMetrics>b__2_0(MeasuredMetric metricValue) in /src/Promitor.Core.Scraping/AzureMessagingScraper.cs:line 22
   at System.Linq.Enumerable.WhereListIterator`1.MoveNext()
   at Promitor.Core.Scraping.ResourceTypes.AzureMessagingScraper`1.EnrichMeasuredMetrics(TResourceDefinition resourceDefinition, List`1 dimensionNames, List`1 metricValues) in /src/Promitor.Core.Scraping/AzureMessagingScraper.cs:line 22
   at Promitor.Core.Scraping.AzureMonitorScraper`1.ScrapeResourceAsync(String subscriptionId, ScrapeDefinition`1 scrapeDefinition, TResourceDefinition resourceDefinition, AggregationType aggregationType, TimeSpan aggregationInterval) in /src/Promitor.Core.Scraping/AzureMonitorScraper.cs:line 71
   at Promitor.Core.Scraping.Scraper`1.ScrapeAsync(ScrapeDefinition`1 scrapeDefinition) in /src/Promitor.Core.Scraping/Scraper.cs:line 79

@rmacian
Copy link

rmacian commented May 30, 2024

any update on this ?

@tomkerkhove
Copy link
Owner

Nope, waiting for contributions to fix this. Are you willing to contribute a fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Proposed
Development

No branches or pull requests

3 participants