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

[#6468] feature(core): add metrics for mysql backend connect pool #6470

Merged
merged 3 commits into from
Feb 28, 2025

Conversation

TEOTEO520
Copy link
Contributor

@TEOTEO520 TEOTEO520 commented Feb 17, 2025

What changes were proposed in this pull request?

Support metrics for JDBC backend connect pool :

  1. activeConnectionCount
  2. idleConnectionCount
  3. maxConnectionCount

Why are the changes needed?

Support metrics for JDBC connection pool

Fix: #6468

Does this PR introduce any user-facing change?

No

How was this patch tested?

No need to test

@TEOTEO520
Copy link
Contributor Author

Thank you for reviewing

@FANNG1
Copy link
Contributor

FANNG1 commented Feb 24, 2025

@TEOTEO520 Generally LGTM, could you fix the ci failures?

@TEOTEO520 TEOTEO520 force-pushed the feature/support-jdbc-metrics branch from 2009dc3 to 3807085 Compare February 24, 2025 14:08
@TEOTEO520 TEOTEO520 force-pushed the feature/support-jdbc-metrics branch from 3807085 to f4bc0b6 Compare February 24, 2025 14:18
@TEOTEO520 TEOTEO520 force-pushed the feature/support-jdbc-metrics branch from c1c5db7 to 20cac03 Compare February 24, 2025 15:50
public static final String ENTITY_STORE_RELATION_DATASOURCE_IDLE_CONNECTIONS =
"entity-store.relation-datasource.idle-connections";
public static final String ENTITY_STORE_RELATION_DATASOURCE_MAX_CONNECTIONS =
"entity-store.relation-datasource.max-connections";
Copy link
Contributor

Choose a reason for hiding this comment

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

why change underscores to dashes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Other metrics in MetricNames also use dashes:
image

Copy link
Contributor

Choose a reason for hiding this comment

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

where are these from?

Copy link
Contributor

Choose a reason for hiding this comment

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

to be clear, I came from the Prometheus world. https://prometheus.io/docs/practices/naming/

Copy link
Contributor

Choose a reason for hiding this comment

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

The community practices for database metrics: https://opentelemetry.io/docs/specs/semconv/database/database-metrics/

Copy link
Contributor

Choose a reason for hiding this comment

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

the metrics names will be converted to Prometheus format when exporting to prometheus, like a.b.c-d will be converted to a_b_c_d

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the pointer. It is good to have such a converter, but can we simply avoid the - in the first place? It is dangerous and annoying if people want to write some expressions. - can be interpreted as minus.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's usual to use - as the seq for names, and mostly the name doesn't contain expressions.

@FANNG1
Copy link
Contributor

FANNG1 commented Feb 26, 2025

@tengqm is there any other comments?

@tengqm
Copy link
Contributor

tengqm commented Feb 26, 2025

I am still more leaning towards removing the - from metric names. But it is not a strong opinion.

@FANNG1
Copy link
Contributor

FANNG1 commented Feb 27, 2025

I am still more leaning towards removing the - from metric names. But it is not a strong opinion.

I don't have strong option to using - or _ as metrics name separator,as Graviitno use - not _ for configuration name seperator, and for compatibility, how about keep current style?

@jerryshao
Copy link
Contributor

Since we already use - for the metrics name, also prometheus is not the only metrics sink we support, so I would like to still use - to keep the consistency.

@jerryshao jerryshao merged commit 2af41ca into apache:main Feb 28, 2025
28 checks passed
Abyss-lord pushed a commit to Abyss-lord/gravitino that referenced this pull request Mar 2, 2025
…ol (apache#6470)

### What changes were proposed in this pull request?

Support metrics for JDBC backend connect pool :
1. activeConnectionCount
2. idleConnectionCount
3. maxConnectionCount

### Why are the changes needed?

Support metrics for JDBC connection pool

Fix: apache#6468

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

No need to test

---------

Co-authored-by: teo <litianhang@bilibili.com>
Co-authored-by: teo <litianhang@bilibili.co>
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.

[Improvement] Add Connection Pool Metrics for JDBC Backend Storage
5 participants