Skip to content
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

Metric for count of tables configured with various tier backends #12940

Merged
merged 14 commits into from
Apr 26, 2024

Conversation

shounakmk219
Copy link
Collaborator

@shounakmk219 shounakmk219 commented Apr 16, 2024

Metric for

  • number of tables using each of the tier backend : pinot.controller.XYZtierBackendTableCount
  • total number of tables having tier backend configured : pinot.controller.tierBackendTableCount

@codecov-commenter
Copy link

codecov-commenter commented Apr 16, 2024

Codecov Report

Attention: Patch coverage is 28.57143% with 15 lines in your changes are missing coverage. Please review.

Project coverage is 62.18%. Comparing base (59551e4) to head (b44da99).
Report is 366 commits behind head on master.

Files Patch % Lines
...e/pinot/controller/helix/SegmentStatusChecker.java 31.57% 12 Missing and 1 partial ⚠️
...g/apache/pinot/common/metrics/AbstractMetrics.java 0.00% 1 Missing ⚠️
...g/apache/pinot/common/metrics/ControllerGauge.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #12940      +/-   ##
============================================
+ Coverage     61.75%   62.18%   +0.43%     
+ Complexity      207      198       -9     
============================================
  Files          2436     2502      +66     
  Lines        133233   136607    +3374     
  Branches      20636    21149     +513     
============================================
+ Hits          82274    84945    +2671     
- Misses        44911    45384     +473     
- Partials       6048     6278     +230     
Flag Coverage Δ
custom-integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration <0.01% <0.00%> (-0.01%) ⬇️
integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration2 ?
java-11 62.15% <28.57%> (+0.44%) ⬆️
java-21 62.04% <28.57%> (+0.42%) ⬆️
skip-bytebuffers-false 62.16% <28.57%> (+0.42%) ⬆️
skip-bytebuffers-true 62.02% <28.57%> (+34.29%) ⬆️
temurin 62.18% <28.57%> (+0.43%) ⬆️
unittests 62.17% <28.57%> (+0.43%) ⬆️
unittests1 46.73% <0.00%> (-0.16%) ⬇️
unittests2 27.95% <28.57%> (+0.22%) ⬆️

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.

@@ -135,6 +137,13 @@ protected void postprocess(Context context) {
_controllerMetrics.setValueOfGlobalGauge(ControllerGauge.UPSERT_TABLE_COUNT, context._upsertTableCount);
_controllerMetrics.setValueOfGlobalGauge(ControllerGauge.DISABLED_TABLE_COUNT, context._disabledTables.size());

// metric for total number of tables using a particular tier backend
context._tierBackendTableCountMap.forEach((tier, count) ->
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest to have a static method to generate tier metric name, similar to getTableFullMeterName

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@@ -135,6 +137,13 @@ protected void postprocess(Context context) {
_controllerMetrics.setValueOfGlobalGauge(ControllerGauge.UPSERT_TABLE_COUNT, context._upsertTableCount);
_controllerMetrics.setValueOfGlobalGauge(ControllerGauge.DISABLED_TABLE_COUNT, context._disabledTables.size());

// metric for total number of tables using a particular tier backend
context._tierBackendTableCountMap.forEach((tier, count) ->
_controllerMetrics.setOrUpdateGauge(tier + ControllerGauge.TIER_BACKEND_TABLE_COUNT.getGaugeName(), count));
Copy link
Contributor

Choose a reason for hiding this comment

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

You also need to handle metrics deletion right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point! Tried to address it by maintaining the gauge names. Could not think of a cleaner way to handle it.

@@ -766,6 +767,10 @@ private String composeTableGaugeName(final String tableName, final String key, f
return gauge.getGaugeName() + "." + getTableName(tableName) + "." + key;
}

public String composePluginGaugeName(String pluginName, Gauge gauge) {
return pluginName + StringUtils.capitalize(gauge.getGaugeName());
Copy link
Contributor

Choose a reason for hiding this comment

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

do you want to add a dot int between ?
pluginName + "." + StringUtils.capitalize(gauge.getGaugeName());

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Makes sense, will do.

@@ -135,6 +138,17 @@ protected void postprocess(Context context) {
_controllerMetrics.setValueOfGlobalGauge(ControllerGauge.UPSERT_TABLE_COUNT, context._upsertTableCount);
_controllerMetrics.setValueOfGlobalGauge(ControllerGauge.DISABLED_TABLE_COUNT, context._disabledTables.size());

_tierBackendGauges.forEach(_controllerMetrics::removeGauge);
Copy link
Contributor

@xiangfu0 xiangfu0 Apr 24, 2024

Choose a reason for hiding this comment

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

Do you want to clear _tierBackendGauges as well?

Another approach is to not remove all the gauges but find the diff:

You can keep track all the valid metric names from this loop in a set: context._tierBackendTableCountMap.forEach((tier, count) -> {...}
say newTierBackendGauges, then call
_tierBackendGauges. retainAll(newTierBackendGauges) to get the gauge names not existed.
Then call removeGauge and last thing is

_tierBackendGauges.clear(); 
_tierBackendGauges.putAll(newTierBackendGauges)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was using _tierBackendGauges just to remove all the existing tier gauges. It will be a superset of all the encountered tier backends. Anyways the loop on context._tierBackendTableCountMap takes care of recreating the required gauges.

Copy link
Contributor

@xiangfu0 xiangfu0 Apr 26, 2024

Choose a reason for hiding this comment

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

then you need to add _tierBackendGauges.clear() to remove all the existing gauges right? Otherwise this set is increasing all the time.

Copy link
Collaborator Author

@shounakmk219 shounakmk219 Apr 26, 2024

Choose a reason for hiding this comment

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

Yeah but there will be 1 entry per tier backend plugin which won't be much so I thought we can avoid the complication of managing the previous/new diff and just delete all gauges for the tiers which the controller has witnessed since boot up. What do you think?

Copy link
Contributor

@xiangfu0 xiangfu0 left a comment

Choose a reason for hiding this comment

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

overall lgtm

@xiangfu0 xiangfu0 merged commit 571214d into apache:master Apr 26, 2024
22 checks passed
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