Update metric rules to emit database as a label
Description
This PR
- Fixes the broken metrics for table names with database context by introducing pattern to match database prefix
- Extracts the database name from metric table name and adds it as a metric label named
databasewhile emitting
Testing
- Ensure existing tests around metric checks pass
- Manually compared the metrics endpoint payload by running the quickstart before and after the changes. Both the payloads are equivalent.
labels
bugfix observability
release-notes
Table related metrics will include database name as a metric label
Codecov Report
Attention: Patch coverage is 5.00000% with 19 lines in your changes are missing coverage. Please review.
Project coverage is 62.01%. Comparing base (
59551e4) to head (002fea1). Report is 202 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #12739 +/- ##
============================================
+ Coverage 61.75% 62.01% +0.26%
+ Complexity 207 198 -9
============================================
Files 2436 2461 +25
Lines 133233 134744 +1511
Branches 20636 20819 +183
============================================
+ Hits 82274 83568 +1294
- Misses 44911 45027 +116
- Partials 6048 6149 +101
| Flag | Coverage Δ | |
|---|---|---|
| custom-integration1 | <0.01% <0.00%> (-0.01%) |
:arrow_down: |
| integration | <0.01% <0.00%> (-0.01%) |
:arrow_down: |
| integration1 | <0.01% <0.00%> (-0.01%) |
:arrow_down: |
| integration2 | 0.00% <0.00%> (ø) |
|
| java-11 | 34.93% <5.00%> (-26.78%) |
:arrow_down: |
| java-21 | 61.90% <5.00%> (+0.28%) |
:arrow_up: |
| skip-bytebuffers-false | 61.98% <5.00%> (+0.23%) |
:arrow_up: |
| skip-bytebuffers-true | 61.87% <5.00%> (+34.15%) |
:arrow_up: |
| temurin | 62.01% <5.00%> (+0.26%) |
:arrow_up: |
| unittests | 62.01% <5.00%> (+0.26%) |
:arrow_up: |
| unittests1 | 46.73% <5.26%> (-0.16%) |
:arrow_down: |
| unittests2 | 27.99% <0.00%> (+0.26%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Can you please also explain how we tested it in the description section? Otherwise, looks good to me.
@zhtaoxiang Updated the PR description with testing performed.
@zhtaoxiang Updated the rules to work with dot in table name without the need of masking it. Table name label will include the database prefix as suggested by @Jackie-Jiang but the database label will be missing for metrics on default database as there is no way to provide default value on missing values in the rules.
Are we able to filter on empty database?
@Jackie-Jiang database = "" should work for default db filtering.
Will it be empty string or
null?
The database label will be missing on metric