Skip to content

Commit

Permalink
1.17: add stopwatches for translator and envoy syncer (#10229) (#10243)
Browse files Browse the repository at this point in the history
Co-authored-by: Yuval Kohavi <[email protected]>
Co-authored-by: soloio-bulldozer[bot] <48420018+soloio-bulldozer[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 28, 2024
1 parent 1487d62 commit f371f9e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions projects/gloo/pkg/syncer/envoy_translator_syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/solo-io/solo-kit/pkg/api/v1/resources/core"
"github.com/solo-io/solo-kit/pkg/api/v2/reporter"

"github.com/solo-io/gloo/pkg/utils/statsutils"
"github.com/solo-io/gloo/pkg/utils/syncutil"
"github.com/solo-io/gloo/projects/gateway2/translator/translatorutils"
v1snap "github.com/solo-io/gloo/projects/gloo/pkg/api/v1/gloosnapshot"
Expand Down Expand Up @@ -78,6 +79,9 @@ func measureResource(ctx context.Context, resource string, length int) {
func (s *translatorSyncer) syncEnvoy(ctx context.Context, snap *v1snap.ApiSnapshot, allReports reporter.ResourceReports) {
ctx, span := trace.StartSpan(ctx, "gloo.syncer.Sync")
defer span.End()
stopwatch := statsutils.NewTranslatorStopWatch("EnvoySyncer")
stopwatch.Start()
defer stopwatch.Stop(ctx)

s.snapshotHistory.SetApiSnapshot(snap)
s.latestSnap = snap
Expand Down
4 changes: 4 additions & 0 deletions projects/gloo/pkg/translator/translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"sync"

"github.com/solo-io/gloo/pkg/utils/api_conversion"
"github.com/solo-io/gloo/pkg/utils/statsutils"

envoy_config_cluster_v3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3"
envoy_config_endpoint_v3 "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3"
Expand Down Expand Up @@ -84,6 +85,9 @@ func (t *translatorInstance) Translate(
defer t.lock.Unlock()
ctx, span := trace.StartSpan(params.Ctx, "gloo.translator.Translate")
defer span.End()
stopwatch := statsutils.NewTranslatorStopWatch("EdgeSnapshotTranslator")
stopwatch.Start()
defer stopwatch.Stop(ctx)
params.Ctx = contextutils.WithLogger(ctx, "translator")

// re-initialize plugins on each loop, this is done for 2 reasons:
Expand Down

0 comments on commit f371f9e

Please sign in to comment.