Skip to content

Conversation

@suresh-prakash
Copy link
Contributor

@suresh-prakash suresh-prakash commented Jan 23, 2024

Using MultiGauge to register database custom metrics so that the old tags stop reporting in subsequent runs if the database doesn't yield the results.

@suresh-prakash suresh-prakash requested a review from a team as a code owner January 23, 2024 10:26
@github-actions
Copy link

github-actions bot commented Jan 23, 2024

Test Results

31 tests  ±0   31 ✅ ±0   10s ⏱️ -1s
 9 suites ±0    0 💤 ±0 
 9 files   ±0    0 ❌ ±0 

Results for commit bb3ca14. ± Comparison against base commit 862e96a.

♻️ This comment has been updated with latest results.

@codecov
Copy link

codecov bot commented Jan 23, 2024

Codecov Report

Attention: 18 lines in your changes are missing coverage. Please review.

Comparison is base (862e96a) 68.25% compared to head (bb3ca14) 66.40%.

Files Patch % Lines
...core/serviceframework/metrics/ResizeableGauge.java 0.00% 10 Missing ⚠️
...ace/core/serviceframework/metrics/Measurement.java 0.00% 6 Missing ⚠️
...viceframework/metrics/PlatformMetricsRegistry.java 60.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main      #86      +/-   ##
============================================
- Coverage     68.25%   66.40%   -1.86%     
  Complexity      106      106              
============================================
  Files            15       17       +2     
  Lines           608      625      +17     
  Branches         32       32              
============================================
  Hits            415      415              
- Misses          174      191      +17     
  Partials         19       19              
Flag Coverage Δ
unit 66.40% <14.28%> (-1.86%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@laxmanchekka laxmanchekka self-requested a review January 23, 2024 15:16
@suresh-prakash suresh-prakash changed the title Add database monitor registry Register database custom metrics using a multi gauge Jan 24, 2024
isInit = false;
}

static MultiGauge registerMultiGauge(final String gaugeName) {
Copy link
Contributor

@aaron-steinfeld aaron-steinfeld Jan 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would still suggest flipping this around to match the other meters. The Registry is what external code interacts with today, which returns a meter that is then used to report.

  public static ResizableGauge registerResizableGauge(
      String name // consider adding tags so we don't have to break the API later)

That would mean you'd remove the registration from the constructor of ResizableGauge (and make it package private).

If you want to switch that around (since I think constructing a meter and registering it separately is a better design, also what micrometer does), we could do (it would be inconsistent, so we'd want to eventually add support to flip the other meters, too) so but I would still keep the registration out of the ResizableGauge constructor and I would make this function in platform metrics registry generic (e.g. <T extends Registrable> T register(T registrable))

Hope that makes sense, happy to discuss if not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Picking the first approach here for consistency.

consider adding tags so we don't have to break the API later)

We may not have the labels/tags upfront while registering the gauge. We only get them from the query results. Did you mean taking in any additional Tags and passing down empty Tags from monitorCustomMetrics?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may not have the labels/tags upfront while registering the gauge. We only get them from the query results. Did you mean taking in any additional Tags and passing down empty Tags from monitorCustomMetrics?

Yeah, I think the underlying multigauge allows both tags up front (presumably static things, like what service this is) and tags on the individual measurement reports. I suppose we could always overload it later if we don't need it now.

@suresh-prakash suresh-prakash merged commit 437a15f into main Jan 31, 2024
@suresh-prakash suresh-prakash deleted the add_database_monitor_registry branch January 31, 2024 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants