Skip to content

Commit

Permalink
config: fix otlp exporter protocol issue (#6338)
Browse files Browse the repository at this point in the history
The grpc protocol configuration for the OTLP exporter was incorrectly
using the string `grpc/protobuf` to validate the configuration. This
updates the validation to `grpc` which is spec compliant. Updated the
tests as well.

Fixes #6337

---------

Signed-off-by: Alex Boten <[email protected]>
  • Loading branch information
codeboten authored Nov 18, 2024
1 parent 1fdd2f6 commit 1dcb2c0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

- Added support for providing `endpoint`, `pollingIntervalMs` and `initialSamplingRate` using environment variable `OTEL_TRACES_SAMPLER_ARG` in `go.opentelemetry.io/contrib/samples/jaegerremote`. (#6310)

### Fixed

- Fixed the value for configuring the OTLP exporter to use `grpc` instead of `grpc/protobuf` in `go.opentelemetry.io/contrib/config`. (#6338)

<!-- Released section -->
<!-- Don't change this section unless doing release -->

Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

const (
protocolProtobufHTTP = "http/protobuf"
protocolProtobufGRPC = "grpc/protobuf"
protocolProtobufGRPC = "grpc"

compressionGzip = "gzip"
compressionNone = "none"
Expand Down
22 changes: 11 additions & 11 deletions config/metric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func TestReader(t *testing.T) {
Periodic: &PeriodicMetricReader{
Exporter: PushMetricExporter{
OTLP: &OTLPMetric{
Protocol: ptr("grpc/protobuf"),
Protocol: ptr("grpc"),
Endpoint: ptr("http://localhost:4318"),
Compression: ptr("gzip"),
Timeout: ptr(1000),
Expand All @@ -202,7 +202,7 @@ func TestReader(t *testing.T) {
Periodic: &PeriodicMetricReader{
Exporter: PushMetricExporter{
OTLP: &OTLPMetric{
Protocol: ptr("grpc/protobuf"),
Protocol: ptr("grpc"),
Endpoint: ptr("http://localhost:4318/path/123"),
Compression: ptr("gzip"),
Timeout: ptr(1000),
Expand All @@ -221,7 +221,7 @@ func TestReader(t *testing.T) {
Periodic: &PeriodicMetricReader{
Exporter: PushMetricExporter{
OTLP: &OTLPMetric{
Protocol: ptr("grpc/protobuf"),
Protocol: ptr("grpc"),
Compression: ptr("gzip"),
Timeout: ptr(1000),
Headers: []NameStringValuePair{
Expand All @@ -239,7 +239,7 @@ func TestReader(t *testing.T) {
Periodic: &PeriodicMetricReader{
Exporter: PushMetricExporter{
OTLP: &OTLPMetric{
Protocol: ptr("grpc/protobuf"),
Protocol: ptr("grpc"),
Endpoint: ptr("localhost:4318"),
Compression: ptr("gzip"),
Timeout: ptr(1000),
Expand All @@ -258,7 +258,7 @@ func TestReader(t *testing.T) {
Periodic: &PeriodicMetricReader{
Exporter: PushMetricExporter{
OTLP: &OTLPMetric{
Protocol: ptr("grpc/protobuf"),
Protocol: ptr("grpc"),
Endpoint: ptr(" "),
Compression: ptr("gzip"),
Timeout: ptr(1000),
Expand All @@ -277,7 +277,7 @@ func TestReader(t *testing.T) {
Periodic: &PeriodicMetricReader{
Exporter: PushMetricExporter{
OTLP: &OTLPMetric{
Protocol: ptr("grpc/protobuf"),
Protocol: ptr("grpc"),
Endpoint: ptr("localhost:4318"),
Compression: ptr("none"),
Timeout: ptr(1000),
Expand All @@ -296,7 +296,7 @@ func TestReader(t *testing.T) {
Periodic: &PeriodicMetricReader{
Exporter: PushMetricExporter{
OTLP: &OTLPMetric{
Protocol: ptr("grpc/protobuf"),
Protocol: ptr("grpc"),
Endpoint: ptr("localhost:4318"),
Compression: ptr("none"),
Timeout: ptr(1000),
Expand All @@ -316,7 +316,7 @@ func TestReader(t *testing.T) {
Periodic: &PeriodicMetricReader{
Exporter: PushMetricExporter{
OTLP: &OTLPMetric{
Protocol: ptr("grpc/protobuf"),
Protocol: ptr("grpc"),
Endpoint: ptr("localhost:4318"),
Compression: ptr("none"),
Timeout: ptr(1000),
Expand All @@ -336,7 +336,7 @@ func TestReader(t *testing.T) {
Periodic: &PeriodicMetricReader{
Exporter: PushMetricExporter{
OTLP: &OTLPMetric{
Protocol: ptr("grpc/protobuf"),
Protocol: ptr("grpc"),
Endpoint: ptr("localhost:4318"),
Compression: ptr("none"),
Timeout: ptr(1000),
Expand All @@ -356,7 +356,7 @@ func TestReader(t *testing.T) {
Periodic: &PeriodicMetricReader{
Exporter: PushMetricExporter{
OTLP: &OTLPMetric{
Protocol: ptr("grpc/protobuf"),
Protocol: ptr("grpc"),
Endpoint: ptr("localhost:4318"),
Compression: ptr("none"),
Timeout: ptr(1000),
Expand All @@ -376,7 +376,7 @@ func TestReader(t *testing.T) {
Periodic: &PeriodicMetricReader{
Exporter: PushMetricExporter{
OTLP: &OTLPMetric{
Protocol: ptr("grpc/protobuf"),
Protocol: ptr("grpc"),
Endpoint: ptr("localhost:4318"),
Compression: ptr("invalid"),
Timeout: ptr(1000),
Expand Down
10 changes: 5 additions & 5 deletions config/trace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func TestSpanProcessor(t *testing.T) {
ScheduleDelay: ptr(0),
Exporter: SpanExporter{
OTLP: &OTLP{
Protocol: ptr("grpc/protobuf"),
Protocol: ptr("grpc"),
Compression: ptr("gzip"),
Timeout: ptr(1000),
Headers: []NameStringValuePair{
Expand All @@ -248,7 +248,7 @@ func TestSpanProcessor(t *testing.T) {
ScheduleDelay: ptr(0),
Exporter: SpanExporter{
OTLP: &OTLP{
Protocol: ptr("grpc/protobuf"),
Protocol: ptr("grpc"),
Endpoint: ptr("http://localhost:4317"),
Compression: ptr("gzip"),
Timeout: ptr(1000),
Expand All @@ -271,7 +271,7 @@ func TestSpanProcessor(t *testing.T) {
ScheduleDelay: ptr(0),
Exporter: SpanExporter{
OTLP: &OTLP{
Protocol: ptr("grpc/protobuf"),
Protocol: ptr("grpc"),
Endpoint: ptr("localhost:4317"),
Compression: ptr("gzip"),
Timeout: ptr(1000),
Expand All @@ -294,7 +294,7 @@ func TestSpanProcessor(t *testing.T) {
ScheduleDelay: ptr(0),
Exporter: SpanExporter{
OTLP: &OTLP{
Protocol: ptr("grpc/protobuf"),
Protocol: ptr("grpc"),
Endpoint: ptr(" "),
Compression: ptr("gzip"),
Timeout: ptr(1000),
Expand All @@ -317,7 +317,7 @@ func TestSpanProcessor(t *testing.T) {
ScheduleDelay: ptr(0),
Exporter: SpanExporter{
OTLP: &OTLP{
Protocol: ptr("grpc/protobuf"),
Protocol: ptr("grpc"),
Endpoint: ptr("localhost:4317"),
Compression: ptr("invalid"),
Timeout: ptr(1000),
Expand Down

0 comments on commit 1dcb2c0

Please sign in to comment.