# Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 # Base collector configuration: receivers, processors, and pipelines. # Exports only to the debug exporter by default. # Layer additional configs on top with --config to add exporters: # otelcol-config-full.yml adds Kafka and PostgreSQL metric receivers # otelcol-config-observability.yml adds observability exporters and OpAMP status reporting # otelcol-config-extras.yml extras/customizations (empty stub) receivers: otlp: protocols: grpc: endpoint: ${env:OTEL_COLLECTOR_HOST}:${env:OTEL_COLLECTOR_PORT_GRPC} http: endpoint: ${env:OTEL_COLLECTOR_HOST}:${env:OTEL_COLLECTOR_PORT_HTTP} cors: allowed_origins: - "http://*" - "https://*" allowed_headers: - "content-type" - "traceparent" - "baggage" http_check/frontend-proxy: targets: - endpoint: http://${env:FRONTEND_PROXY_ADDR} nginx: endpoint: http://${env:IMAGE_PROVIDER_HOST}:${env:IMAGE_PROVIDER_PORT}/status collection_interval: 10s docker_stats: endpoint: unix:///var/run/docker.sock metrics: container.blockio.io_serviced_recursive: enabled: true container.cpu.usage.system: enabled: true container.memory.hierarchical_memory_limit: enabled: true container.memory.rss: enabled: true container.network.io.usage.rx_packets: enabled: true container.network.io.usage.tx_packets: enabled: true container.uptime: enabled: true redis: endpoint: "valkey-cart:6379" username: "valkey" collection_interval: 10s postgresql: endpoint: ${POSTGRES_HOST}:${POSTGRES_PORT} username: monitoring_user password: ${env:POSTGRES_MONITORING_PASSWORD} metrics: postgresql.blks_hit: enabled: true postgresql.blks_read: enabled: true postgresql.tup_fetched: enabled: true postgresql.tup_returned: enabled: true postgresql.tup_inserted: enabled: true postgresql.tup_updated: enabled: true postgresql.tup_deleted: enabled: true postgresql.deadlocks: enabled: true tls: insecure: true # Scrape a Prometheus `/metrics` endpoint exposed by the ad service. # See: https://opentelemetry.io/docs/demo/services/ad/#bridging-non-otel-custom-metrics-prometheus-client-library prometheus/ad: config: scrape_configs: - job_name: ad scrape_interval: 10s static_configs: - targets: ["ad:${env:AD_PROMETHEUS_PORT}"] # Host metrics host_metrics: root_path: /hostfs scrapers: cpu: metrics: system.cpu.utilization: enabled: true disk: load: filesystem: exclude_mount_points: mount_points: - /dev/* - /proc/* - /sys/* - /run/k3s/containerd/* - /var/lib/docker/* - /var/lib/kubelet/* - /snap/* match_type: regexp exclude_fs_types: fs_types: - autofs - binfmt_misc - bpf - cgroup2 - configfs - debugfs - devpts - devtmpfs - fusectl - hugetlbfs - iso9660 - mqueue - nsfs - overlay - proc - procfs - pstore - rpc_pipefs - securityfs - selinuxfs - squashfs - sysfs - tracefs match_type: strict memory: metrics: system.memory.utilization: enabled: true system.memory.limit: enabled: true network: paging: metrics: system.paging.utilization: enabled: true processes: process: mute_process_exe_error: true mute_process_io_error: true mute_process_user_error: true system: exporters: debug: processors: memory_limiter: check_interval: 5s limit_percentage: 80 spike_limit_percentage: 25 resource_detection: detectors: [env, docker, system] system: hostname_sources: ["os"] resource_attributes: host.arch: enabled: true host.cpu.vendor.id: enabled: true host.cpu.family: enabled: true host.cpu.model.id: enabled: true host.cpu.model.name: enabled: true host.cpu.stepping: enabled: true host.cpu.cache.l2.size: enabled: true os.description: enabled: true filter/sanitize_profiles: error_mode: ignore profiles: profile: - 'IsMatch(resource.attributes["service.name"], "containerd-shim-.*")' transform/sanitize_logs: error_mode: ignore log_statements: - context: scope statements: # Rename flat "otelcol.signal" scope attribute to prevent mapping # conflict with the dotted "otelcol.signal.output" attribute. # Upstream Issue: https://github.com/open-telemetry/opentelemetry-collector/issues/15221 - set(attributes["otelcol_signal"], attributes["otelcol.signal"]) where attributes["otelcol.signal"] != nil and not IsMap(attributes["otelcol.signal"]) - delete_key(attributes, "otelcol.signal") where attributes["otelcol_signal"] != nil gen_ai_normalizer: sources: - name: openllmetry transform/sanitize_spans: error_mode: ignore trace_statements: - context: span statements: - set_semconv_span_name("1.43.0", "original_span_name") # Demo: redact sensitive attributes before export. Collector-side redaction is # a fallback -- prefer not collecting sensitive data in the first place. Raw # PII is only emitted by checkout/payment when the `emitRawPii` feature flag # is enabled (off by default); these processors run unconditionally as a # safety net regardless of the flag. # # transform/redact_sensitive_data does precise, per-key handling of the known # sensitive attributes (delete, hash, partial-mask). The redaction processor # below layers a broader key-name safety net for attributes transform doesn't # know about, e.g. a future demo.payment.card_pin or a stray password/secret # attribute. transform/redact_sensitive_data: error_mode: ignore trace_statements: - context: span statements: - delete_key(attributes, "demo.payment.card_cvv") where attributes["demo.payment.card_cvv"] != nil - set(attributes["user.hash"], SHA256(attributes["user.email"])) where attributes["user.email"] != nil - delete_key(attributes, "user.email") where attributes["user.email"] != nil # Keep only the last four digits, e.g. 4432-8015-6152-0454 -> ****-****-****-0454 - replace_pattern(attributes["demo.payment.card_number"], "^\\d{4}-\\d{4}-\\d{4}-", "****-****-****-") where attributes["demo.payment.card_number"] != nil # allow_all_keys avoids the fail-closed default (allow_all_keys=false drops every # attribute not in allowed_keys), which would strip attributes across this shared # gateway pipeline. blocked_key_patterns matches attribute keys rather than # values, so it can't over-redact benign numeric attributes like demo.order.id. redaction: allow_all_keys: true # Exempt by key rather than by value: the transform above already masks # this to its last 4 digits, so redaction doesn't need to depend on # matching that exact masked string. ignored_keys: - demo.payment.card_number blocked_key_patterns: - "demo\\.payment\\.card_pin" - "password" - "secret" summary: info connectors: span_metrics: service: pipelines: traces: receivers: [otlp] processors: [resource_detection, memory_limiter, transform/sanitize_spans, gen_ai_normalizer, transform/redact_sensitive_data, redaction] exporters: [debug, span_metrics] metrics: receivers: [docker_stats, http_check/frontend-proxy, host_metrics, nginx, otlp, redis, postgresql, prometheus/ad, span_metrics] processors: [resource_detection, memory_limiter] exporters: [debug] logs: receivers: [otlp] processors: [resource_detection, memory_limiter, transform/sanitize_logs] exporters: [debug] profiles: receivers: [otlp] processors: [resource_detection, filter/sanitize_profiles, memory_limiter] exporters: [debug] telemetry: metrics: readers: - periodic: exporter: otlp: protocol: http/protobuf # replace with your observability meta monitoring backend endpoint: http://${env:OTEL_COLLECTOR_HOST}:${env:OTEL_COLLECTOR_PORT_HTTP} logs: processors: - batch: exporter: otlp: protocol: http/protobuf # replace with your observability meta monitoring backend endpoint: http://${env:OTEL_COLLECTOR_HOST}:${env:OTEL_COLLECTOR_PORT_HTTP}