Closed govenkat-ms closed 3 years ago
Hi there. No, metrics are not supported, yet. I think this would be great to add, though. Do you happen to know if there is API documentation about metrics in AppInsights?
Okay, I think the API for traces also supports metrics. It's just a different data model.
Sadly, it looks like neither the official Python (source) nor JavaScript (source) exporters support metrics. This means we need to figure out the mapping from OpenTelemetry model to AppInsights model ourselves.
If I see this correctly, this is the AppInsights model (swagger):
{
"name": "Microsoft.ApplicationInsights.Metric",
"time": "2009-06-15T13:45:30.0000000Z",
"data": {
"baseType": "MetricsData",
"baseData": {
"metrics": [
{
"ver": 2,
"ns": "something",
"name": "banana",
"value": 4.2,
"kind": "Measurement OR Aggregation",
"count": 2,
"min": 1.0,
"max": 10.0,
"stdDev": 0.5
}
],
"properties": {}
}
}
}
Looks like there is also another API for metrics called "Azure Metrics":
This is looks harder to use because of the OAuth authentication.
I don't have any experience using metrics in AppInsights. Do you know which one is preferred right now, @govenkat-ms?
If we would implement this based on the AppInsights API, we would need to map whatever the different aggregators give us to the MetricsData model.
I imagine this list is likely subject to change as the OpenTelemetry metrics API finalizes and the Rust implementation catches up. But kinds of aggregations should not change drastically.
I don't believe there's a preference to either the docs or the swagger.
I have an intial implementation of metrics, which seems to be working. Still needs some more testing of the different aggregation types but this looks promising.
Sorry this took so long. I couldn't find the time to finish this.
Anyway. Metrics support is now in and released in version 0.18.0. The API to setup the exporter is still a bit rough. But I think that can be improved in the future.
Can this library be used for sending metrics to AppInsights?
Thanks