Skip to content

Commit

Permalink
feat: Add benchmarks (#450)
Browse files Browse the repository at this point in the history
Co-authored-by: Maxence Maireaux <maxence@maireaux.fr>
  • Loading branch information
gfyrag and flemzord committed Dec 4, 2023
1 parent b7c7080 commit bccd2ef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 3 additions & 0 deletions internal/engine/command/lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"sync"
"sync/atomic"
"time"

"github.com/formancehq/stack/libs/go-libs/collectionutils"
"github.com/formancehq/stack/libs/go-libs/logging"
Expand Down Expand Up @@ -33,6 +34,7 @@ type Accounts struct {
type lockIntent struct {
accounts Accounts
acquired chan struct{}
at time.Time
}

func (intent *lockIntent) tryLock(ctx context.Context, chain *DefaultLocker) bool {
Expand Down Expand Up @@ -105,6 +107,7 @@ func (defaultLocker *DefaultLocker) Lock(ctx context.Context, accounts Accounts)
intent := &lockIntent{
accounts: accounts,
acquired: make(chan struct{}),
at: time.Now(),
}

recheck := func() {
Expand Down
3 changes: 0 additions & 3 deletions libs/otlp/otlpmetrics/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package otlpmetrics

import (
"context"
"fmt"
"time"

"github.com/formancehq/stack/libs/go-libs/logging"
Expand Down Expand Up @@ -64,11 +63,9 @@ func MetricsModule(cfg ModuleConfig) fx.Option {
otlp.LoadResource(cfg.ServiceName, cfg.ResourceAttributes),
fx.Decorate(fx.Annotate(func(mp *sdkmetric.MeterProvider) metric.MeterProvider { return mp }, fx.As(new(metric.MeterProvider)))),
fx.Provide(fx.Annotate(func(options ...sdkmetric.Option) *sdkmetric.MeterProvider {
fmt.Println("run meter provider with options", options)
return sdkmetric.NewMeterProvider(options...)
}, fx.ParamTags(metricsProviderOptionKey))),
fx.Invoke(func(lc fx.Lifecycle, metricProvider *sdkmetric.MeterProvider, options ...runtime.Option) {
fmt.Println("start meter provider")
// set global propagator to tracecontext (the default is no-op).
otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(
b3.New(), propagation.TraceContext{})) // B3 format is common and used by zipkin. Always enabled right now.
Expand Down

0 comments on commit bccd2ef

Please sign in to comment.