RobustPerception / azure_metrics_exporter

Azure metrics exporter for Prometheus
Apache License 2.0
133 stars 70 forks source link

Add additional label to fix SQL database scrap issue #44

Closed mboret closed 5 years ago

mboret commented 5 years ago

Hi,

This is related to issue #40 The exporter works only if the DB SQL server has one database with more than one this create a conflict has the exporter reports that the metric already exists. In fact, it's related to the label "resource_name", which takes the name of the SQL Server and not of the database.

The resourceID for a DB:

/subscriptions/XXXX-XXXXX-XXXXX-XXXXX-XXXXX/resourceGroups/rg-test/providers/Microsoft.Sql/servers/test-sql-server/databases/test-database-a/providers/microsoft.Insights

The solution could be to add another label to identify the database name("sub_resource_name"). Maybe there is the same issue with other Azure services which have long resourceID and so this change can fix it.

adam-resdiary commented 5 years ago

Firstly, just wanted to say cheers for making this exporter - it's really useful and was simple to get up and running!

We've just run into this problem when trying to get metrics for our SQL Server databases into Prometheus. We can deal with it for now by only bringing in a subset of the really critical databases that we need to monitor, and (maybe?) relabelling to put in the correct database name based on the server it's on, but as soon as we start adding more than one database on any of our servers that's not going to work anymore.

So what I'm wondering is whether there's any time frame for getting a fix for this merged, or if we ought to think about temporarily forking and building our own copy with a fix.

I appreciate that it can be difficult to get the time to spend on open source projects, so I'm also wondering if there's anything I can do to help get this solved? For example is there any testing you need done, any research (into the possible variations of resource names in Azure), or anything else that would help?

Thanks again!

brian-brazil commented 5 years ago

Thanks!

I hadn't seen that the PR had been updated.

adam-resdiary commented 5 years ago

Great - thanks a lot for merging. You've just made my week! 😸