mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-02 09:28:09 +02:00
wip: new tracing system
This commit is contained in:
parent
eb57fa7a8b
commit
e221c8af84
83 changed files with 1414 additions and 1285 deletions
|
@ -22,6 +22,7 @@ import (
|
|||
"github.com/pomerium/pomerium/pkg/grpc/databroker"
|
||||
"github.com/pomerium/pomerium/pkg/grpcutil"
|
||||
"github.com/pomerium/pomerium/pkg/health"
|
||||
oteltrace "go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
// ConfigSource provides a new Config source that decorates an underlying config with
|
||||
|
@ -35,6 +36,7 @@ type ConfigSource struct {
|
|||
updaterHash uint64
|
||||
cancel func()
|
||||
enableValidation bool
|
||||
tracerProvider oteltrace.TracerProvider
|
||||
|
||||
config.ChangeDispatcher
|
||||
}
|
||||
|
@ -50,11 +52,13 @@ type EnableConfigValidation bool
|
|||
// NewConfigSource creates a new ConfigSource.
|
||||
func NewConfigSource(
|
||||
ctx context.Context,
|
||||
tracerProvider oteltrace.TracerProvider,
|
||||
underlying config.Source,
|
||||
enableValidation EnableConfigValidation,
|
||||
listeners ...config.ChangeListener,
|
||||
) *ConfigSource {
|
||||
src := &ConfigSource{
|
||||
tracerProvider: tracerProvider,
|
||||
enableValidation: bool(enableValidation),
|
||||
dbConfigs: map[string]dbConfig{},
|
||||
outboundGRPCConnection: new(grpc.CachedOutboundGRPClientConn),
|
||||
|
@ -85,7 +89,7 @@ func (src *ConfigSource) GetConfig() *config.Config {
|
|||
type firstTime bool
|
||||
|
||||
func (src *ConfigSource) rebuild(ctx context.Context, firstTime firstTime) {
|
||||
_, span := trace.StartSpan(ctx, "databroker.config_source.rebuild")
|
||||
_, span := trace.Continue(ctx, "databroker.config_source.rebuild")
|
||||
defer span.End()
|
||||
|
||||
now := time.Now()
|
||||
|
@ -259,7 +263,7 @@ func (src *ConfigSource) runUpdater(ctx context.Context, cfg *config.Config) {
|
|||
|
||||
ctx, src.cancel = context.WithCancel(ctx)
|
||||
|
||||
cc, err := src.outboundGRPCConnection.Get(ctx, connectionOptions)
|
||||
cc, err := src.outboundGRPCConnection.Get(ctx, src.tracerProvider, connectionOptions)
|
||||
if err != nil {
|
||||
log.Ctx(ctx).Error().Err(err).Msg("databroker: failed to create gRPC connection to data broker")
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue