--- apiVersion: v1 kind: ConfigMap metadata: name: otel-collector-conf namespace: tracing labels: app: opentelemetry component: otel-collector-conf data: otel-collector-config: | receivers: otlp: protocols: grpc: http: processors: # This processor inspects spans looking for matching attributes. # Spans that DONT MATCH this will have a new attribute added named retain-span # This is then used by the tail_sampling processor to only export spans that # have the retain-span attribute. # All conditions have to match here to be excluded. attributes/filter_spans1: exclude: match_type: strict attributes: - {key: "foo", value: "bar"} actions: - key: retain-span action: insert value: "true" attributes/filter_spans2: include: match_type: regexp regexp: # cacheenabled determines whether match results are LRU cached to make subsequent matches faster. # Cache size is unlimited unless cachemaxnumentries is also specified. cacheenabled: true span_names: ["serviceA*"] actions: - key: retain-span action: update value: "false" # Any policy match will make the trace be sampled !, enable regex didnt caused nothing to match tail_sampling: decision_wait: 10s expected_new_traces_per_sec: 300 policies: [ { name: policy-retain-span, type: string_attribute, string_attribute: {key: retain-span, values: ['true']} }, { name: rate-limiting-policy, type: rate_limiting, rate_limiting: {spans_per_second: 35} }, { name: probabilistic-sampling, type: probabilistic, probabilistic: {sampling_percentage: 50} } ] # The k8sattributes in the Agent is in passthrough mode # so that it only tags with the minimal info for the # collector k8sattributes to complete k8sattributes: passthrough: true memory_limiter: check_interval: 1s limit_percentage: 50 spike_limit_percentage: 30 extensions: memory_ballast: size_in_percentage: 20 exporters: logging: loglevel: info otlp/data-prepper: endpoint: data-prepper-headless:21890 tls: insecure: true jaeger: endpoint: "http://jaeger-collector.tracing.svc.cluster.local:14250" tls: insecure: true service: pipelines: traces/1: receivers: [otlp] processors: [memory_limiter, k8sattributes, attributes/filter_spans1, attributes/filter_spans2, tail_sampling] exporters: [jaeger, otlp/data-prepper] --- apiVersion: v1 kind: Service metadata: name: otel-collector namespace: tracing labels: app: opentelemetry component: otel-collector spec: ports: - name: otlp # Default endpoint for OpenTelemetry receiver. port: 55680 protocol: TCP targetPort: 55680 - name: grpc-otlp # New endpoint for OpenTelemetry receiver. port: 4317 protocol: TCP targetPort: 4317 - name: metrics # Default endpoint for querying metrics. port: 8888 selector: component: otel-collector --- apiVersion: apps/v1 kind: Deployment metadata: name: otel-collector namespace: tracing labels: app: opentelemetry component: otel-collector spec: selector: matchLabels: app: opentelemetry component: otel-collector minReadySeconds: 5 progressDeadlineSeconds: 120 replicas: 4 #TODO - adjust this to your own requirements template: metadata: annotations: prometheus.io/scrape: "true" prometheus.io/port: "8888" prometheus.io/path: "/metrics" labels: app: opentelemetry component: otel-collector spec: containers: - command: - "/otelcontribcol" - "--log-level=debug" - "--config=/conf/otel-collector-config.yaml" image: otel/opentelemetry-collector-contrib:0.37.1 name: otel-collector resources: limits: cpu: 2 #TODO - adjust this to your own requirements memory: 4Gi #TODO - adjust this to your own requirements requests: cpu: 1 #TODO - adjust this to your own requirements memory: 2Gi #TODO - adjust this to your own requirements ports: - containerPort: 55680 # Default endpoint for OpenTelemetry receiver. - containerPort: 4317 # Default endpoint for OpenTelemetry receiver. - containerPort: 8888 # Default endpoint for querying metrics. volumeMounts: - name: otel-collector-config-vol mountPath: /conf livenessProbe: httpGet: path: / port: 13133 # Health Check extension default port. readinessProbe: httpGet: path: / port: 13133 # Health Check extension default port. volumes: - configMap: name: otel-collector-conf items: - key: otel-collector-config path: otel-collector-config.yaml name: otel-collector-config-vol ---