Reputation: 581
I'm trying to send some PerformanceCounters manually to ApplicationInsights.
I've tried posting directly to https://dc.services.visualstudio.com/v2/track
with this body:
{
"iKey": "xxxxxxx",
"time": "2019-05-23T10:22:52.9586379Z",
"name": "MetricData",
"tags": {
"ai.cloud.role": "My Test Role"
},
"data": {
"baseType": "MetricData",
"baseData": {
"metrics": [
{
"name": "performanceCounters/processCpuPercentage",
"value": 0.5,
"count": 1
}
]
}
}
}
This call ends up in customMetrics
and I really want it to end up in performanceCounters
so that I can use all the existing dashboards.
I've looked through github repos but can't find the place where is actually write ther perfconter to json.
Any ideas?
Thanks!
Upvotes: 1
Views: 124
Reputation: 3196
Use the following to make the metric appear in performancecounter table as opposed to customMetrics.
metricTelemetry.Properties.Add("CustomPerfCounter", "true");
If you can modify json payload also to do the same, you'll achieve what you want.
Upvotes: 0
Reputation: 30035
Update: a quick test with following data via postman, and it works ok.
the data:
{
"name": "Microsoft.ApplicationInsights.foo.PerformanceCounter",
"time": "2019-05-28T08:22:20.6464765-07:00",
"iKey": "xxxxx",
"tags": { "ai.internal.sdkVersion": "1.2.0.5639" },
"data": {
"baseType": "PerformanceCounterData",
"baseData": {
"ver": 2,
"categoryName": "Process",
"counterName": "% Processor Time",
"instanceName": "TestPerfCounters.vshost",
"value": 20.0318031311035
}
}
}
in postman:
in azure portal -> app insights -> logs, I can find the data in performanceCounters table.
As per the last section of this doc, please try to change "baseType" to "PerformanceCounterData"
.
Screenshot from the doc:
I did not have time to test it. But if any issues, please let me know.
Upvotes: 1