Skip to content

Commit

Permalink
Increase the buffer time to report metrics on GCP (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
james03160927 authored May 28, 2024
1 parent 1466788 commit dcd6d29
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions server/middleware/metric_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

const (
MetricTypePrefix = "custom.googleapis.com/comfy_api_frontend"
batchInterval = 30 * time.Second // Batch interval for sending metrics
batchInterval = 5 * time.Minute // Batch interval for sending metrics
)

var (
Expand Down Expand Up @@ -131,7 +131,7 @@ func sendMetrics(series []*monitoringpb.TimeSeries) {
ctx := context.Background()
client, err := monitoring.NewMetricClient(ctx)
if err != nil {
log.Error().Err(err).Msg("Failed to create metric client")
log.Ctx(ctx).Error().Err(err).Msg("Failed to create metric client")
return
}
defer client.Close()
Expand All @@ -142,7 +142,7 @@ func sendMetrics(series []*monitoringpb.TimeSeries) {
}

if err := client.CreateTimeSeries(ctx, req); err != nil {
log.Error().Err(err).Msg("Failed to create time series")
log.Ctx(ctx).Error().Err(err).Msg("Failed to create time series")
}
}

Expand Down

0 comments on commit dcd6d29

Please sign in to comment.