Skip to content

Commit

Permalink
changed the behaviour on how default value is set
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorhugoro1 committed Jun 17, 2024
1 parent db79e4c commit 771b1a5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func main() {
var logLevel string

flag.BoolVar(&globalImpl, "global-impl", false, "Record telemetry from the OpenTelemetry default global implementation")
flag.StringVar(&logLevel, "log-level", "info", "Define log visibility level")
flag.StringVar(&logLevel, "log-level", "", "Define log visibility level, default is `info`")

flag.Usage = usage
flag.Parse()
Expand Down Expand Up @@ -102,7 +102,9 @@ func main() {
instOptions = append(instOptions, auto.WithGlobal())
}

instOptions = append(instOptions, auto.WithLogLevel(logLevel))
if logLevel != "" {
instOptions = append(instOptions, auto.WithLogLevel(logLevel))
}

inst, err := auto.NewInstrumentation(ctx, instOptions...)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion instrumentation.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,10 @@ var lookupEnv = os.LookupEnv
// - OTEL_SERVICE_NAME (or OTEL_RESOURCE_ATTRIBUTES): sets the service name
// - OTEL_TRACES_EXPORTER: sets the trace exporter
// - OTEL_GO_AUTO_GLOBAL: enables the OpenTelemetry global implementation
// - OTEL_LOG_LEVEL: sets the log level
//
// This option may conflict with [WithTarget], [WithPID], [WithTraceExporter],
// [WithServiceName] and [WithGlobal] if their respective environment variable is defined.
// [WithServiceName], [WithGlobal] and [WithLogLevel] if their respective environment variable is defined.
// If more than one of these options are used, the last one provided to an
// [Instrumentation] will be used.
//
Expand Down

0 comments on commit 771b1a5

Please sign in to comment.