You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support to custom log level through command line flag and environment variable (#842)
* added log level through commnd line flag
* added changelog entry
* implemented own level enum and add err when not found the inputed log level
* changed log visibility to debug on some info logs
* changed test job to use debug log level
* running precommit
* adjusted log visibility levels to ensure is following the flag
* changed the behaviour on how default value is set
* removed not used levels and add comments to levels
* changed level to auto package and use Level as parameter on WithLogLevel
* changed type to log level, add validate method and enforce a type on withLogLevel method
* additional changelog message
* runned precommit
* changed levels to log preffix and simplified unmarshal
* change some descriptions and added ParseLogLevel test
* changed to use ParseLogLevel instead of Unmarshal
---------
Co-authored-by: Tyler Yahn <[email protected]>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,8 @@ OpenTelemetry Go Automatic Instrumentation adheres to [Semantic Versioning](http
12
12
13
13
- Initial support for `trace-flags`. ([#868](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/868))
14
14
- Support `google.golang.org/grpc``1.66.0-dev`. ([#872](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/872))
15
+
- Add support to log level through command line flag. ([#842](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/842))
16
+
- The `WithLogLevel` function and `LogLevel` type are added to set the log level for `Instrumentation`. ([#842](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/842))
Copy file name to clipboardExpand all lines: instrumentation.go
+53-11Lines changed: 53 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -58,6 +58,8 @@ const (
58
58
// envOtelGlobalImplKey is the key for the environment variable value enabling to opt-in for the
59
59
// OpenTelemetry global implementation. It should be a boolean value.
60
60
envOtelGlobalImplKey="OTEL_GO_AUTO_GLOBAL"
61
+
// envLogLevelKey is the key for the environment variable value containing the log level.
62
+
envLogLevelKey="OTEL_LOG_LEVEL"
61
63
)
62
64
63
65
// Instrumentation manages and controls all OpenTelemetry Go
@@ -72,8 +74,17 @@ type Instrumentation struct {
72
74
// binary or pid.
73
75
varerrUndefinedTarget=fmt.Errorf("undefined target Go binary, consider setting the %s environment variable pointing to the target binary to instrument", envTargetExeKey)
0 commit comments