Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Prometheus Exporter exercise

Some popular applications expose metrics using their own format. In order to make those metrics readable by eg. Prometheus someone needs to add an adapter or exporter.

The OpenTelemetry Collector can be used as a sidecar to expose Prometheus metrics collected in other formats.

  • Let's use Redis as an example. Run the container locally:

    docker run --rm --name redis -d -p 127.0.0.1:6379:6379 redis
  • Read the Prometheus Exporter documentation

  • Change the configuration to use the Prometheus Exporter and expose metrics on 127.0.0.1:12345 address. Run the collector:

    otelcol-contrib --config config.yaml
  • In another console or in the web browser examin if metrics are exposed under localhost:12345/metrics

    curl localhost:12345/metrics

At this point, with help of the OpenTelemetry Collector you have metrics in the Prometheus format exposed from Redis. If you use Kubernetes you can bundle Redis and otelcol within one pod to make this setup transparent to external metrics collectors.

  • Notice that now you have two metrics endpoints exposed from otelcol. You have to make sure to use the one you intend.

  • Delete the Redis container:

    docker rm -f redis