prometheusasp.net-core-3.1prometheus-net

Prometheus Net AspNet Core not supporting http2 protocol


I am trying to configure prometheues into a .Net Core 3.1 Application. My application runs on http2 protocol and I have the below configuration in appsetting.json.

  "Kestrel": {
    "EndpointDefaults": {
      "Protocols": "Http2"
    }
  },

However, I am unable to get the service up and running in prometheus UI.(I queried "up" to check the server running status). I am getting a following message in the prometheus log.

caller=tls_config.go:191 component=web msg="TLS is disabled." http2=false

If I set the protocol as Http1AndHttp2 am getting the service up and running in prometheus. But I need the service to be up when only http2 protocol is supported.

Please also find the config that I have done in my prometheus.yml

  - job_name: "service"

    # metrics_path defaults to '/metrics'
    scheme: https
    tls_config:
      insecure_skip_verify: true    
    static_configs:
      - targets: 
        - localhost:5001

Solution

  • At the moment, Prometheus does not support HTTP/2 by default, which may be the problem. In the next release (v2.31) it will be enabled again, but for now, with the latest release (v2.30) you can set the PROMETHEUS_COMMON_ENABLE_HTTP2 environment variable to a non-blank value to enable it.