Re: [prometheus-users] Issue while exposing Prometheus metric from Spring Boot application

2022-12-14 Thread Stuart Clark
It is a requirement that counters end with _total which is likely why it is 
being added for you. 

On 14 December 2022 17:50:32 GMT, "arnav...@gmail.com"  
wrote:
>Hi,
>
>I am exposing two counter metrics from my spring boot application. The 
>metrics are getting generated and the counters increase by 1 when the 
>requests succeed. I am facing 2 issues - 1) The name of the counter is 
>getting appended by "_total" even though I did not add that and I don't 
>want it to be added, 2) The last label ends with an open ','. I want to 
>remove this last ','. Here is my code:
>public class PrometheusUtility { 
>  private PrometheusUtility(){ } 
>
>  static CollectorRegistry registry = CollectorRegistry.defaultRegistry; 
>static final Counter counter = 
>Counter.build().name("http_request").help("help").labelNames("method","status","api",
> 
>"component").register(registry); 
>  static final Counter dsCounter = 
>Counter.build().name("http_downstream_request").help("Records the 
>downstream request count").labelNames("method","status","api", "component", 
>"downstream").register(registry); 
>
>  public static void incrementCounter(String method, String status, String 
>apiName, String component){ 
> counter.labels(method,status,apiName,component).inc(); 
> } 
>  public static void incrementDownstreamCounter(String method, String 
>status, String apiName, String component, String downstream){
> dsCounter.labels(method,status,apiName,component, downstream).inc();
> }
> }
>
>I am calling these functions from the business class:
>PrometheusUtility.incrementCounter("Post", 
>String.valueOf(HttpStatus.SC_OK), "newMail", "mx"); 
>PrometheusUtility.incrementDownstreamCounter("Post", 
>String.valueOf(HttpStatus.SC_OK), "newMail", "mx", "mwi"); 
>
>The pom.xml has this dependency added
> io.prometheus 
>simpleclient_spring_boot 0.16.0 
> 
>
>The output I am checking in the browser where my application is up and 
>running (not in Prometheus):
>http_request_total{method="Post",status="200",api="newMail",component="mx",} 
>1.0 
>http_downstream_request_total{method="Post",status="200",api="newMail",component="mx",downstream="mwi",}
> 
>1.0 
>
>Issue:
>
>   1. 
>   
>   Both metric names are getting an additional "_total" appended to it. I 
>   don't want this to be added by default. It should be same as the name I 
>   have put in the Utility class.
>   2. 
>   
>   Both metrics have an open ',' or comma at the end. Ideally this should 
>   not be there. A metric does not have an open comma at the end. Not sure why 
>   it's adding this comma. I have specified the correct number of labels at 
>   the creation time of the counter and populating the labels correctly for 
>   incrementing. Not sure where this comma is coming from.
>   
>Please let me know how I could fix these issues.
>
>-- 
>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-users+unsubscr...@googlegroups.com.
>To view this discussion on the web visit 
>https://groups.google.com/d/msgid/prometheus-users/469b7f35-d6ab-4af0-903f-d2821a5f6b60n%40googlegroups.com.

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/A356CAF0-B077-4B38-B35F-2DE1AD85006E%40Jahingo.com.


Re: [prometheus-users] russell.g...@oracle.com

2022-12-14 Thread Julius Volz
No, Prometheus is not a browser and thus does not keep any such state
between requests.

The "scrape_config" options (
https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config)
allow configuring a number of different HTTP authentication methods though.

On Wed, Dec 14, 2022 at 4:55 PM Russell Gold  wrote:

> Does Prometheus handle Set-Cookie headers from a metrics source? I'm
> seeing a case where the source I am using creates a new session on every
> request.
>
> --
> 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-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/prometheus-users/ba6c0e2e-a72b-4724-9b51-fc5735575a7cn%40googlegroups.com
> 
> .
>


-- 
Julius Volz
PromLabs - promlabs.com

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/CAObpH5y0zyXzbJwb0Ofr6o1M8LfbzQJWF1-OfoLFKRM0hK4pjA%40mail.gmail.com.


[prometheus-users] Issue while exposing Prometheus metric from Spring Boot application

2022-12-14 Thread arnav...@gmail.com
Hi,

I am exposing two counter metrics from my spring boot application. The 
metrics are getting generated and the counters increase by 1 when the 
requests succeed. I am facing 2 issues - 1) The name of the counter is 
getting appended by "_total" even though I did not add that and I don't 
want it to be added, 2) The last label ends with an open ','. I want to 
remove this last ','. Here is my code:
public class PrometheusUtility { 
  private PrometheusUtility(){ } 

  static CollectorRegistry registry = CollectorRegistry.defaultRegistry; 
static final Counter counter = 
Counter.build().name("http_request").help("help").labelNames("method","status","api",
 
"component").register(registry); 
  static final Counter dsCounter = 
Counter.build().name("http_downstream_request").help("Records the 
downstream request count").labelNames("method","status","api", "component", 
"downstream").register(registry); 

