Skip to content

Commit

Permalink
OTEL tracing gRPC Authority setting (#10580)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanrolds authored Jan 27, 2025
1 parent 91ba1c5 commit 376ba90
Show file tree
Hide file tree
Showing 28 changed files with 923 additions and 187 deletions.
9 changes: 9 additions & 0 deletions changelog/v1.19.0-beta5/otel-tracing-grpc-authority.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
changelog:
- type: NEW_FEATURE
description: |
Add support for setting the authority field on gRPC requests made to OTEL Collectors during tracing.
When the authority field is set, the gRPC client will use the specified value as the :authority header
when making requests to the collector. This is useful when the collector is behind a reverse proxy that
requires a specific authority to be set on incoming requests.
issueLink: https://github.com/solo-io/solo-projects/issues/7740
resolvesIssue: true
3 changes: 3 additions & 0 deletions docs/data/ProtoMap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1823,6 +1823,9 @@ apis:
solo.io.envoy.config.trace.v3.DatadogRemoteConfig:
relativepath: reference/api/github.com/solo-io/gloo/projects/gloo/api/external/envoy/config/trace/v3/datadog.proto.sk/#DatadogRemoteConfig
package: solo.io.envoy.config.trace.v3
solo.io.envoy.config.trace.v3.GrpcService:
relativepath: reference/api/github.com/solo-io/gloo/projects/gloo/api/external/envoy/config/trace/v3/opentelemetry.proto.sk/#GrpcService
package: solo.io.envoy.config.trace.v3
solo.io.envoy.config.trace.v3.OpenCensusConfig:
relativepath: reference/api/github.com/solo-io/gloo/projects/gloo/api/external/envoy/config/trace/v3/opencensus.proto.sk/#OpenCensusConfig
package: solo.io.envoy.config.trace.v3
Expand Down
15 changes: 15 additions & 0 deletions install/helm/gloo/crds/gateway.solo.io_v1_Gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,11 @@ spec:
namespace:
type: string
type: object
grpcService:
properties:
authority:
type: string
type: object
serviceName:
type: string
type: object
Expand Down Expand Up @@ -1861,6 +1866,11 @@ spec:
namespace:
type: string
type: object
grpcService:
properties:
authority:
type: string
type: object
serviceName:
type: string
type: object
Expand Down Expand Up @@ -3230,6 +3240,11 @@ spec:
namespace:
type: string
type: object
grpcService:
properties:
authority:
type: string
type: object
serviceName:
type: string
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,11 @@ spec:
namespace:
type: string
type: object
grpcService:
properties:
authority:
type: string
type: object
serviceName:
type: string
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,11 @@ spec:
namespace:
type: string
type: object
grpcService:
properties:
authority:
type: string
type: object
serviceName:
type: string
type: object
Expand Down
3 changes: 2 additions & 1 deletion pkg/utils/api_conversion/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,13 @@ func gatewayKindsMap() map[string]bool {
}

// ToEnvoyOpenTelemetryConfiguration converts a Gloo OpenTelemetryConfig to an Envoy OpenTelemetryConfig
func ToEnvoyOpenTelemetryConfiguration(clusterName, serviceName string) *envoytrace.OpenTelemetryConfig {
func ToEnvoyOpenTelemetryConfiguration(clusterName, serviceName, authority string) *envoytrace.OpenTelemetryConfig {
envoyOpenTelemetryConfig := &envoytrace.OpenTelemetryConfig{
GrpcService: &envoy_config_core_v3.GrpcService{
TargetSpecifier: &envoy_config_core_v3.GrpcService_EnvoyGrpc_{
EnvoyGrpc: &envoy_config_core_v3.GrpcService_EnvoyGrpc{
ClusterName: clusterName,
Authority: authority,
},
},
},
Expand Down
27 changes: 23 additions & 4 deletions pkg/utils/api_conversion/trace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ var _ = Describe("Trace utils", func() {
})

Context("creates the OpenTelemetryConfig", func() {
clusterName := "cluster-name"
serviceName := "service-name"
authority := "authority"

It("calling ToEnvoyOpenTelemetryConfiguration", func() {
clusterName := "cluster-name"
serviceName := "service-name"
expectedConfig := &envoytrace.OpenTelemetryConfig{
GrpcService: &envoy_config_core_v3.GrpcService{
TargetSpecifier: &envoy_config_core_v3.GrpcService_EnvoyGrpc_{
Expand All @@ -59,8 +61,25 @@ var _ = Describe("Trace utils", func() {
ServiceName: serviceName,
}

actutalConfig := ToEnvoyOpenTelemetryConfiguration(clusterName, serviceName)
Expect(actutalConfig).To(Equal(expectedConfig))
actualConfig := ToEnvoyOpenTelemetryConfiguration(clusterName, serviceName, "")
Expect(actualConfig).To(Equal(expectedConfig))
})

It("calling ToEnvoyOpenTelemetryConfiguration with authority", func() {
expectedConfig := &envoytrace.OpenTelemetryConfig{
GrpcService: &envoy_config_core_v3.GrpcService{
TargetSpecifier: &envoy_config_core_v3.GrpcService_EnvoyGrpc_{
EnvoyGrpc: &envoy_config_core_v3.GrpcService_EnvoyGrpc{
ClusterName: clusterName,
Authority: authority,
},
},
},
ServiceName: serviceName,
}

actualConfig := ToEnvoyOpenTelemetryConfiguration(clusterName, serviceName, authority)
Expect(actualConfig).To(Equal(expectedConfig))
})
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ message OpenTelemetryConfig {
// If this is not set it will be automatically set to the name of the
// listener + the namespace of the Gateway object
string service_name = 3;

// Optional. Current only gRPC is supported, but are intentionally using a oneof
// to allow for future support of HTTP. This structure matches Envoy's.
oneof service_type {
// Optional gRPC transport options
GrpcService grpc_service = 4;
}
}

message GrpcService {
// Set the authority header when calling the gRPC service.
string authority = 1;
}

option go_package = "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/config/trace/v3";
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 376ba90

Please sign in to comment.