fix
This commit is contained in:
@@ -9,12 +9,12 @@ import (
|
||||
)
|
||||
|
||||
type EndpointMetric struct {
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
Service string `json:"service"`
|
||||
Endpoint string `json:"endpoint"`
|
||||
StatusCode int `json:"status_code"`
|
||||
ResponseTime int `json:"response_time"`
|
||||
Method string `json:"method"`
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
Service string `json:"service"`
|
||||
Endpoint string `json:"endpoint"`
|
||||
StatusCode int `json:"status_code"`
|
||||
ResponseTime int `json:"response_time"`
|
||||
Method string `json:"method"`
|
||||
}
|
||||
|
||||
func AddEndpointMetric(metric EndpointMetric) error {
|
||||
|
||||
34
app/storage/clickhouse/tables/tasks.go
Normal file
34
app/storage/clickhouse/tables/tasks.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
)
|
||||
|
||||
type TaskMetric struct {
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
Service string `json:"service"`
|
||||
Queue string `json:"queue"`
|
||||
Success bool `json:"success"`
|
||||
ExecutionTimeMs int `json:"execution_time_ms"`
|
||||
}
|
||||
|
||||
func AddTaskMetric(metric TaskMetric) error {
|
||||
batch, err := connection().PrepareBatch(context.Background(), "INSERT INTO tasks")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = batch.Append(
|
||||
metric.Timestamp,
|
||||
metric.Service,
|
||||
metric.Queue,
|
||||
metric.Success,
|
||||
metric.ExecutionTimeMs,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return batch.Send()
|
||||
}
|
||||
Reference in New Issue
Block a user