tarantool / metrics

Metric collection library for Tarantool
MIT License
39 stars 24 forks source link

OTLP export plugin #462

Open DifferentialOrange opened 1 year ago

DifferentialOrange commented 1 year ago

See Notion RFC (private) for more detailed info. See implementation raw draft here.

Implementation will be stored in metrics.plugins.otlp script, similar to other export plugins. Module API has two handles.

otlp.collect() returns a Lua table with current metrics data. It performs metrics.invoke_callbacks() (similar to other plugins), iterates through registry and collects relevant values. It is expected that json.encode(otlp.collect()) is a valid OTLP JSON Mapping content. See [1] for Prometheus collectors to OpenTelemetry Instruments mapping. otlp.collect{default_only = true} collects only default Tarantool metrics, same as with metrics.collect{invoke_callbacks = true, default_only = true}.

otlp.init(opts) works the same as graphite.init by starting a background fiber which pushes OTLP JSON Mapping content obtained from otlp.collect to OpenTelemetry collector or backend with HTTP client. opts includes host, port, send_interval (same as graphite) and default_only (to be consistent with collect).

It is not expected that tarantool/metrics will support OTLP to Prometheus transformation, since one may use OpenTelemetry collectors for it.

  1. https://www.timescale.com/blog/content/images/2022/07/Figure-2.png