13 Oct 2023 04:42 PM - last edited on 16 Oct 2023 03:18 PM by Ana_Kuzmenchuk
Guys, I'm having great difficulty calculating the start and end times of my log. Does anyone know if this is really possible and if possible, give an example?
Log example:
Solved! Go to Solution.
17 Oct 2023 12:43 PM - edited 17 Oct 2023 01:16 PM
Hi @RPbiaggio ,
Do you mean calculating the difference between start and end time, so the duration?
Or do you have problems with finding the start and end time itself for dashboarding?
17 Oct 2023 12:46 PM
Sorry, yes, exactly, the duration.
17 Oct 2023 02:40 PM
Hi,
You need to know that: "All duration literals valid for the duration data type are applicable for the from: and to: parameters."
See description of the use of DQL and examples for duration calculation here:
https://www.dynatrace.com/support/help/platform/grail/dynatrace-query-language/commands#data-sources
Radek
17 Oct 2023 10:37 PM
Sorry, but I couldn't understand this documentation and/or what I actually need to adjust here in the code. I currently have this configuration in the log rule.
USING(INOUT resource.run.createddate:TIMESTAMP, resource.run.finisheddate:TIMESTAMP)
| FIELDS_ADD(DurationTeste:(resource.run.createddate - resource.run.finisheddate))
I have the value in timestamp which is the difference between the creation and finish fields, but I am not able to convert this so that it shows me the data in minutes or hours.
04 Dec 2023 01:48 PM
Was made the follow code:
| FIELDS_ADD(durationTimestamp:(TIMESTAMP(resource.job.finishtime) - TIMESTAMP(resource.job.starttime)))//
| FIELDS_ADD(segundos_d:LONG(durationTimestamp)/1000000000000000)
| FIELDS_ADD(segundos_d_resto:MODULO(segundos_d,60))
| FIELDS_ADD(minutos_d:segundos_d/60)
| FIELDS_ADD(horas_d:minutos_d/60)
| FIELDS_ADD(dias_d:horas_d/24)
| FIELDS_ADD(duracao_total_execucao_job:horas_d+"h:"+minutos_d+"m:"+segundos_d_resto+"s")
| FIELDS_ADD(Inicio:resource.job.starttime, Final:resource.job.finishtime)
| FIELDS_ADD(duracaototalpipeline:segundos_d)