# =============================================================================
# SigNoz OTEL Collector Config - Phase O-3 實際部署版本
# =============================================================================
# 建立者: Claude Code (首席架構師)
# 日期: 2026-04-02 (台北時間)
# 部署位置: 192.168.0.188:/home/ollama/signoz/deploy/docker/otel-collector-config.yaml
#
# Phase O-3 新增內容 (與原版差異):
#   prometheus receiver 新增 scrape jobs:
#     - node-from-signoz: node-exporter (172.28.0.1:9100, monitoring_monitoring bridge gateway)
#     - kube-state-from-signoz: kube-state-metrics (192.168.0.121:30888)
#
# 注意: signoz-otel-collector 需加入 monitoring_monitoring Docker network:
#   docker network connect monitoring_monitoring signoz-otel-collector
#
# 原方案 remote_write 已廢棄: SigNoz OTEL Collector 不支援 Prometheus remote_write 格式
# 原始備份: /home/ollama/signoz/deploy/docker/otel-collector-config.yaml.bak.phase-o
# =============================================================================

connectors:
  signozmeter:
    dimensions:
    - name: service.name
    - name: deployment.environment
    - name: host.name
    metrics_flush_interval: 1h
exporters:
  clickhouselogsexporter:
    dsn: tcp://clickhouse:9000/signoz_logs
    timeout: 10s
    use_new_schema: true
  clickhousetraces:
    datasource: tcp://clickhouse:9000/signoz_traces
    low_cardinal_exception_grouping: ${env:LOW_CARDINAL_EXCEPTION_GROUPING}
    use_new_schema: true
  metadataexporter:
    cache:
      provider: in_memory
    dsn: tcp://clickhouse:9000/signoz_metadata
    enabled: true
    timeout: 45s
  signozclickhousemeter:
    dsn: tcp://clickhouse:9000/signoz_meter
    sending_queue:
      enabled: false
    timeout: 45s
  signozclickhousemetrics:
    dsn: tcp://clickhouse:9000/signoz_metrics
extensions:
  health_check:
    endpoint: 0.0.0.0:13133
  pprof:
    endpoint: 0.0.0.0:1777
processors:
  batch:
    send_batch_max_size: 11000
    send_batch_size: 10000
    timeout: 10s
  batch/meter:
    send_batch_max_size: 25000
    send_batch_size: 20000
    timeout: 1s
  resourcedetection:
    detectors:
    - env
    - system
    timeout: 2s
  signozspanmetrics/delta:
    aggregation_temporality: AGGREGATION_TEMPORALITY_DELTA
    dimensions:
    - default: default
      name: service.namespace
    - default: default
      name: deployment.environment
    - name: signoz.collector.id
    - name: service.version
    - name: browser.platform
    - name: browser.mobile
    - name: k8s.cluster.name
    - name: k8s.node.name
    - name: k8s.namespace.name
    - name: host.name
    - name: host.type
    - name: container.name
    dimensions_cache_size: 100000
    enable_exp_histogram: true
    latency_histogram_buckets:
    - 100us
    - 1ms
    - 2ms
    - 6ms
    - 10ms
    - 50ms
    - 100ms
    - 250ms
    - 500ms
    - 1000ms
    - 1400ms
    - 2000ms
    - 5s
    - 10s
    - 20s
    - 40s
    - 60s
    metrics_exporter: signozclickhousemetrics
    metrics_flush_interval: 60s
receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
      http:
        endpoint: 0.0.0.0:4318
  prometheus:
    config:
      global:
        scrape_interval: 60s
      scrape_configs:
      - job_name: otel-collector
        static_configs:
        - labels:
            job_name: otel-collector
          targets:
          - localhost:8888
      - job_name: node-from-signoz
        metrics_path: /metrics
        scrape_interval: 60s
        static_configs:
        - targets:
          - 172.28.0.1:9100
      - job_name: kube-state-from-signoz
        metrics_path: /metrics
        scrape_interval: 60s
        static_configs:
        - targets:
          - 192.168.0.121:30888
service:
  extensions:
  - health_check
  - pprof
  pipelines:
    logs:
      exporters:
      - clickhouselogsexporter
      - metadataexporter
      - signozmeter
      processors:
      - batch
      receivers:
      - otlp
    metrics:
      exporters:
      - signozclickhousemetrics
      - metadataexporter
      - signozmeter
      processors:
      - batch
      receivers:
      - otlp
    metrics/meter:
      exporters:
      - signozclickhousemeter
      processors:
      - batch/meter
      receivers:
      - signozmeter
    metrics/prometheus:
      exporters:
      - signozclickhousemetrics
      - metadataexporter
      - signozmeter
      processors:
      - batch
      receivers:
      - prometheus
    traces:
      exporters:
      - clickhousetraces
      - metadataexporter
      - signozmeter
      processors:
      - signozspanmetrics/delta
      - batch
      receivers:
      - otlp
  telemetry:
    logs:
      encoding: json
