@jgialis , thank you for the question.
I see that you are trying to send metrics to STANDARD namespace. Note that the method being used - trackMetric()
is used to send custom metric. When you use this method, irrespective of the metricNamespaceName
you try to specify, they would always be placed under the CUSTOM category.
There are 2 observations from your code above:
- The
getProperties().put()
method used adds these as custom dimensions. They are different from the namespce as you see in the metric explorer. When you use this getproperties().put() method, the key/value gets added to logs as below (as can be seen from customMetric table) However, in metric explorer, you would not see this new namespace and it will be listed under the default custom namespace - azure.applicationinsights. - If you would like to set namespace, which can be used in metric explorer, you should be using the
setMetricNamespace()
method ofMetricTelemetry
class, as shown below
TelemetryClient telemetryClient = new TelemetryClient();
MetricTelemetry metric = new MetricTelemetry("custom exception count", 4.0); //new metric name
metric.setMetricNamespace("Application Insights standard metrics"); //the namespace being set
Note that - even if I have used the exact namespace of the STANDARD category, the metric gets listed under CUSTOM category with this namespace:
Hope this helps.
If the answer did not help, please add more context/follow-up question for it, and we will help you out. Else, if the answer helped, please click Accept answer so that it can help others in the community looking for help on similar topics.