grafana / docker-otel-lgtm

OpenTelemetry backend in a Docker image
Apache License 2.0
320 stars 59 forks source link

Override Prometheus Configuration? #64

Closed melloware closed 5 months ago

melloware commented 5 months ago

I am trying to run LGTM but I want to add 1 extra scraper so that it scraps my MicroMeter Metrics from Quarkus. In my Standalone Prometheus Docker Compose i was doing the following

  prometheus:
    container_name: prometheus
    image: prom/prometheus
    volumes:
      - './monitoring/:/etc/prometheus/'
      - 'prometheus_data:/prometheus'
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
      - '--storage.tsdb.path=/prometheus'
      - '--web.console.libraries=/usr/share/prometheus/console_libraries'
      - '--web.console.templates=/usr/share/prometheus/consoles'
    ports:
      - '9090:9090'
    networks:
      - back-tier

and the prometheus.yml i was using...

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).
# 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: 'quarkus-micrometer'
   metrics_path: '/q/metrics'
   scrape_interval: 15s
   static_configs:
     - targets: ['host.docker.internal:8080']

How can I add this to the LGTM stack so it starts scraping my http://localhost:8080/q/metrics api like it does in standalone Docker Compose? I didn't see any easy way but maybe I am missing it?

melloware commented 5 months ago

Figured it out!

zeitlinger commented 5 months ago

I think the simpler solution would be to enable the micrometer bride

melloware commented 5 months ago

Is there a document somewhere about the Micrometer bridge?