prometheus / prometheus

The Prometheus monitoring system and time series database.
https://prometheus.io/
Apache License 2.0
55.06k stars 9.06k forks source link

add support for http2 over tcp aka h2c #13594

Open rgl opened 7 months ago

rgl commented 7 months ago

Proposal

While trying to play with opentelemetry by running prometheus with the experimental --enable-feature=otlp-write-receiver cli argument and the following opentelemetry-collector-contrib configuration (notice the tls.insecure usage):

exporters:
  otlp/prometheus:
    # NB the API is at, e.g., http://prometheus:9090/api/v1/otlp/v1/metrics
    endpoint: prometheus:9090
    tls:
      insecure: true
  otlp/tempo:
    endpoint: tempo:4317
    tls:
      insecure: true
  loki:
    endpoint: http://loki:3100/loki/api/v1/push
    tls:
      insecure: true

opentelemetry-collector-contrib complained that it cannot connect to prometheus because prometheus does not support http2 over tcp (aka h2c). this was somewhat unexpected in the sense that while trying out new protocols it's generally easier to poke them using wireshark without the tls layer in the way, but it seems there is no way to do that in prometheus.

since the https://pkg.go.dev/golang.org/x/net/http2/h2c library already exists, can we have that option, to enable http2 over tcp? if there is no objection, I can try to create a PR for adding this.

aknuds1 commented 4 months ago

@jesusvazquez and I are looking into the implications of this :)

aknuds1 commented 4 months ago

Since I'm not super familiar with OTel Collector/opentelemetry-collector-contrib, could you link me to the reference docs for the configuration so I can check the semantics of tls.insecure in depth?