I am sending custom metrics to azure monitor through my code through REST APIs. However I dont see those metrics being pushed to Log Analytics
My code snippet looks like this
metric_data = {
"time": date,
"data": {
"baseData": {
"metric": "PipelineSucceeded",
"namespace": metric_namespace,
"dimNames": ["BuildId"],
"series": [
{
"dimValues": [build_id],
# 0 or 1 based on the boolean
"min": pipeline_succeeded_value,
"max": pipeline_succeeded_value,
"sum": pipeline_succeeded_value,
"count": 1
}
]
}
}
}
.
.
url = f"https://{location}/monitoring.azure.com/{resource_id}/metrics"
.
.
response = requests.post(url, json=metric_data, headers=headers)
resource_id points to the log analytics workspace and I am able to successfully push the metrics to the /metrics endpoint and I am able to view it in Azure Monitoring/metrics.
Things to consider:
- There are no tables associated that store these data in either Metrics > Tables or Log Analytics > Tables and I am also not able to view any of the metrics I pushed with KQL because I dont know which tables it is storing them in
- After listing all tables in KQL I still did not find the custom metrics anywhere
- I have Monitoring Contributor and Monitoring Metrics Publisher Role assigned to me
Questions:
- I also have a diagnostic setting enabled that should send all Logs to Log Analytics workspace but that did not work. I have it enabled for more than 10 hours. How do I make it work?
- Can I see the source of the data (my metrics) all in one place without having to aggregate it? Are there other ways to do so?