OTEL Collector Architecture

Understanding otel collector and how it works is important for us to configure and push relevant metrics over. The focus of this article is to provide a simple sraight forward configurations. There are more complex setup available, we will cover those later. 

This is an example of the OTEL architecture 

Receiver

First we have the "Receiver" - where data comes in. In this setup, data can be pushed via port 4318 (over http) and 4317 (over gRPC).

# collector-config.yaml
receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
      http:
        endpoint: 0.0.0.0:4318

Exporter 

Here we have configure our otel collector to log metric to console (debug) and prometheus on port 8888. So we are exposing a new promethus service here and any prometheus services (if configured correctly) would be able to scrap these out.

The endpoint exposed is /metrics

exporters:
  debug:
  prometheus:
    endpoint: 0.0.0.0:8888  # ← Collector EXPOSES here

And then we need to bring it together by using services. Noticed that for prometheus, we only exposes "metrics" (as prometheus is designed for metric data only)


service:
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [debug]
    metrics:
      receivers: [otlp]
      exporters: [debug, prometheus]
    logs:
      receivers: [otlp]
      exporters: [debug]


To be able to get metrics data from prometheus, we can run the following command :-

Invoke-WebRequest -Uri "http://localhost:8881/metrics" -Method GET | Select-Object -ExpandProperty Content

And if things goes well, we would have the followings outputs. 

The behaviou that I notice here is that it will it is provide you with the latest data. If you missed it in a single point in time, you missed those data. :) 





Comments

Popular posts from this blog

Windows SSH: Permissions for 'private-key' are too open

NodeJS: Error: spawn EINVAL in window for node version 20.20 and 18.20