-
Notifications
You must be signed in to change notification settings - Fork 5k
Closed
Copy link
Labels
ClientThis issue is related to a non-management packageThis issue is related to a non-management packageMonitor - ExporterMonitor OpenTelemetry ExporterMonitor OpenTelemetry Exporter
Description
Try
using Azure.Monitor.OpenTelemetry.AspNetCore;
using System.Diagnostics;
using System.Diagnostics.Metrics;
var builder = WebApplication.CreateBuilder(args);
builder.Services
.AddOpenTelemetry()
.WithTracing(tp => tp.AddSource("test"))
.WithMetrics(mp => mp.AddMeter("test"))
.UseAzureMonitor(o => o.ConnectionString = "secret");
var app = builder.Build();
var test = new ActivitySource("test");
var testMeter = new Meter("test");
var testCounter = testMeter.CreateCounter<int>("this.is.a.test.counter");
app.MapGet("/", async () =>
{
using var act = test.StartActivity("test me");
act?.AddTag("array.attribute", new[] { 1, 2, 3 });
testCounter.Add(1, new KeyValuePair<string, object?>("array.attribute", new[] { 1, 2, 3 }));
});
app.Run();
Array attribute on spans works fine, but is converted to string with ToString()
on metrics here
Line 34 in e1e91d2
Properties.Add(new KeyValuePair<string, string>(tag.Key, tag.Value.ToString().Truncate(SchemaConstants.MetricsData_Properties_MaxValueLength) ?? "null")); |
The suggestion is to do it consistently (comma separated list).
context: open-telemetry/semantic-conventions#1525
use-case: as a user I might want to filter my metrics checking if array attribute contains a specific value among others.
TimothyMothra and rajkumar-rangaraj
Metadata
Metadata
Assignees
Labels
ClientThis issue is related to a non-management packageThis issue is related to a non-management packageMonitor - ExporterMonitor OpenTelemetry ExporterMonitor OpenTelemetry Exporter