Skip to content
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

autoexport: OTLP exporter defaults to http/protobuf protocol instead of grpc #4100

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

- Add `NewMiddleware` function in `go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp`. (#2964)
- Add the new `go.opentelemetry.io/contrib/instrgen` package to provide auto-generated source code instrumentation. (#3068, #3108)
- The `go.opentelemetry.io/contrib/exporters/autoexport` package to provide configuration of trace exporters with useful defaults and envar support. (#2753)
- The `go.opentelemetry.io/contrib/exporters/autoexport` package to provide configuration of trace exporters with useful defaults and envar support. (#2753, #4100)

### Fixed

Expand Down
4 changes: 2 additions & 2 deletions exporters/autoexport/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ func NewSpanExporter(ctx context.Context, opts ...Option) (trace.SpanExporter, e
// environment variable.
// nil is returned if no exporter is defined for the environment variable.
func makeExporterFromEnv(ctx context.Context) (trace.SpanExporter, error) {
expType, defined := os.LookupEnv(otelTracesExportersEnvKey)
if !defined {
expType := os.Getenv(otelTracesExportersEnvKey)
if expType == "" {
return nil, nil
}
return spanExporter(ctx, expType)
Expand Down
7 changes: 4 additions & 3 deletions exporters/autoexport/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,11 @@ func spanExporter(ctx context.Context, name string) (trace.SpanExporter, error)

// buildOTLPExporter creates an OTLP exporter using the environment variable
// OTEL_EXPORTER_OTLP_PROTOCOL to determine the exporter protocol.
// Defaults to http/protobuf protocol.
func buildOTLPExporter(ctx context.Context) (trace.SpanExporter, error) {
proto := "grpc"
if protoStr, ok := os.LookupEnv(otelExporterOTLPProtoEnvKey); ok {
proto = protoStr
proto := os.Getenv(otelExporterOTLPProtoEnvKey)
if proto == "" {
proto = "http/protobuf"
}

switch proto {
Expand Down