Skip to content

Support more samplers in the OpenTelemetry ExtensionProvider config #60500

Description

@xcq1

Describe the feature request

#50001 has added support for samplers with the OpenTelemetry tracing provider, but as far as I understand only the Dynatrace sampler was implemented. However, the Envoy docs list multiple other samplers which are simple but useful.
In my case, I would like to just use an always_on sampler to ignore any trace flags on incoming requests.

Describe alternatives you've considered

I managed to create this EnvoyFilter to apply the setting, but to do this I have to repeat config that was generated from the provider settings (otherwise grpc_service, resource_detectors, service_name are simply removed by the merge) which is less than ideal.

Example Filter YAML
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  name: gateway-public-tracing-always-on
  namespace: istio-system
spec:
  workloadSelector:
    labels:
      gateway.networking.k8s.io/gateway-name: public
  configPatches:
    - applyTo: NETWORK_FILTER
      match:
        context: GATEWAY
        listener:
          filterChain:
            filter:
              name: envoy.filters.network.http_connection_manager
      patch:
        operation: MERGE
        value:
          typed_config:
            "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
            tracing:
              provider:
                typed_config:
                  "@type": type.googleapis.com/envoy.config.trace.v3.OpenTelemetryConfig
                  grpc_service:
                    envoy_grpc:
                      authority: opentelemetry-collector.infrastructure.svc.cluster.local
                      cluster_name: outbound|4317||opentelemetry-collector.infrastructure.svc.cluster.local
                  resource_detectors:
                    - name: envoy.tracers.opentelemetry.resource_detectors.environment
                      typed_config:
                        '@type': type.googleapis.com/envoy.extensions.tracers.opentelemetry.resource_detectors.v3.EnvironmentResourceDetectorConfig
                  service_name: istio-public.istio-system
                  sampler:
                    name: envoy.tracers.opentelemetry.samplers.always_on
                    typed_config:
                      "@type": type.googleapis.com/envoy.extensions.tracers.opentelemetry.samplers.v3.AlwaysOnSamplerConfig

Affected product area (please put an X in all that apply)

[ ] Ambient
[ ] Docs
[ ] Dual Stack
[ ] Installation
[ ] Networking
[ ] Performance and Scalability
[x] Extensions and Telemetry
[ ] Security
[ ] Test and Release
[ ] User Experience
[ ] Developer Infrastructure

Affected features (please put an X in all that apply)

[ ] Multi Cluster
[ ] Virtual Machine
[ ] Multi Control Plane

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions