Skip to content

Allow passing a namespace with a custom metric #2088

Closed
@yoranvanoirschot

Description

@yoranvanoirschot

Is your feature request related to a problem? Please describe.
Currently all custom metrics land in the namespace: 'azure.applicationinsights'. It seems to be possible to provide a Metric namespace through the REST API (https://docs.microsoft.com/en-us/azure/azure-monitor/essentials/metrics-custom-overview#sample-custom-metric-publication) and in the C# SDK (https://github.com/microsoft/ApplicationInsights-dotnet/blob/405fd6a9916956f2233520c8ab66110a1f9dcfbc/BASE/src/Microsoft.ApplicationInsights/DataContracts/MetricTelemetry.cs) however this is unavailable from the Java SDK.

Describe the solution you would like
I would like to set the namespace in a similar way to the C# SDK, an example:

var metric = new MetricTelemetry();
metric.setMetricNamespace("<myNamespace>");
metric.setName("<myMetric>");
metric.setValue(50.0);
client.trackMetric(metric);

Preferably we would be able to set a default metric namespace on the TelemetryClient.

Describe alternatives you have considered
Alternatively we prefix the metric name with the namespace. We are using a shared App Insights instance for over 40 applications. This will result in a huge list of metrics. We would rather namespace them per application (or per group of applications).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions