The best way to get avg from duration time from application

Hello, guys, i’m make this :

Blockquote
avg_over_time({app=“do-workflow-scale”}
| error = “”
| line_format “{{ .ts}}\t{{.duration}}” | duration > 370 | unwrap duration [5m])

Here is my log content:

Blockquote
Log labels
app do-workflow-scale
duration 366
environment Development
status Processed
tenantId 5524151a19a226aab39c24e3
tracerId 6021f4bb96b52c3550ca0ff9
Detected fields
app do-workflow-scale
level info
ts 2021-02-09T02:34:36.217Z
tsNs 1612838076217301100

I’m not shure if this is the best way to make this.

Someone can help me?