change duration to ms instead of ns

use better naming for last interface
This commit is contained in:
Robin Olsen
2026-03-10 13:30:53 +01:00
parent 7feec35c18
commit 8945341250
2 changed files with 10 additions and 10 deletions

View File

@@ -74,8 +74,8 @@ func (s *StatisticsService) RecordTaskRun(ctx context.Context, run models.TaskRu
}
stats.EndTime = now
stats.Duration = stats.EndTime.Sub(stats.StartTime)
stats.InterfaceType = run.InterfaceType
stats.DurationMs = stats.EndTime.Sub(stats.StartTime).Milliseconds()
stats.LastInterfaceType = run.InterfaceType
stats.TaskRuns++
stats.LastTaskName = run.TaskName

View File

@@ -10,9 +10,9 @@ type Statistics struct {
ID primitive.ObjectID `bson:"_id" json:"id"`
StartTime time.Time `bson:"start_time" json:"start_time"`
EndTime time.Time `bson:"end_time" json:"end_time"`
Duration time.Duration `bson:"duration" json:"duration"`
DurationMs int64 `bson:"duration_ms" json:"duration_ms"`
InterfaceType InterfaceType `bson:"interface_type" json:"interface_type"`
LastInterfaceType InterfaceType `bson:"last_interface_type" json:"last_interface_type"`
TaskRuns int `bson:"task_runs" json:"task_runs"`
TasksCompleted int `bson:"tasks_completed" json:"tasks_completed"`
TasksFailed int `bson:"tasks_failed" json:"tasks_failed"`