Skip to content

Commit

Permalink
move aplication of otel metrics wrapper to the executor instead in th…
Browse files Browse the repository at this point in the history
…e proxy factory to make sure will always be wrapping all other proxy middleares
  • Loading branch information
dhontecillas committed Oct 30, 2024
1 parent 1dfd0dd commit 4d5aa5e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 4 additions & 0 deletions executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ func (e *ExecutorBuilder) NewCmdExecutor(ctx context.Context) cmd.Executor {

bpf := e.BackendFactory.NewBackendFactory(ctx, logger, metricCollector)
pf := e.ProxyFactory.NewProxyFactory(logger, bpf, metricCollector)
// we move the proxy factory out of the default proxy factory to make
// sure that is always the outer middleware and that wraps any internal
// proxy layer middleware:
pf = otellura.ProxyFactory(pf)

agentPing := make(chan string, len(cfg.AsyncAgents))

Expand Down
2 changes: 0 additions & 2 deletions proxy_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package krakend
import (
"fmt"

otellura "github.com/krakend/krakend-otel/lura"
cel "github.com/krakendio/krakend-cel/v2"
jsonschema "github.com/krakendio/krakend-jsonschema/v2"
lua "github.com/krakendio/krakend-lua/v2/proxy"
Expand All @@ -24,7 +23,6 @@ func internalNewProxyFactory(logger logging.Logger, backendFactory proxy.Backend
proxyFactory = lua.ProxyFactory(logger, proxyFactory)
proxyFactory = metricCollector.ProxyFactory("pipe", proxyFactory)
proxyFactory = opencensus.ProxyFactory(proxyFactory)
proxyFactory = otellura.ProxyFactory(proxyFactory)
return proxyFactory
}

Expand Down

0 comments on commit 4d5aa5e

Please sign in to comment.