# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: opentelemetry.io/v1alpha1
kind: Instrumentation
metadata:
  name: trace-remote-sampling
spec:

# Default exporting OTLP to the gRPC interface of a collector.
  exporter:
    endpoint: http://otel-collector:4317

# Use w3c `traceparent` and `baggage` for propgation of distributed values.
  propagators:
    - tracecontext
    - baggage

# Use the Jaeger remote sampling config from the gateway
#
# pollingInterval determines how often clients will refresh sampling configuration.
# initialSamplingRate determines sampling in the event a client cannot connect to the
#                     the sampling service.
  sampler:
    type: jaeger_remote
    argument: "endpoint=http://otel-collector:14250,pollingIntervalMs=5000,initialSamplingRate=0.25"

# Note: Python currently supports HTTP not GRPC endpoint
  python:
    env:
      - name: OTEL_EXPORTER_OTLP_ENDPOINT
        value: http://otel-collector:4318
