rh-messaging / artemis-prometheus-metrics-plugin

Apache License 2.0
22 stars 20 forks source link

Response Content not in json format or plain text #32

Open juanprojas opened 2 months ago

juanprojas commented 2 months ago

Hi, i'm receiving as response in the content an array of numbers instead of a json with metrics, also i don't see header with plain text as others targets from prometheus. By the way, in the RawContent response i see the json with metrics but not in the Content header.

Do you know what can i do? or any info that help me to get a response in plain text format? thanks

StatusCode : 200 StatusDescription : OK Content : {35, 32, 72, 69...} RawContent : HTTP/1.1 200 OK Transfer-Encoding: chunked Date: Wed, 12 Jun 2024 12:56:11 GMT

                # HELP jvm_memory_used_bytes The amount of used memory
                # TYPE jvm_memory_used_bytes gauge
                jvm_memory_used_bytes{area...

Headers : {[Transfer-Encoding, chunked], [Date, Wed, 12 Jun 2024 12:56:11 GMT]} RawContentLength : 210209

Normal response from prometheus target: StatusCode : 200 StatusDescription : OK Content : # HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.

TYPE go_gc_duration_seconds summary

                go_gc_duration_seconds{quantile="0"} 0
                go_gc_duration_seconds{quantile...

RawContent : HTTP/1.1 200 OK Transfer-Encoding: chunked Content-Type: text/plain; version=0.0.4; charset=utf-8; escaping=values Date: Wed, 12 Jun 2024 16:31:31 GMT

                # HELP go_gc_duration_seconds A summary of ...

Forms : {} Headers : {[Transfer-Encoding, chunked], [Content-Type, text/plain; version=0.0.4; charset=utf-8; escaping=values], [Date, Wed, 12 Jun 2024 16:31:31 GMT]} Images : {} InputFields : {} Links : {} ParsedHtml : System.__ComObject RawContentLength : 69393

brusdev commented 2 months ago

@juanprojas what HTTP client are you using? I see plain text if I use curl:

$ curl -v http://$HOSTNAME:8161/metrics/
*   Trying 10.244.6.110...
* TCP_NODELAY set
* Connected to artemis-jvm-ss-0 (10.244.6.110) port 8161 (#0)
> GET /metrics/ HTTP/1.1
> Host: artemis-jvm-ss-0:8161
> User-Agent: curl/7.61.1
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Wed, 12 Jun 2024 16:49:30 GMT
< Transfer-Encoding: chunked
< 
# HELP artemis_connection_count Number of clients connected to this server
# TYPE artemis_connection_count gauge
artemis_connection_count{broker="amq-broker",} 0.0
# HELP jvm_buffer_memory_used_bytes An estimate of the memory that the Java virtual machine is using for this buffer pool
# TYPE jvm_buffer_memory_used_bytes gauge
jvm_buffer_memory_used_bytes{broker="amq-broker",id="mapped - 'non-volatile memory'",} 0.0
jvm_buffer_memory_used_bytes{broker="amq-broker",id="direct",} 2350897.0
jvm_buffer_memory_used_bytes{broker="amq-broker",id="mapped",} 0.0
# HELP artemis_messages_acknowledged number of messages acknowledged from this queue since it was created
# TYPE artemis_messages_acknowledged gauge
artemis_messages_acknowledged{address="$sys.mqtt.sessions",broker="amq-broker",queue="$sys.mqtt.sessions",} 0.0
artemis_messages_acknowledged{address="DLQ",broker="amq-broker",queue="DLQ",} 0.0
artemis_messages_acknowledged{address="ExpiryQueue",broker="amq-broker",queue="ExpiryQueue",} 0.0
...
juanprojas commented 2 months ago

Hi i'm using curl from windows powershell, this brings 2 headers, Content and RawContent, the Content header shows {35, 32, 72, 69...}, the RawContent is ok. Can you test it from a windows powershell?

brusdev commented 2 months ago

I have no way to run curl from a windows powershell but this issue doesn't seem related to artemis-prometheus-metrics-plugin it seems more related to the client you are using.