How to enable HTTP/2 to scrape metrics from the target(s)

48 views
Skip to first unread message

Yücel Albar

unread,
Feb 28, 2020, 8:32:43 AM2/28/20
to Prometheus Users
Hi, 

I want to use Prometheus 2.16.0  to scrape metrics from my application over HTTP/2. I work on Ubuntu 16.04.6 LTS environment and yaml config of prometheus is below:
What should I do to scrape metrics over HTTP/2 with TLS?

Thanks in advance.

------------------------------------

# my global config
global:
  scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
  - static_configs:
    - targets:
      # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  - job_name: My Service
    scrape_interval: 10s
    scheme: https
    static_configs:
      - targets: ['localhost:7002']

Julien Pivotto

unread,
Feb 28, 2020, 4:27:46 PM2/28/20
to Yücel Albar, Prometheus Users
You don't have to do anything. Prometheus is using golang's net/http
which "has transparent support for the HTTP/2 protocol when using
HTTPS".

If your target supports http/2 and you use tls, prometheus should use
http/2.

regards,

--
(o- Julien Pivotto
//\ Open-Source Consultant
V_/_ Inuits - https://www.inuits.eu
signature.asc

Yücel Albar

unread,
Feb 29, 2020, 10:40:59 AM2/29/20
to Prometheus Users
Hello,

My target supports HTTP/2 with TLS but, Prometheus is not sending Client Hello TLS start message to target after TCP connection is established. 

What's wrong with my Prometheus configuration?

Also, I attached pcap named "create.pcap" about this subject, as you can filter with "tcp.port == 7002"

Kind regards,
Yücel

29 Şubat 2020 Cumartesi 00:27:46 UTC+3 tarihinde Julien Pivotto yazdı:
create.pcap

Julien Pivotto

unread,
Feb 29, 2020, 2:41:50 PM2/29/20
to Yücel Albar, Prometheus Users
Hi, thanks for the dump.

Here you have it all:

You need to select Decode as > destination: 7002 > SSL
Then you see client hello, with supported versions up to tls 1.3.

Regards
> --
> You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/952804c1-6bf1-49d0-94c7-8399a893828b%40googlegroups.com.
TLS.png
DEC.png
DEC2.png
signature.asc

Yücel Albar

unread,
Feb 29, 2020, 3:37:38 PM2/29/20
to Prometheus Users
Sorry for my mistake. I see tls client hello packet.

I use nghttp2 server as target and saw the sentences that I attached at its tutorial: 


Nghttp2 discards the tls packet if it doesn't include alpn extension header ("Extension: application_layer_protocol_negotiation").  And I couldn't see this extension header in the packet. So, which steps should I take for this issue? Shall I open a bug?

Kind regards,
Yücel


29 Şubat 2020 Cumartesi 22:41:50 UTC+3 tarihinde Julien Pivotto yazdı:
> To unsubscribe from this group and stop receiving emails from it, send an email to promethe...@googlegroups.com.
nghttp2-tls-alpn.PNG
nghttp2-tls-alpn-2.PNG
Reply all
Reply to author
Forward
0 new messages