// File: config/otel-collector.yaml

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317

exporters:
  otlp:
    endpoint: tempo:4317
    tls:
      insecure: true

  debug:
    verbosity: detailed

  prometheus:
    endpoint: 0.0.0.0:8889
    namespace: router
    const_labels:
      app_name: router-api

service:
  telemetry:
    logs:
      level: DEBUG
    metrics:
      level: detailed
      address: 0.0.0.0:8888

  pipelines:
    metrics:
      receivers: [otlp]
      exporters: [prometheus]
    traces:
      receivers: [otlp]
      exporters: [otlp]


// File: config/dashboard_theme.json

{
    "settings": {
        "colors": {
            "primary": "#FF0000"
        },
        "sidebar": {
            "primary": "#FCFCFD",
            "textColor": "#525866",
            "textColorPrimary": "#1C6DEA"
        },
        "buttons": {
            "primary": {
                "backgroundColor": "#1272f9",
                "textColor": "#ffffff",
                "hoverBackgroundColor": "#0860dd"
            },
            "secondary": {
                "backgroundColor": "#f3f3f3",
                "textColor": "#626168",
                "hoverBackgroundColor": "#fcfcfd"
            }
        }
    },
    "urls": {
        "faviconUrl": "",
        "logoUrl": ""
    }
}


// File: config/prometheus.yaml

# my global config
global:
  scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
# alerting:
#   alertmanagers:
#     - static_configs:
#         - targets:
#         - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "router"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ["otel-collector:8889"]

  - job_name: "otel-collector"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ["otel-collector:8888"]

  - job_name: "vector"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ["vector:9598"]


// File: config/promtail.yaml

server:
  http_listen_port: 9080
  grpc_listen_port: 0

positions:
  filename: /tmp/positions.yaml

clients:
  - url: http://loki:3100/loki/api/v1/push

scrape_configs:
- job_name: router_file_logs
  static_configs:
  - targets:
      - localhost
    labels:
      scrape_source: file
      __path__: /var/log/router/**/*.log*
  pipeline_stages:
  - labeldrop:
  # Dropping filename since it causes extra labels (leading to unnecessary loki indexes)
    - filename

- job_name: router_console_logs
  docker_sd_configs:
  - host: "unix:///var/run/docker.sock"
    refresh_interval: 10s
    filters:
      - name: label
        values: ["logs=promtail"]
  relabel_configs:
  - source_labels: ['__meta_docker_container_name']
    regex: '/(.*)'
    target_label: 'container'
  - source_labels: ['__meta_docker_container_log_stream']
    target_label: 'log_stream'
  pipeline_stages:
  - json:
      expressions:
        log_type:
  - labels:
      log_type:
  - static_labels:
      scrape_source: console