Skip to content

Commit

Permalink
Adding file, evn and yaml config providers.
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscovalentecastro committed Aug 7, 2024
1 parent a011c66 commit 55d51ed
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions service/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,18 @@ import (
"log"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/confmap"
"go.opentelemetry.io/collector/otelcol"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"

"github.com/GoogleCloudPlatform/opentelemetry-operations-collector/internal/env"
"github.com/GoogleCloudPlatform/opentelemetry-operations-collector/internal/levelchanger"
"github.com/GoogleCloudPlatform/opentelemetry-operations-collector/internal/version"

envprovider "go.opentelemetry.io/collector/confmap/provider/envprovider"
fileprovider "go.opentelemetry.io/collector/confmap/provider/fileprovider"
yamlprovider "go.opentelemetry.io/collector/confmap/provider/yamlprovider"
)

func MainContext(ctx context.Context) {
Expand All @@ -43,6 +48,15 @@ func MainContext(ctx context.Context) {
params := otelcol.CollectorSettings{
Factories: components,
BuildInfo: info,
ConfigProviderSettings: otelcol.ConfigProviderSettings{
ResolverSettings: confmap.ResolverSettings{
ProviderFactories: []confmap.ProviderFactory{
fileprovider.NewFactory(),
envprovider.NewFactory(),
yamlprovider.NewFactory(),
},
},
},
LoggingOptions: []zap.Option{
levelchanger.NewLevelChangerOption(
zapcore.ErrorLevel,
Expand Down

0 comments on commit 55d51ed

Please sign in to comment.