-
Notifications
You must be signed in to change notification settings - Fork 684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for MSSQL Transactions counters #372
Add support for MSSQL Transactions counters #372
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, thanks! Some naming comments
collector/mssql.go
Outdated
c.TransactionsVersionCleanupRateKBs, | ||
prometheus.GaugeValue, | ||
float64(v.VersionCleanuprateKBPers), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the name of the data, this needs to be normalized to bytes, I suppose?
collector/mssql.go
Outdated
|
||
ch <- prometheus.MustNewConstMetric( | ||
c.TransactionsVersionGenerationRateKBs, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same kilobytes->bytes here.
collector/mssql.go
Outdated
|
||
ch <- prometheus.MustNewConstMetric( | ||
c.TransactionsVersionStoreSizeKB, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More kilobytes
collector/mssql.go
Outdated
SQLErrorsTotal *prometheus.Desc | ||
|
||
// Win32_PerfRawData_{instance}_SQLServerTransactions | ||
TransactionsFreeSpaceInTempDbKB *prometheus.Desc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure these matches the name of the actual metric we expose, if it is not the same as the WMI name or we improved the naming.
In general, I find it more important for us to have good metric names that indicate what they mean, vs staying close to Microsoft naming. So having |
@carlpett Thanks for sensible comments! They're fixed now |
Nice 🎉 |
If we can rely on Microsoft docs it says about percentage ratio not just count.
Also I found mention of counter in SQL Server book that defines it as follows
But true this or not I can only check tomorrow on staging db. On my laptop value of counter is just pointless 0 :( |
Actually I found a way to look counter values on staging db and I suppose the real ratio can be calculated as: |
Ah, as I suspected then.
Thing is, we can't, a lot of the time. Since we use the PerfRaw values, but the docs are about the "cooked" values, ie after they have some calculation performed on them. In this case, dividing by the base value (which tends to be total number of seconds elapsed since counting started, or similar) Usually what we do is then just expose the nominator as a counter, so you'd rename it as |
Got the idea, thanks! Honestly, these unobvious things make me frustrated. The documentation talks about one thing when counter values are completely different and have nothing to do with docs 😬. Will fix naming soon |
…com/callvirtual/wmi_exporter into features/sql-transactions-collector
Yes, I know. We should write something up about how to understand what they really mean. But time is a bit limited, so we still haven't managed to do so. We're sorry that it leads to frustrations for you and other contributors! |
This looks good now, thanks a lot for your contribution! |
Pull request changes:
Also I'm not pretty happy with some counter names:
If follow the original microsoft naming pattern, they should be called
It's again a bit redundant, so I replaced the
transactions
suffix withactive_total
which is more appropriate in terms of Prometheus naming convention. I decided to addactive
because microsoft docs says about only active transactions but not transactions at all. This detail may not be obvious if we use justtotal
prefix. But as I mentioned I'm not really sure if this decision is trully correct. Therefore if there are any suggestions on how names can be enchanced, feel free to share them :)