Skip to content

Commit 183bddb

Browse files
committed
feat: support http/protobuf
1 parent 400985c commit 183bddb

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

autologs/autologs.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ const (
2222
expOTLP = "otlp"
2323
expNone = "none" // no-op
2424

25-
protoHTTP = "http"
26-
protoGRPC = "grpc"
27-
defaultProto = protoGRPC
25+
protoHTTP = "http"
26+
protoHTTPProtobuf = "http/protobuf"
27+
protoGRPC = "grpc"
28+
defaultProto = protoGRPC
2829
)
2930

3031
const (
@@ -85,7 +86,7 @@ func NewLoggerProvider(ctx context.Context, options ...Option) (
8586
}
8687
lg.Debug("Using OTLP logs exporter", zap.String("protocol", proto))
8788
switch proto {
88-
case protoHTTP:
89+
case protoHTTP, protoHTTPProtobuf:
8990
exp, err := otlploghttp.New(ctx)
9091
if err != nil {
9192
return nil, nil, errors.Wrap(err, "create OTLP HTTP logs exporter")

autometer/autometer.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ const (
2929
expNone = "none" // no-op
3030
expPrometheus = "prometheus"
3131

32-
protoHTTP = "http"
33-
protoGRPC = "grpc"
34-
defaultProto = protoGRPC
32+
protoHTTP = "http"
33+
protoHTTPProtobuf = "http/protobuf"
34+
protoGRPC = "grpc"
35+
defaultProto = protoGRPC
3536
)
3637

3738
const (
@@ -118,7 +119,7 @@ func NewMeterProvider(ctx context.Context, options ...Option) (
118119
}
119120
lg.Debug("Using OTLP metrics exporter", zap.String("protocol", proto))
120121
switch proto {
121-
case protoHTTP:
122+
case protoHTTP, protoHTTPProtobuf:
122123
exp, err := otlpmetrichttp.New(ctx)
123124
if err != nil {
124125
return nil, nil, errors.Wrap(err, "create OTLP HTTP metric exporter")

autotracer/autotracer.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ const (
2424
expOTLP = "otlp"
2525
expNone = "none" // no-op
2626

27-
protoHTTP = "http"
28-
protoGRPC = "grpc"
29-
defaultProto = protoGRPC
27+
protoHTTP = "http"
28+
protoHTTPProtobuf = "http/protobuf"
29+
protoGRPC = "grpc"
30+
defaultProto = protoGRPC
3031
)
3132

3233
const (
@@ -84,7 +85,7 @@ func NewTracerProvider(ctx context.Context, options ...Option) (
8485
}
8586
lg.Debug("Using OTLP trace exporter", zap.String("protocol", proto))
8687
switch proto {
87-
case protoHTTP:
88+
case protoHTTP, protoHTTPProtobuf:
8889
exp, err := otlptracehttp.New(ctx)
8990
if err != nil {
9091
return nil, nil, errors.Wrap(err, "create OTLP HTTP trace exporter")
@@ -96,7 +97,6 @@ func NewTracerProvider(ctx context.Context, options ...Option) (
9697
return nil, nil, errors.Wrap(err, "create OTLP gRPC trace exporter")
9798
}
9899
return ret(exp)
99-
100100
default:
101101
return nil, nil, errors.Errorf("unsupported traces otlp protocol %q", proto)
102102
}

0 commit comments

Comments
 (0)