-
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
Discover service names from process env vars #1195
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1195 +/- ##
==========================================
+ Coverage 73.29% 82.00% +8.71%
==========================================
Files 135 137 +2
Lines 11549 11588 +39
==========================================
+ Hits 8465 9503 +1038
+ Misses 2427 1553 -874
+ Partials 657 532 -125
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Nice addition! I guess it's useful for automatic instrumentation of applications that already ship the OTEL SDK, but disabled. Any other concrete use case?
pkg/internal/exec/procenv.go
Outdated
} | ||
} | ||
|
||
fmt.Printf("%v\n", vars) |
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.
I guess you forgot to remove this.
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.
Oh, nice catch!!!
Yeah exactly, well technically we support this usage in sidecar mode right? We can pass to Beyla the OTEL env vars and it will pick them up. So I thought, why not support this in daemonset mode instead of forcing people to use our Beyla config files to name their services. I think it's more efficient to use the OTEL standard, if folks have configured their applications using the OTEL variables we can pick them up. It's mainly targeted at people that want to rename their services for the purpose of reporting. If I wanted to do this today, I'd have to add Beyla discovery configuration section. Which means that if Beyla is monitoring all services on a node, I have to restart the daemonset if I wanted to add new service definition. By using the OTEL variables we can keep Beyla running, not change any config and we'll automatically pick up their desired name. At the same time, this approach allows us to pass custom resource attributes per service. We don't have this option today in our config. |
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.
Great addition!!
Since we are already reading the proc file system for the instrumented processes, why not read their env variables for supporting OTEL_SERVICE_NAME and OTEL_RESOURCE_ATTRS. This PR parses the process environment variables for the OTEL variable definitions.
TODO: