Open iRevive opened 1 month ago
What's your opinion on extending MetricsOps
to provide enough details so the http4s-otel4s-middleware can provide OpenTelemetry-compliant metrics?
What's your opinion on extending
MetricsOps
to provide enough details so the http4s-otel4s-middleware can provide OpenTelemetry-compliant metrics?
Strongly in favor of working towards OTEL compatibility, that's a big win these days. Thank you for your initiative (and work on otel4s)!
MetricOps2
doesn't sound too bad for 0.23, especially as it should be a "superset" of MetricOps
, so one can convert one-way, or am I missing something?
Context
OpenTelemetry spec has well-defined HTTP semantic conventions, such as the naming of the metrics, required attributes, etc. http4s existed way before OpenTelemetry was established and, moreover, the HTTP semantic conventions became stable recently.
Problems
1. Missing attributes
The
MetricsOps
interface does not provide enough request details to fill out all the necessary attributes.MetricsOps
provide itGET
,POST
http
,https
java.net.UnknownHostException
200
,404
/users/:userID?
,{controller}/{action}/{id?}
http
,spdy
1.0
,1.1
,2
,3
example.com
,10.1.2.80
80
,8080
There is a similar story with other metrics too.
2. Unnecessary metrics
For example, we have our own
http.server.abnormal_terminations
metric to track failed requests. If we populateerror.type
in thehttp.server.request.duration
metric, it's enough to identify failing requests.Questions
Should we follow the OpenTelemetry spec?
We may not be able to provide all the required attributes.
On the other hand, OpenTelemetry requires a lot of details. So the
MetricsOps
interface should be generic enough to plug any other third-party tool (e.g. Datadog, Prometheus, etc).How to deal with experimental HTTP metrics?
For example, http.server.request.body.size is valuable. However, since it's experimental, the requirements may change over time: e.g., some attributes could be renamed or become mandatory.
On the other hand, the standalone modules, such as http4s-otel4s-middleware and http4s-prometheus-metrics, provide the actual implementation.
So, the
MetricsOps
should provide enough details to fill out the metrics, and it's up to the implementation to decide whether to use a specific metric.What about the
0.23
series?These changes are breaking in many ways, and I'm unsure if we can backport them in a binary-compatible way. We can still make
MetricsOps2
andMetrics2
though.