  public static void incrementCounter(String method, String status, String 
apiName, String component){ 
 counter.labels(method,status,apiName,component).inc(); 
 } 
  public static void incrementDownstreamCounter(String method, String 
status, String apiName, String component, String downstream){
 dsCounter.labels(method,status,apiName,component, downstream).inc();
 }
 }

I am calling these functions from the business class:
PrometheusUtility.incrementCounter("Post", 
String.valueOf(HttpStatus.SC_OK), "newMail", "mx"); 
PrometheusUtility.incrementDownstreamCounter("Post", 
String.valueOf(HttpStatus.SC_OK), "newMail", "mx", "mwi"); 

The pom.xml has this dependency added
 io.prometheus 
simpleclient_spring_boot 0.16.0 
 

The output I am checking in the browser where my application is up and 
running (not in Prometheus):
http_request_total{method="Post",status="200",api="newMail",component="mx",} 
1.0 
http_downstream_request_total{method="Post",status="200",api="newMail",component="mx",downstream="mwi",}
 
1.0 

Issue:

   1. 
   
   Both metric names are getting an additional "_total" appended to it. I 
   don't want this to be added by default. It should be same as the name I 
   have put in the Utility class.
   2. 
   
   Both metrics have an open ',' or comma at the end. Ideally this should 
   not be there. A metric does not have an open comma at the end. Not sure why 
   it's adding this comma. I have specified the correct number of labels at 
   the creation time of the counter and populating the labels correctly for 
   incrementing. Not sure where this comma is coming from.
   
Please let me know how I could fix these issues.

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/469b7f35-d6ab-4af0-903f-d2821a5f6b60n%40googlegroups.com.


[prometheus-users] russell.g...@oracle.com

2022-12-14 Thread Russell Gold
Does Prometheus handle Set-Cookie headers from a metrics source? I'm seeing 
a case where the source I am using creates a new session on every request.

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/ba6c0e2e-a72b-4724-9b51-fc5735575a7cn%40googlegroups.com.


Re: [prometheus-users] OAuth token refresh - how does it work?

2022-12-14 Thread Brian Candler
And just to rule out the obvious: are the clocks on the prometheus server, 
the target, and the IDP all synced with NTP?

On Wednesday, 14 December 2022 at 11:29:11 UTC Brian Candler wrote:

> > Now sometimes the monitoring gets red because the token has already 
> expired when blackbox exporter is executing the request
>
> Can you demonstrate that the problem is definitely because the token has 
> expired, not some other scraping issue?
>
> For example, can you capture the token sent to the target, decode it, and 
> show that the expiry date is in the past?  Or are you getting a specific 
> HTTP error response which says the token has expired?
>

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/0ac93b32-c143-43bf-b412-5883fcedc248n%40googlegroups.com.


Re: [prometheus-users] OAuth token refresh - how does it work?

2022-12-14 Thread Brian Candler
> Now sometimes the monitoring gets red because the token has already 
expired when blackbox exporter is executing the request

Can you demonstrate that the problem is definitely because the token has 
expired, not some other scraping issue?

For example, can you capture the token sent to the target, decode it, and 
show that the expiry date is in the past?  Or are you getting a specific 
HTTP error response which says the token has expired?

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/ba4e5c7c-a47e-4df9-8dd0-7921eb7d8dd3n%40googlegroups.com.


Re: [prometheus-users] OAuth token refresh - how does it work?

2022-12-14 Thread 'Fabian Säglitz' via Prometheus Users
Thank you for your reply.
We use the blackbox exporter for our end-to-end probing. The result of 
those probes we display in Grafana.
The Problem is that it is sometimes flaky. We probe every 15s and we have 
quite some services which we probe against.
Now sometimes the monitoring gets red because the token has already expired 
when blackbox exporter is executing the request.
How can we overcome this?

Julien Pivotto schrieb am Sonntag, 27. November 2022 um 00:27:59 UTC+1:

> On 25 Nov 07:39, 'Fabian Säglitz' via Prometheus Users wrote:
> > Hi,
> > 
> > we use the blackbox exporter to probe our services which use OAuth2 
> (client 
> > credentials flow).
> > The probing works fine but it is sometimes flaky and I could see that 
> > sometimes the response seems to be a non valid token. 
> > 
> > How does the blackbox exporter work? For each new probe will it get a 
> fresh 
> > token or is the token stored and it only gets a new one after it has 
> > expired?
> > 
> > Thank you for your support.
>
> The token should be stored and we should get a new one after expiry.
>
> We are using
> https://pkg.go.dev/golang.org/x/oau...@v0.2.0/clientcredentials 
> 
>
> ```
> TokenSource returns a TokenSource that returns t until t expires,
> automatically refreshing it as necessary using the provided context and
> the client ID and client secret.
> ```
>
> > 
> > -- 
> > 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/86e3054d-54da-45de-a599-707b248329e3n%40googlegroups.com
> .
>
>
> -- 
> Julien Pivotto
> @roidelapluie
>

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/bde5743a-6368-4797-8d2b-b3d3cb42efb8n%40googlegroups.com.