Skip to content

Commit

Permalink
chore: gateway_response_time buckets
Browse files Browse the repository at this point in the history
  • Loading branch information
fracasula committed Jun 27, 2023
1 parent 6f42c97 commit 9d0cce2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 8 additions & 0 deletions runner/buckets.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package runner

var customBuckets = map[string][]float64{
"gateway.response_time": {
0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 60,
300, /* 5 mins */
},
}
8 changes: 6 additions & 2 deletions runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,15 @@ func (r *Runner) Run(ctx context.Context, args []string) int {
(!config.IsSet("WORKSPACE_NAMESPACE") || strings.Contains(config.GetString("WORKSPACE_NAMESPACE", ""), "free")) {
config.Set("statsExcludedTags", []string{"workspaceId", "sourceID", "destId"})
}
stats.Default = stats.NewStats(config.Default, logger.Default, svcMetric.Instance,
statsOptions := []stats.Option{
stats.WithServiceName(r.appType),
stats.WithServiceVersion(r.releaseInfo.Version),
stats.WithDefaultHistogramBuckets(defaultHistogramBuckets),
)
}
for histogramName, buckets := range customBuckets {
statsOptions = append(statsOptions, stats.WithHistogramBuckets(histogramName, buckets))
}
stats.Default = stats.NewStats(config.Default, logger.Default, svcMetric.Instance, statsOptions...)
if err := stats.Default.Start(ctx, rruntime.GoRoutineFactory); err != nil {
r.logger.Errorf("Failed to start stats: %v", err)
return 1
Expand Down

0 comments on commit 9d0cce2

Please sign in to comment.