Conversation
757c771 to
ae95879
Compare
sergiosalvatore
left a comment
There was a problem hiding this comment.
A couple minor comments -- and the otel API is 😱
otregistrar/registrar.go
Outdated
| } | ||
| *t = mt | ||
| default: | ||
| // interatively unwrap pointers/interfaces: |
There was a problem hiding this comment.
nit: s/interatively/iteratively/
otregistrar/registrar.go
Outdated
| fi := f.Addr().Interface() | ||
| switch t := fi.(type) { | ||
| case *metric.Int64Counter: | ||
| if !ok { |
There was a problem hiding this comment.
I'm fairly certain this is the ok from L76, but the context is sort of lost from there. Perhaps we should rename it to tagFound or something like that. Otherwise, I'm a little unclear about what isn't "ok" here...
Contributor
Author
There was a problem hiding this comment.
I made it metricNameOK to match the convention.
It made more sense when the if !ok { continue } was next to the Tag.Lookup call, but I had to move this down to the individual cases to support recursing into struct-typed fields.
Add a package that simplifies registration by iterating over struct fields and using the field-types+struct tags to register otel instruments with a passed otel `Meter`.
ae95879 to
1aafa1c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
otregistrar package & go.mod file
Add a package that takes care of iterating over struct fields and using
the field-types+struct tags to register otel instruments with a passed
otel
Meter.Add github actions