Skip to content

[bug] Custom metrics tags are not exported to InfluxDb #2362

Open
@Chuprinenko

Description

@Chuprinenko

Component

OpenTelemetry.Exporter.InfluxDB

Package Version

Package Name Version
OpenTelemetry 1.10.0
OpenTelemetry.Exporter.InfluxDB 1.0.0-alpha.4

Runtime Version

net48

Description

I'm adding a tag to a metric, but when exporting it to influx db I can't see it anywhere

Steps to Reproduce

using OpenTelemetry;
using OpenTelemetry.Exporter.InfluxDB;
using OpenTelemetry.Metrics;
using OpenTelemetry.Trace;
using System;
using System.Diagnostics;
using System.Diagnostics.Metrics;

namespace Telemetry
{
	internal class Program
	{
		static void Main(string[] args)
		{
			const int sendMetricsFrequencyMilliseconds = 1000;
			TagList globalTags = new TagList
			{
				{ "TestTag", "Test tag value" },
			};

			using var meter = new Meter("TestMetric", null, globalTags);
			var counter = meter.CreateCounter<long>("test-counter");

			var metricsProvider = Sdk.CreateMeterProviderBuilder()
									 .AddMeter("TestMetric")
									.AddInfluxDBMetricsExporter(exporterOptions =>
									{
										exporterOptions.MetricExportIntervalMilliseconds = sendMetricsFrequencyMilliseconds;
										exporterOptions.Org = "-";
										exporterOptions.Bucket = "TestMetrics";
										exporterOptions.Token = "";
										exporterOptions.Endpoint = new Uri("http://localhost:8086");
										exporterOptions.MetricsSchema = MetricsSchema.TelegrafPrometheusV2;
									})
									.Build();

			counter.Add(10);
			metricsProvider.Dispose();
		}
	}
}

Expected Result

See added tag "TestTag" with value "Test tag value" in the influx db database.

Actual Result

No tag "TestTag"
image

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcomp:exporter.influxdbThings related to OpenTelemetry.Exporter.InfluxDB

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions