Graph how long a job takes

376 views
Skip to first unread message

Nunni

unread,
Mar 26, 2023, 2:26:32 AM3/26/23
to Prometheus Users

Hello.

I need is observe how long it takes to complete the execution of a particular mssql query. The query is executed once every hour, and I want to graph that for say a period of ten days.
The query is up and running using sql_exporter and prometheus gets the results and correctly graphs it, but that’s not what I need.

I’d be grateful for any hints.
Best regards.

Nunni

unread,
Mar 26, 2023, 2:26:55 AM3/26/23
to Prometheus Users

Stuart Clark

unread,
Mar 27, 2023, 4:41:33 AM3/27/23
to Nunni, Prometheus Users
On 2023-03-24 14:01, Nunni wrote:
> Hello.
>
> I need is observe how long it takes to complete the execution of a
> particular mssql query. The query is executed once every hour, and I
> want to graph that for say a period of ten days.
> The query is up and running using sql_exporter and prometheus gets the
> results and correctly graphs it, but that’s not what I need.
>

Unfortunately it isn't clear what you are asking for. From your
description it sounds like you are graphing the data, but you also say
it isn't what you need (but don't say how or what you are hoping for).
If you could describe what you are doing, what is happening & what you
are wanting instead someone might be able to suggest something...

--
Stuart Clark

Brian Candler

unread,
Mar 27, 2023, 5:14:36 AM3/27/23
to Prometheus Users
I think the question was, "does sql_exporter include a metric for the execution time of a query"?

If it doesn't, and you're only doing a single query in the scrape job, then you could use prometheus' own scrape_duration_seconds metric as a rough proxy.

Roberto Nunnari

unread,
Mar 27, 2023, 7:33:01 AM3/27/23
to Brian Candler, Prometheus Users
Hello.

Thank you Stuart and Brian for your answer.

Unfortunately english is not my native language, and I cannot see how I could make my question more understandable. Anyways, Brian got it right. :-)

In the meantime I already found the solution:
1) on a linux box, combined crontab+bash script+python script: make the sql query and measure how long it takes
2) push this on pushgateway
3) scratch from prometheus
4) scratch from grafana

Best regards.
Roberto


--
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/51f23a79-0351-46ff-aa79-cd13f807c11en%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages