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

feature: add metric exporter interface #3416

Open
wants to merge 3 commits into
base: 1.8
Choose a base branch
from

Conversation

Daydreamer-ia
Copy link

Describe what this PR does / why we need it

#3314

Does this pull request fix one issue?

Describe how you did it

Describe how to verify it

Special notes for reviews

@LearningGp LearningGp added to-review To review area/metrics Issues or PRs related to metrics and monitoring kind/feature Category issues or prs related to feature request. labels Aug 16, 2024
try {
instance = SpiLoader.of(MetricExporter.class).loadFirstInstance();
} catch (Throwable t) {
// ignore
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be better to log the exception using RecordLog.

Copy link
Author

Choose a reason for hiding this comment

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

done

try {
metricWriter.write(entry.getKey(), entry.getValue());
} catch (Exception e) {
RecordLog.warn("[MetricTimerListener] Write metric error", e);
Copy link
Collaborator

Choose a reason for hiding this comment

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

MetricTimerListener -> DefaultExporter

Copy link
Author

Choose a reason for hiding this comment

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

done

static {
MetricExporter instance = null;
try {
instance = SpiLoader.of(MetricExporter.class).loadFirstInstance();
Copy link
Collaborator

Choose a reason for hiding this comment

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

We may need to discuss whether it's more suitable to get the first implementation or to obtain a list to support multiple exporters.

@LearningGp
Copy link
Collaborator

We may need to discuss whether we should support having multiple exporters active at the same time. I'm not sure about your perspective on this.

@Daydreamer-ia
Copy link
Author

We may need to discuss whether we should support having multiple exporters active at the same time. I'm not sure about your perspective on this.

I keep one leave is order to sync the old logic, to be honest, i agree with you that support multiple exporters here. Do i keep more exporters active this pr?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/metrics Issues or PRs related to metrics and monitoring kind/feature Category issues or prs related to feature request. to-review To review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants