MrAlias / otel-schema

Playground to prototype and investigate configuration schema proposals for OpenTelemetry
Apache License 2.0
2 stars 7 forks source link

How to handle pull based metric exporters like prometheus #24

Closed jack-berg closed 1 year ago

jack-berg commented 1 year ago

Discussed here.

The spec allows pull based metric exporters to be implemented as "just another exporter", which needs to be paired with a metric reader, or as metric readers. This flexibility means that there's not an obvious way to configure pull based metric exporters since what is intuitive for one language ecosystem will not be so for another.

If pull based exporters are paired with a reader, you'd expect something like:

sdk:
  meter_provider:
    exporters:
      prometheus:
        port: 5555
    metric_readers:
      - name: periodic
        args:
          exporter: prometheus

This is nice because prometheus is configured in the sdk.meter_provider.exporters block with the other exporters. But its confusing because its paired with a reader (in this case periodic for lack of a better option) and it clearly does not read periodically.

But if pull based exporters are readers, you'd expect something like:

sdk:
  meter_provider:
    metric_readers:
      - name: prometheus
         args:
           port: 5555

This is nice because prometheus doesn't need to be paired with periodic reader like in the example above. But it may be confusing to see prometheus configuration in the reader configuration instead of in sdk.meter_provider.exporters with the other exporters.

A compromise will have to be made at some level.

codeboten commented 1 year ago

I think option 2 makes more sense here, otherwise it won't make sense to anyone who's configued the prometheus reader using the SDK.