-
Notifications
You must be signed in to change notification settings - Fork 0
feat(otel): add complete OTEL configuration fields #143
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -115,6 +115,13 @@ func NewBashCCOtelEnvService() CCOtelEnvService { | |||||
| "export OTEL_LOGS_EXPORTER=otlp", | ||||||
| "export OTEL_EXPORTER_OTLP_PROTOCOL=grpc", | ||||||
| "export OTEL_EXPORTER_OTLP_ENDPOINT=" + ccOtelEndpoint, | ||||||
| "export OTEL_METRIC_EXPORT_INTERVAL=10000", | ||||||
| "export OTEL_LOGS_EXPORT_INTERVAL=5000", | ||||||
| "export OTEL_LOG_USER_PROMPTS=1", | ||||||
| "export OTEL_METRICS_INCLUDE_SESSION_ID=true", | ||||||
| "export OTEL_METRICS_INCLUDE_VERSION=true", | ||||||
| "export OTEL_METRICS_INCLUDE_ACCOUNT_UUID=true", | ||||||
| "export OTEL_RESOURCE_ATTRIBUTES=\"user.name=$(whoami),machine.name=$(hostname),team.id=shelltime\"", | ||||||
| ccOtelMarkerEnd, | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -200,6 +207,13 @@ func NewZshCCOtelEnvService() CCOtelEnvService { | |||||
| "export OTEL_LOGS_EXPORTER=otlp", | ||||||
| "export OTEL_EXPORTER_OTLP_PROTOCOL=grpc", | ||||||
| "export OTEL_EXPORTER_OTLP_ENDPOINT=" + ccOtelEndpoint, | ||||||
| "export OTEL_METRIC_EXPORT_INTERVAL=10000", | ||||||
| "export OTEL_LOGS_EXPORT_INTERVAL=5000", | ||||||
| "export OTEL_LOG_USER_PROMPTS=1", | ||||||
| "export OTEL_METRICS_INCLUDE_SESSION_ID=true", | ||||||
| "export OTEL_METRICS_INCLUDE_VERSION=true", | ||||||
| "export OTEL_METRICS_INCLUDE_ACCOUNT_UUID=true", | ||||||
| "export OTEL_RESOURCE_ATTRIBUTES=\"user.name=$(whoami),machine.name=$(hostname),team.id=shelltime\"", | ||||||
| ccOtelMarkerEnd, | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -282,6 +296,13 @@ func NewFishCCOtelEnvService() CCOtelEnvService { | |||||
| "set -gx OTEL_LOGS_EXPORTER otlp", | ||||||
| "set -gx OTEL_EXPORTER_OTLP_PROTOCOL grpc", | ||||||
| "set -gx OTEL_EXPORTER_OTLP_ENDPOINT " + ccOtelEndpoint, | ||||||
| "set -gx OTEL_METRIC_EXPORT_INTERVAL 10000", | ||||||
| "set -gx OTEL_LOGS_EXPORT_INTERVAL 5000", | ||||||
| "set -gx OTEL_LOG_USER_PROMPTS 1", | ||||||
| "set -gx OTEL_METRICS_INCLUDE_SESSION_ID true", | ||||||
| "set -gx OTEL_METRICS_INCLUDE_VERSION true", | ||||||
| "set -gx OTEL_METRICS_INCLUDE_ACCOUNT_UUID true", | ||||||
| "set -gx OTEL_RESOURCE_ATTRIBUTES \"user.name=$(whoami),machine.name=$(hostname),team.id=shelltime\"", | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For fish shell, the idiomatic syntax for command substitution is
Suggested change
|
||||||
| ccOtelMarkerEnd, | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
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.
These new OTEL configuration values are hardcoded and duplicated across the
NewBashCCOtelEnvService,NewZshCCOtelEnvService, andNewFishCCOtelEnvServicefunctions. This code duplication, especially between the bash and zsh implementations which are identical, can make future updates error-prone and tedious.To improve maintainability, I recommend defining these values as constants at the package level. This centralizes the configuration, reduces the risk of inconsistencies, and makes the code easier to read and manage.
For example, you could define constants for the new settings:
Then, these constants can be used to construct the
envLinesslices for each shell. While a larger refactoring to eliminate the duplicatedenvLinesslices might be out of scope for this PR, introducing constants for these new values would be a valuable improvement.