cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Calculate the TIMESTAMP duration

RPbiaggio
Helper

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:

RPbiaggio_0-1697211685128.png

 

5 REPLIES 5

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?

A Dynatrace Professional nerd working for Conclusion Xforce

Sorry, yes, exactly, the duration.

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

Have a nice day!

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.

 

RPbiaggio_0-1697578616151.png

 

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)

Featured Posts