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

[metrics] remove go-kit dependencies #282

Merged
merged 3 commits into from
Jan 12, 2023

Conversation

0xcb9ff9
Copy link

Description

Now implementation use go-kit package help build the metrics interface, but there is a performance cost in the implementation of go-kit, this PR replaces go-kit, and directly uses the prometheus metrics interface

exist cost code: prometheus.go#L159

makeLabels will be called every time the metrics is updated

func makeLabels(labelValues ...string) prometheus.Labels {
	labels := prometheus.Labels{}
	for i := 0; i < len(labelValues); i += 2 {
		labels[labelValues[i]] = labelValues[i+1]
	}
	return labels
}

heap pprof results:

pprof

Changes include

  • Bugfix (non-breaking change that solves an issue)

Checklist

  • I have assigned this PR to myself
  • I have added at least 1 reviewer
  • I have added the relevant labels

Testing

  • I have tested this code with the official test suite

@0xcb9ff9 0xcb9ff9 added the bug fix Functionality that fixes a bug label Jan 12, 2023
@0xcb9ff9 0xcb9ff9 requested a review from DarianShawn as a code owner January 12, 2023 07:25
@0xcb9ff9 0xcb9ff9 self-assigned this Jan 12, 2023
Copy link
Collaborator

@DarianShawn DarianShawn left a comment

Choose a reason for hiding this comment

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

Every step makes sense.
Thanks for the contribution.

@DarianShawn DarianShawn merged commit 8b4141f into dogechain-lab:dev Jan 12, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jan 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fix Functionality that fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants