[prometheus-users] Regex pattern matching on metric label values

2020-10-07 Thread Ketan Talreja
Hello All, 

I am new to prometheus space, and am currently using it do some poc's and 
understand its concepts. I have a use case where from the source 
application I am receiving metrics in the json string format and the source 
is a third party library. 

Below is the sample metric output from source: - 

{
"status": "success",
"data": {
"resultType": "vector",
"result": [
{
"metric": {
"__name__": "workflow_executions",
"instance": "localhost:9920",
"job": "exporter-application",
"result": "[{'_index': 'abc', '_type': 'workflow', 
'_id': '4b01fe28-3c80-4595-a1be-3861b037f9ba', '_score': 1.0, '_source': 
{'type': '512156fd-e18f-4563-981b-2a1e1d24ecdf', 'version': 2, 'startTime': 
'2020-10-01T12:20:03.629Z', 'status': 'COMPLETED', 'input': 
'{executionId=c134e4e0-62e2-4190-9d9e-755fef48faed, 
orgId=7e04226a-1a82-4844-ba36-357a35f6677e}', 'output': 
'{result={\"version\":1,\"priority\":0,\"status\":\"COMPLETED\"}}', 
'executionTime': 4284, 'failedReferenceTaskNames': '', 'priority': 0, 
'inputSize': 1115, 'outputSize': 6944, 'updateTime': 
'2020-10-01T12:20:07.913Z', 'endTime': '2020-10-01T12:20:07.913Z'}}, 
{'_index': 'abc', '_type': 'workflow', '_id': 
'28ddb129-97ea-49c3-a074-a61a739905a7', '_score': 1.0, '_source': {'type': 
'a6212938-7de8-42e9-a9c5-8b5b97b4a284', 'version': 1, 'workflowId': 
'28ddb129-97ea-49c3-a074-a61a739905a7', 'startTime': 
'2020-09-24T21:20:17.362Z', 'status': 'COMPLETED', 'input': 
'{executionId=2e81bdcb-d369-4892-84fc-4a5d33a8fb0b, 
orgId=7e04226a-1a82-4844-ba36-357a35f6677e}', 'output': '{result=success}', 
'executionTime': 3021, 'failedReferenceTaskNames': '', 'priority': 0, 
'outputSize': 16, 'inputSize': 1115, 'updateTime': 
'2020-09-24T21:20:20.383Z', 'endTime': '2020-09-24T21:20:20.383Z'}}, 
{'_index': 'xyz', '_type': 'workflow', '_id': 
'4e6c257e-04a7-4377-a072-1b8df9658f2f', '_score': 1.0, '_source': {'type': 
'4b10a1d4-47b8-419e-842c-694fbe3a9985', 'version': 1, 'workflowId': 
'4e6c257e-04a7-4377-a072-1b8df9658f2f', 'startTime': 
'2020-09-30T20:51:10.590Z', 'status': 'COMPLETED', 'input': 
'{executionId=a22c16ef-b1b2-4049-a095-5cc088275625,orgId=7e04226a-1a82-4844-ba36-357a35f6677e}',
 
'output': '{result=success}', 'executionTime': 3601, 
'failedReferenceTaskNames': '', 'priority': 0, 'inputSize': 1115, 
'outputSize': 16, 'updateTime': '2020-09-30T20:51:14.191Z', 'endTime': 
'2020-09-30T20:51:14.191Z'}}]"
},
"value": [
1602027104.962,
"1"
]
}
]
}
}

Here, I would like to read and count number of workflows with "status: 
COMPLETED" ? 

I have tried few things using promQL but no luck. e.g. 
workflow_executions{result=~"'status': 'COMPLETED'"} 
workflow_executions{result=~"result=success"}

I am using grafana for visualization, and tried above queries but didn't 
work. 

Can anyone advise or guide me where i am going wrong? 

Thanks in advance, Ketan!

-- 
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/5a964c20-86b7-4999-b0aa-85bb8fc06a6fn%40googlegroups.com.


[prometheus-users] Prometheus with Flexera licensing

2020-05-13 Thread Ketan Talreja
Hi All, 

Hope everyone is doing ok! 

Does anyone integrated Flexera 
licensing
 
manager with Prometheus? 

I am looking for information on this topic but haven't found anything 
useful yet, however, found an flexlm_exporter as available here 
https://github.com/mjtrangoni/flexlm_exporter 

 to 
support, but there is nothing concrete in terms of documentation or 
explanation about using Prometheus as metric server for monitoring 
licensing in flexera. 

Please let me know if anyone has any thoughts around this.

Thanks,
Ketan

-- 
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/6e5294d6-9880-46bf-b21a-b35a8032cef5%40googlegroups.com.


[prometheus-users] Re: Monitor Java spring boot app without instrumenting the code

2020-05-07 Thread Ketan Talreja
Also, after using @Times annotation at the method level, I am getting 
metrics consist of  of 
*http_server_requests_seconds_count{exception="None",method="GET",status="200",uri="/students",}
 
2.0* 

While I was hoping this will return tags from Http request and response as 
per the default implementation inside class DefaultWebMvcTagsProvider 

@Override
public Iterable getTags(HttpServletRequest request, HttpServletResponse 
response, Object handler,
Throwable exception) {
Tags tags = Tags.of(WebMvcTags.method(request), WebMvcTags.uri(request, 
response, this.ignoreTrailingSlash),
WebMvcTags.exception(exception), WebMvcTags.status(response), WebMvcTags.
outcome(response));
for (WebMvcTagsContributor contributor : this.contributors) {
tags = tags.and(contributor.getTags(request, response, handler, exception));
}
return tags;
} Any idea what am I missing here? Also, I have added custom class to 
override the behavior but did not work. @Bean WebMvcTagsProvider 
webMvcTagsProvider() { return new WebMvcTagsProvider() { 
@SuppressWarnings("unchecked") @Override public Iterable 
getTags(HttpServletRequest request, HttpServletResponse response, Object 
handler, Throwable exception) { return ((Map) 
request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE)) 
.entrySet() .stream() .map(entry -> new ImmutableTag(entry.getKey(), 
entry.getValue())) .collect(Collectors.toList()); } @Override public 
Iterable getLongRequestTags(HttpServletRequest request, Object 
handler) { return new ArrayList<>(); } }; } 

Any advise on what I am doing wrong? 

Appreciate your help!

Thanks,
Ketan
On Thursday, 7 May 2020 12:22:39 UTC+5:30, Ketan Talreja wrote:
>
> Hi Guys, 
>
> Hope everyone is doing well! 
>
> I have started using Prometheus to collect metrics for my application 
> which is implemented in Java spring boot 2.x framework. I have used 
> "micrometer-registry-prometheus" library but this required some annotation 
> to be done in the code and moreover customize the bean configuration. 
>
> *Monitoring use-case for my application -* 
> *1*. I have to count the number of time REST API/Endpoint has been invoked
> *2.* I have to also capture REST request Input/response Output generated 
> and scrape it to metrics server i.e. Prometheus and using this metrics I 
> have to calculate i.e. number of time the "value" is returned in the 
> response output and same for request input i.e. number of time the specific 
> "value" is passed as in the input payload. 
>
> Could you please help how can I achieve above two points using Prometheus 
> and its client-libraries? And is there a way to achieve without 
> instrumenting the app code? This will help to decouple the application 
> codebase from instrumentation.
>
> Thanks!!
> Ketan
>

-- 
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/97dcff39-d1a2-405d-b281-1fa4b7f78fcf%40googlegroups.com.


[prometheus-users] Monitor Java spring boot app without instrumenting the code

2020-05-06 Thread Ketan Talreja
Hi Guys, 

Hope everyone is doing well! 

I have started using Prometheus to collect metrics for my application which 
is implemented in Java spring boot 2.x framework. I have used 
"micrometer-registry-prometheus" library but this required some annotation 
to be done in the code and moreover customize the bean configuration. 

*Monitoring use-case for my application -* 
*1*. I have to count the number of time REST API/Endpoint has been invoked
*2.* I have to also capture REST request Input/response Output generated 
and scrape it to metrics server i.e. Prometheus and using this metrics I 
have to calculate i.e. number of time the "value" is returned in the 
response output and same for request input i.e. number of time the specific 
"value" is passed as in the input payload. 

Could you please help how can I achieve above two points using Prometheus 
and its client-libraries? And is there a way to achieve without 
instrumenting the app code? This will help to decouple the application 
codebase from instrumentation.

Thanks!!
Ketan

-- 
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/7fcc0fae-366c-457b-a0c4-6a9483f642a2%40googlegroups.com.


Re: [prometheus-users] export and capture rest endpoint output for metrics calculation

2020-05-01 Thread Ketan Talreja
Sure, thanks Julius, This is very helpful and I will try json_exporter too. 

Thank you!
Ketan

On Friday, 1 May 2020 14:59:50 UTC+5:30, Julius Volz wrote:
>
> Oh, apparently we also have a JSON exporter in prometheus-community: 
> https://github.com/prometheus-community/json_exporter
>
> On Fri, May 1, 2020 at 11:28 AM Julius Volz  > wrote:
>
>> Or for a custom JSON exporter, see 
>> https://www.robustperception.io/writing-json-exporters-in-python
>>
>> On Fri, May 1, 2020 at 11:27 AM Julius Volz > > wrote:
>>
>>> Btw., googling turned up 
>>> https://github.com/project-sunbird/prometheus-jsonpath-exporter - I 
>>> don't know this one at all, but if your REST endpoint serves JSON, it looks 
>>> like you could use this existing exporter to convert the JSON format to 
>>> Prometheus metrics via some configuration rules.
>>>
>>> On Fri, May 1, 2020 at 11:25 AM Julius Volz >> > wrote:
>>>
>>>> Yes, it sounds like you probably will need to build a custom exporter 
>>>> for that to transform your custom REST format into the Prometheus metrics 
>>>> format.
>>>>
>>>> You can see a huge list of example exporters at 
>>>> https://prometheus.io/docs/instrumenting/exporters/, and general 
>>>> guidelines for writing exporters at 
>>>> https://prometheus.io/docs/instrumenting/writing_exporters/.
>>>>
>>>> On Thu, Apr 30, 2020 at 5:04 PM Ketan Talreja >>> > wrote:
>>>>
>>>>> Hi All, 
>>>>>
>>>>> I have a use-case where I need to collect rest endpoint output metric 
>>>>> i.e. let's say the output/response of rest endpoint is some value which I 
>>>>> need to export to prometheus for calculating how many times the endpoint 
>>>>> returned the 'x' value 
>>>>>
>>>>> For example - 
>>>>> GET //users - return list of users which need to be exported 
>>>>> to prometheus for metric calculation 
>>>>>
>>>>> Question - 
>>>>>
>>>>> Does anyone know how would I capture the endpoint results values and 
>>>>> export to prometheus? Do I need to consider implementing custom exporter 
>>>>> to 
>>>>> do this job? If yes, could you help in providing some samples. 
>>>>>
>>>>> Thank you,
>>>>>
>>>>> Ketan
>>>>>
>>>>> -- 
>>>>> 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 promethe...@googlegroups.com .
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/prometheus-users/fa5a3aa6-5ec4-49d3-9058-5a8583fd183b%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/prometheus-users/fa5a3aa6-5ec4-49d3-9058-5a8583fd183b%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>

-- 
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/ccd50f38-090d-43aa-ba04-b69361f9e084%40googlegroups.com.


[prometheus-users] export and capture rest endpoint output for metrics calculation

2020-04-30 Thread Ketan Talreja
Hi All, 

I have a use-case where I need to collect rest endpoint output metric i.e. 
let's say the output/response of rest endpoint is some value which I need 
to export to prometheus for calculating how many times the endpoint 
returned the 'x' value 

For example - 
GET //users - return list of users which need to be exported to 
prometheus for metric calculation 

Question - 

Does anyone know how would I capture the endpoint results values and export 
to prometheus? Do I need to consider implementing custom exporter to do 
this job? If yes, could you help in providing some samples. 

Thank you,

Ketan

-- 
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/fa5a3aa6-5ec4-49d3-9058-5a8583fd183b%40googlegroups.com.