Repository: open-telemetry/opentelemetry-go-contrib (go)

Issue:
protocol configuration for grpc is incorrect
### Description

The `otlp.protocol` configuration for exporters currently checks if the protocol matches the string `grpc/protobuf`, it should be checking for `grpc` instead to match the specification https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#configuration-options



Pull request description:
config: fix otlp exporter protocol issue
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

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bfcacfc5e..f3221b510 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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 -->
 
diff --git a/config/config.go b/config/config.go
index 7031f1cab..80d72c936 100644
--- a/config/config.go
+++ b/config/config.go
@@ -19,7 +19,7 @@ import (
 
 const (
 	protocolProtobufHTTP = "http/protobuf"
-	protocolProtobufGRPC = "grpc/protobuf"
+	protocolProtobufGRPC = "grpc"
 
 	compressionGzip = "gzip"
 	compressionNone = "none"


Test patch:
diff --git a/config/metric_test.go b/config/metric_test.go
index 3940e765b..07defc008 100644
--- a/config/metric_test.go
+++ b/config/metric_test.go
@@ -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),
@@ -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),
@@ -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{
@@ -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),
@@ -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),
@@ -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),
@@ -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),
@@ -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),
@@ -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),
@@ -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),
@@ -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),
diff --git a/config/trace_test.go b/config/trace_test.go
index b52688624..fb6e9b14c 100644
--- a/config/trace_test.go
+++ b/config/trace_test.go
@@ -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{
@@ -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),
@@ -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),
@@ -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),
@@ -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),