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

issue-21715 fetching metric values with composite(all) dimension keys #21716

Merged
merged 6 commits into from
Jun 2, 2023

Conversation

rajim17
Copy link
Contributor

@rajim17 rajim17 commented May 9, 2023

Description:

If metric has multiple dimensions, metricValues are fetched by single dimension instead of combining all dimensions. With single dimension metric value is average value of other dimensions.

In below example without all dimensions in the filter, 'metadata_nodepool' provides average value of 2 'metadata_node' datapoints. But cannot combine dimensions of metadata_node under 'metadata_nodepool' dimensions.

Metric #44
Descriptor:
     -> Name: azure_node_cpu_usage_millicores_total
NumberDataPoints #0
Data point attributes:
     -> azuremonitor.resource_id: Str(/subscriptions/test/resourceGroups/aks-dev2-blue/providers/Microsoft.ContainerService/managedClusters/aks-dev2-blue)
     -> metadata_nodepool: Str(general1)
Value: 625.500000

NumberDataPoints #1
Data point attributes:
     -> azuremonitor.resource_id: Str(/subscriptions/test/resourceGroups/aks-dev2-blue/providers/Microsoft.ContainerService/managedClusters/aks-dev2-blue)
     -> metadata_node: Str(aks-general1-vmss00006x)
Value: 506.000000

NumberDataPoints #2
Data point attributes:
     -> azuremonitor.resource_id: Str(/subscriptions/test/resourceGroups/aks-dev2-blue/providers/Microsoft.ContainerService/managedClusters/aks-dev2-blue)
     -> metadata_node: Str(aks-general1-vmss000062)
Value: 745.000000

With all Dimensions applied:
Here each datapoint provides all related dimension values. With this information, it is easy to apply multiple filters.

Metric #44
Descriptor:
     -> Name: azure_node_cpu_usage_millicores_total

NumberDataPoints #0
Data point attributes:
     -> azuremonitor.resource_id: Str(/subscriptions/test/resourceGroups/aks-dev2-blue/providers/Microsoft.ContainerService/managedClusters/aks-dev2-blue)
     -> metadata_node: Str(aks-general1-vmss00006x)
     -> metadata_nodepool: Str(general1)
Value: 506.000000

NumberDataPoints #1
Data point attributes:
     -> azuremonitor.resource_id: Str(/subscriptions/test/resourceGroups/aks-dev2-blue/providers/Microsoft.ContainerService/managedClusters/aks-dev2-blue)
     -> metadata_node: Str(aks-general1-vmss000062)
     -> metadata_nodepool: Str(general1)
Value: 745.000000

In Azuremonitor receiver, getResourceMetricsValuesRequestOptions func, single dimension key alone provided. Instead all possible dimension keys for the metric have to be given.
Solution:
with metricresource definitions, Generate hash string with all dimensions and store the metrics based on hash instead of single dimension + timegrain filter.

Sample MetricClient REST Request with all dimensions in filter:

https://management.azure.com/subscriptions/test/resourceGroups/aks-dev2-blue/providers/Microsoft.ContainerService/managedClusters/aks-dev2-blue/providers/Microsoft.Insights/metrics?timespan=2023-04-29T02:20:00Z/2023-05-04T04:20:00Z&interval=PT1H&api-version=2018-01-01&metricnamespace=Microsoft.ContainerService/managedClusters&metricnames=node_cpu_usage_millicores&$filter=nodepool eq '*' and node eq '*'

Fixes #21715

Testing: Testdata with multiple dimensions are working.

Documentation:

@rajim17 rajim17 requested a review from a team May 9, 2023 20:31
@rajim17 rajim17 requested a review from codeboten as a code owner May 9, 2023 20:31
@github-actions github-actions bot requested a review from altuner May 9, 2023 20:31
@rajim17
Copy link
Contributor Author

rajim17 commented May 12, 2023

@altuner @codeboten - Could you help review the changes ?

Copy link
Contributor

@altuner altuner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left small comments

@rajim17 rajim17 force-pushed the azurereceiver/dimension branch from 27d8235 to 8e443b8 Compare May 16, 2023 23:44
@rajim17 rajim17 requested a review from altuner May 18, 2023 17:30
Copy link
Contributor

@altuner altuner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rajim17 rajim17 requested a review from altuner May 22, 2023 15:47
@rajim17
Copy link
Contributor Author

rajim17 commented May 22, 2023

@altuner @codeboten - I'm planning to push this change for the next release. Requesting to review and provide the feedback so it does not miss the window. :-)

@altuner
Copy link
Contributor

altuner commented May 23, 2023

@rajim17 please fix the breaking test

@rajim17 rajim17 force-pushed the azurereceiver/dimension branch from 1e86add to 7034dcb Compare May 23, 2023 17:43
@rajim17
Copy link
Contributor Author

rajim17 commented May 23, 2023

@rajim17 please fix the breaking test

Integration_test on rabbitmqreceiver was failing. I triggered the build process with dummy commit message and tests are running. I will check once build is complete.

@rajim17
Copy link
Contributor Author

rajim17 commented May 23, 2023

@altuner - All tests are passed.

@rajim17
Copy link
Contributor Author

rajim17 commented May 24, 2023

@codeboten - Could you help reviewing the PR ?

@junhuangli
Copy link
Contributor

@altuner We are waiting for this fix. Could you merge this pull request or is there anything still pending?

@rajim17
Copy link
Contributor Author

rajim17 commented May 30, 2023

@codeboten - Could you help merging this PR ? It is already approved by code owner @altuner .

@junhuangli
Copy link
Contributor

@codeboten Could you take another look at this PR :)

@codeboten codeboten merged commit bc77fec into open-telemetry:main Jun 2, 2023
@github-actions github-actions bot added this to the next release milestone Jun 2, 2023
Caleb-Hurshman pushed a commit to observIQ/opentelemetry-collector-contrib that referenced this pull request Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AzureMonitor Receiver does not fetch combinational dimensions of metric values.
5 participants