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

maint: Refactor metrics registration to streamline declaration and enable easier documentation generation #1350

Merged
merged 4 commits into from
Sep 26, 2024

Conversation

VinozzZ
Copy link
Contributor

@VinozzZ VinozzZ commented Sep 25, 2024

Which problem is this PR solving?

Short description of the changes

  • Introduce a new struct type metrics.Metadata to represent all information needed for a Refinery metric
  • Change metrics.Register signature to accept metrics.Metadata as its argument
  • Refactor metrics registration calls in each packages so that we declare metrics we want to register first in a package level variable first
  • Set zero value for each OTel metrics during registration
  • set Unit and Description for each OTel metrics

@VinozzZ VinozzZ requested a review from a team as a code owner September 25, 2024 15:31
@VinozzZ VinozzZ changed the title feat:maint: Refactor metrics registration to streamline declaration and enable easier documentation generation maint: Refactor metrics registration to streamline declaration and enable easier documentation generation Sep 25, 2024
@VinozzZ VinozzZ self-assigned this Sep 25, 2024
@VinozzZ VinozzZ added this to the v2.9 milestone Sep 25, 2024
@VinozzZ VinozzZ added the type: maintenance The necessary chores to keep the dust off. label Sep 25, 2024
@kentquirk
Copy link
Contributor

If we're going to use OTel units, they are supposed to conform to this standard.

I'm not sure I care much about things like "trace" and "hash" but anything that is an actual measurable quantity should conform to that.

I didn't go through the whole thing to identify any problems yet. Happy to help if you want.

Copy link
Contributor Author

VinozzZ commented Sep 25, 2024

@kentquirk Oh, i didn’t know there’s a standard for OTel units. If you want a easier way to look through all the units, here’s the generated markdown file with all the metrics https://github.com/honeycombio/refinery/blob/yingrong.metric_doc/metrics.md

Copy link
Contributor

@kentquirk kentquirk left a comment

Choose a reason for hiding this comment

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

I think this is a very nice cleanup. Thank you.

@VinozzZ VinozzZ merged commit cd77129 into main Sep 26, 2024
5 checks passed
@VinozzZ VinozzZ deleted the yingrong.metrics_annotation branch September 26, 2024 19:35
TylerHelmuth pushed a commit that referenced this pull request Oct 16, 2024
…able easier documentation generation (#1350)

## Which problem is this PR solving?

- part 1 for: #1152 
This PR prepares us to have a consistent metrics registration pattern so
that in a later PR we can use
https://pkg.go.dev/golang.org/x/tools/go/packages to automatically
generate metrics documentation.

- part 2 is implemented in #1351

## Short description of the changes

- Introduce a new struct type `metrics.Metadata` to represent all
information needed for a Refinery metric
- Change `metrics.Register` signature to accept `metrics.Metadata` as
its argument
- Refactor metrics registration calls in each packages so that we
declare metrics we want to register first in a package level variable
first
- Set zero value for each OTel metrics during registration
- set Unit and Description for each OTel metrics
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: maintenance The necessary chores to keep the dust off.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants