Hi Brian,
Thanks for such clarification. This is a sample one. We want to monitor 
much time http_server_requests_seconds_count is being hit with keeping 
application="marketplace-service", 
uri="/marketplace/live/bid/{auctionId} as filter and every time a post 
request is being made it can be count as 1,2,3 and so on. We will only 
change the uri in filter rest things are same.

On Monday, 20 March 2023 at 20:05:17 UTC+5:30 Brian Candler wrote:

> Firstly, I suggest you use the PromQL query browser within the Prometheus 
> web interface to test your expressions.
>
> Secondly, I suggest you build them up in stages.  Try the inner query 
> first; when that's working as you expect then add to the query.
>
> Therefore, I suggest you try this query first:
>
>     http_server_requests_seconds_count{application="marketplace-service", 
> uri="/marketplace/live/bid/{auctionId}"}
>
> I expect it will return zero results unless the query uri is literally the 
> string "/marketplace/live/bid/{auctionId}" - because that's what you asked 
> to match.  If so, that's why the count of timeseries is zero.
>
> What I *guess* you probably want is a query like this:
>
>     http_server_requests_seconds_count{application="marketplace-service", 
> uri=~"/marketplace/live/bid/.+"}
>
> That's a regular expression pattern match, where . means "any character" 
> and + means "1 or more times".  That should return one or more results (as 
> long as there are some with uri that match).  OK so far?
>
> Then, I wonder what you mean by a "count".  If you put count(...) around 
> this expression, then it will work, but you will get a single value which 
> is the *number of timeseries*, ignoring their values.  That is, the number 
> of distinct uri's that are seen.
>
> But each of these timeseries is itself a counter.  So maybe what you want 
> is to put sum(...) around this expression, to get the total of the counts?
>
>     
> sum(http_server_requests_seconds_count{application="marketplace-service", 
> uri="/marketplace/live/bid/.+"})
>
> Only you can decide if that's what you want, because only you know what 
> you're trying to show from these metrics.
>
> I hope that helps - good luck!
>
> On Monday, 20 March 2023 at 14:07:53 UTC dikshant rai wrote:
>
>> Hi,
>> I am trying to create custom dashboard from prometheus logs but not 
>> getting as expected I am trying to count them. below is the script I am 
>> using but I am getting zero.
>>
>> count(http_server_requests_seconds_count{application="marketplace-service", 
>> uri="/marketplace/live/bid/{auctionId}"})
>>
>> Below is the 1 line log and I wanted to achieve that if uri, method and 
>> application matches, it should count as 1.
>>
>> "http_server_requests_seconds_count{application="marketplace-service",exception="None",method="GET",outcome="SUCCESS",status="200",uri="/actuator/prometheus",}
>>  
>> ""
>>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/cde90f54-5b0d-45b6-a2b4-9e8fb00b6985n%40googlegroups.com.

Reply via email to