Skip to content

Commit

Permalink
[chore][elasticsearch/exporter] Set log level based on debug mode flag (
Browse files Browse the repository at this point in the history
open-telemetry#34059)

Allows setting the log level in integration-tests based on the debug
mode flag. Makes it easier to debug tests when required.
  • Loading branch information
lahsivjar authored Jul 17, 2024
1 parent f997202 commit 8974251
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions exporter/elasticsearchexporter/integrationtest/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"os"
"strings"
"sync"
"testing"
"time"
Expand Down Expand Up @@ -46,9 +47,12 @@ func createConfigYaml(

processorSection, processorList := createConfigSection(processors)
extensionSection, extensionList := createConfigSection(extensions)
exporters := []string{receiver.ProtocolName()}
debugVerbosity := "basic"
logLevel := "INFO"
if debug {
debugVerbosity = "detailed"
exporters = append(exporters, "debug")
logLevel = "DEBUG"
}

format := `
Expand All @@ -67,12 +71,16 @@ service:
telemetry:
metrics:
address: 127.0.0.1:%d
logs:
level: %s
sampling:
enabled: false
extensions: [%s]
pipelines:
%s:
receivers: [%v]
processors: [%s]
exporters: [%v]
exporters: [%s]
`

return fmt.Sprintf(
Expand All @@ -83,11 +91,12 @@ service:
processorSection,
extensionSection,
testutil.GetAvailablePort(t),
logLevel,
extensionList,
pipelineType,
sender.ProtocolName(),
processorList,
receiver.ProtocolName(),
strings.Join(exporters, ","),
)
}

Expand Down

0 comments on commit 8974251

Please sign in to comment.