- monitor.opentelemetry.exporter:
- 1.0.0.b36:
- all:
- all:
Describe the bug
No way to define a custom "Metric Namespace" different from 'azure.applicationinsights' when using the
azure.monitor.opentelemetry.exporter.AzureMonitorMetricExporter from azure-monitor-opentelemetry-exporter==1.0.0.b36.
To Reproduce
Steps to reproduce the behavior:
- Set up telemetry to Azure Monitor
- Run the testcode below to publish one value (1.1)
- Verify transmission and storage in Azure Monitor. Metric namespace 'azure.applicationinsights' contains your meter and the value 1.1.
- Provide a namespace='xyz' to your telemetry setup (see code)
- Publish a second value using the configuration with namespace='xyz' (1.2)
- Check transmission and storage in Azure Monitor. Metric Namespace 'azure.applicationinsights' still contains three entries. ![Image]Log-based metrics, Application Insights standard metrics, azure.applicationinsights instead of 4 including the new namespace 'xyz'.
Expected behavior
azure-monitor-opentelemetry-exporter sends the namespace and Azure Monitor respects this.
The Azure Monitor allows for selection of namespace 'xyz' when provided.
Screenshots

Additional context
Code to reproduce the issue:
import time
from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader
from opentelemetry.sdk.metrics import MeterProvider
from opentelemetry.sdk.resources import Resource
from azure.monitor.opentelemetry.exporter import AzureMonitorMetricExporter
APPLICATIONINSIGHTS_CONNECTION_STRING = "InstrumentationKey=fb2...380;IngestionEndpoint=https://germanywestcentral-1.in.applicationinsights.azure.com/;LiveEndpoint=https://germanywestcentral.livediagnostics.monitor.azure.com/;ApplicationId=00d...5b"
namespace = ""
# namespace = "xyz"
if len(namespace) == 0:
telemetry = AzureMonitorMetricExporter.from_connection_string(
APPLICATIONINSIGHTS_CONNECTION_STRING,
)
else:
telemetry = AzureMonitorMetricExporter.from_connection_string(
APPLICATIONINSIGHTS_CONNECTION_STRING,
namespace=namespace + ".c.ns",
)
reader = PeriodicExportingMetricReader(telemetry)
resource = Resource(
attributes={
"service.namespace": "svc.ns",
"metric.namespace": "metric.ns",
"service.name": f"svc.name"}
)
if len(namespace) == 0:
meter_provider = MeterProvider(metric_readers=[reader])
value = 1.1
else:
meter_provider = MeterProvider(metric_readers=[reader], resource=resource)
value = 1.2
telemeter = meter_provider.get_meter(f"sample.meter" + namespace)
tm = telemeter.create_gauge("sample.gauge" + namespace)
print(f"Sending value {value} {namespace if len(namespace) > 0 else ''}")
tm.set(value)
telemetry.force_flush()
telemetry.shutdown(1000)
print("Done")
Describe the bug
No way to define a custom "Metric Namespace" different from 'azure.applicationinsights' when using the
azure.monitor.opentelemetry.exporter.AzureMonitorMetricExporterfrom azure-monitor-opentelemetry-exporter==1.0.0.b36.To Reproduce
Steps to reproduce the behavior:
Expected behavior
azure-monitor-opentelemetry-exporter sends the namespace and Azure Monitor respects this.
The Azure Monitor allows for selection of namespace 'xyz' when provided.
Screenshots

Additional context
Code to reproduce the issue: