-
Notifications
You must be signed in to change notification settings - Fork 111
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
Export internal metrics using OTEL metrics #1425
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Sweet!
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1425 +/- ##
==========================================
- Coverage 72.19% 71.66% -0.53%
==========================================
Files 194 195 +1
Lines 19239 19372 +133
==========================================
- Hits 13889 13883 -6
- Misses 4679 4814 +135
- Partials 671 675 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -5,9 +5,27 @@ import ( | |||
"context" | |||
) | |||
|
|||
type InternalMetricsExporter string | |||
|
|||
const ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of typing these as strings and bearing the overhead of passing them around and string comparison, I'd type them as uint8
or int
and provide an UnmarshalText
implementation that takes care of deserialising the string. See
type TCBackend uint8 |
func (b *TCBackend) UnmarshalText(text []byte) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like a good optimization. However, for sake of consistency I'd rather leave like this. Maybe open an issue to fix this everywhere in our code base?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as this string comparison is done once at startup, I'd say that the overhead is negligible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed you are right. Although there's an extra hidden benefit with using UnmarshallText
, albeit perhaps not that relevant/important, but worth noting: when it returns an error (for instance because the wrong input/option has been provided) it causes the program to fail very early in the process, before we start running validation code and what not:
time=2025-01-08T09:59:35.286-06:00 level=ERROR msg="wrong configuration" error="reading env vars: env: parse error on field \"TCBackend\" of type \"tcmanager.TCBackend\": invalid TCBakend value: 'foo'"
Just thought I'd mention it for the record.
@@ -5,9 +5,27 @@ import ( | |||
"context" | |||
) | |||
|
|||
type InternalMetricsExporter string | |||
|
|||
const ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as this string comparison is done once at startup, I'd say that the overhead is negligible.
7d19fdc
to
5f1d101
Compare
This PR adds the ability to exporter Beyla internal metrics for users that are using OpenTelemetry metrics.
Fixes #1211