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

[BUG] Custom Attributes on Metrics sent from Open Telemetry not appearing in App Insights #35844

Closed
joebeernink opened this issue Apr 26, 2023 · 3 comments
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Monitor - Exporter Monitor OpenTelemetry Exporter needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team

Comments

@joebeernink
Copy link

Library name and version

Azure.Monitor.OpenTelemetry.Exporter 1.0.0-beta.10

Describe the bug

Adding custom attributes to Metrics doesn't actually route the Attributes to Application Insights with the metrics
See github project here: https://github.com/joebeernink/DemoOpenTelemetry

                .WithMetrics(builder => builder
                    .AddAspNetCoreInstrumentation()
                    .AddHttpClientInstrumentation()
                    .AddConsoleExporter()
                    .AddAzureMonitorMetricExporter(o =>
                    {
                        o.ConnectionString = appInsightsConnection;
                    })
                    .ConfigureResource(resource =>
                    {
                        resource.AddService(DiagnosticsConfig.ServiceName);
                        resource.AddAttributes(customerInstanceConfig.Values);
                    }))

where the customerInstanceConfig is:

       public class CustomerInstanceConfigurationOptions
    {
        public string EnvironmentShortName { get; set; } = string.Empty;

        public string RegionShortName { get; set; } = string.Empty;

        public string StampName { get; set; } = string.Empty;

        public string CustomerId { get; set; } = string.Empty;

        public string CustomerInstanceName { get; set; } = string.Empty;

        public string Name { get; set; } = string.Empty;

        public string DnsSubDomain { get; set; } = string.Empty;

        public IEnumerable<KeyValuePair<string, object>> Values
        {
            get
            {
                var kvps = new List<KeyValuePair<string, object>> {
                            new("EnvironmentShortName", EnvironmentShortName),
                            new("RegionShortName", RegionShortName),
                            new("StampName", StampName),
                            new("CustomerId", CustomerId.ToString()),
                            new("CustomerInstanceName", CustomerInstanceName),
                            new("Name", Name),
                            new("DnsSubDomain", DnsSubDomain)
                        };
                return kvps;
            }
 And the values loaded from the appsettings.json are:
       "CustomerInstanceConfiguration": {
    "EnvironmentShortName": "dev",
    "RegionShortName": "wus2",
    "StampName": "01",
    "CustomerId": "joeb",
    "CustomerInstanceName": "001",
    "Name": "dev-wus2-01-joeb-001",
    "DnsSubDomain": "joeb001"
  }

In the values received by AI, cannot filter or group by these attributes:
image

Expected behavior

The attributes should show up in Application insights as part of the OpenTelemetry.Instrumentation.AspNetCore metrics and OpenTelemetry.Instrumentation.Http metrics

Actual behavior

Attributes are missing.

Reproduction Steps

See github repo: https://github.com/joebeernink/DemoOpenTelemetry

Environment

RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\7.0.201\

Host:
Version: 7.0.3
Architecture: x64
Commit: 0a2bda10e8

.NET SDKs installed:
6.0.408 [C:\Program Files\dotnet\sdk]
7.0.201 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

@joebeernink joebeernink changed the title [BUG] [BUG] Custom Attributes on Metrics sent from Open Telemetry not appearing in App Insights Apr 26, 2023
@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Apr 26, 2023
@jsquire jsquire added Client This issue points to a problem in the data-plane of the library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team Monitor - Exporter Monitor OpenTelemetry Exporter CXP Attention and removed needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Apr 26, 2023
@github-actions
Copy link

Thank you for your feedback. This has been routed to the support team for assistance.

@navba-MSFT navba-MSFT added bug This issue requires a change to an existing behavior in the product in order to be resolved. and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jul 20, 2023
@navba-MSFT navba-MSFT self-assigned this Jul 20, 2023
@navba-MSFT
Copy link
Contributor

@joebeernink This issue is a duplicate and the same ask is being tracked in #35487 . Follow the PR #36027 and #36063

@joebeernink
Copy link
Author

joebeernink commented Jul 20, 2023 via email

@github-actions github-actions bot locked and limited conversation to collaborators Oct 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Monitor - Exporter Monitor OpenTelemetry Exporter needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team
Projects
None yet
Development

No branches or pull requests

3 participants