// File: config/grafana-datasource.yaml

apiVersion: 1

datasources:
  - name: Traces
    type: tempo
    access: proxy
    url: http://tempo:3200/
    editable: true
    isDefault: false
  - name: Logs
    type: loki
    access: proxy
    url: http://loki:3100/
    editable: true
    isDefault: true
  - name: Metrics
    type: prometheus
    access: proxy
    url: http://prometheus:9090/
    editable: true
    datasources:
  # - name: ClickHouse
  #   type: grafana-clickhouse-datasource
  #   jsonData:
  #     defaultDatabase: default
  #     port: 9000
  #     server: clickhouse-server
  #     username: default
  #     tlsSkipVerify: true
  #     protocol: native
  #   editable: true


// File: config/tempo.yaml

server:
  http_listen_port: 3200

distributor:
  receivers:
    otlp:
      protocols:
        grpc:

ingester:
  trace_idle_period: 10s               # the length of time after a trace has not received spans to consider it complete and flush it
  max_block_bytes: 1_000_000           # cut the head block when it hits this size or ...
  max_block_duration: 5m               #   this much time passes

compactor:
  compaction:
    compaction_window: 1h              # blocks in this time window will be compacted together
    max_block_bytes: 100_000_000       # maximum size of compacted blocks
    block_retention: 1h
    compacted_block_retention: 10m

storage:
  trace:
    backend: local                     # backend configuration to use
    block:
      bloom_filter_false_positive: .05 # bloom filter false positive rate.  lower values create larger filters but fewer false positives
      v2_index_downsample_bytes: 1000  # number of bytes per index record
      v2_encoding: zstd                # block encoding/compression.  options: none, gzip, lz4-64k, lz4-256k, lz4-1M, lz4, snappy, zstd, s2
    wal:
      path: /tmp/tempo/wal             # where to store the wal locally
      v2_encoding: snappy              # wal encoding/compression.  options: none, gzip, lz4-64k, lz4-256k, lz4-1M, lz4, snappy, zstd, s2
    local:
      path: /tmp/tempo/blocks
    pool:
      max_workers: 100                 # worker pool determines the number of parallel requests to the object store backend
      queue_depth: 10000