mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-03 16:59:22 +02:00
config: allow reloading of telemetry settings (#1255)
* metrics: support dynamic configuration settings * add test * trace: update configuration when settings change * config: allow logging options to be configured when settings change * envoy: allow changing log settings * fix unexpected doc change * fix tests * pick a port at random * update based on review
This commit is contained in:
parent
0d611c2a40
commit
f822c9a5d2
20 changed files with 538 additions and 266 deletions
|
@ -32,6 +32,7 @@ import (
|
|||
"github.com/pomerium/pomerium/config"
|
||||
"github.com/pomerium/pomerium/internal/log"
|
||||
"github.com/pomerium/pomerium/internal/telemetry"
|
||||
"github.com/pomerium/pomerium/internal/telemetry/trace"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -46,7 +47,6 @@ type Server struct {
|
|||
|
||||
grpcPort, httpPort string
|
||||
opts *config.Options
|
||||
logLevel string
|
||||
}
|
||||
|
||||
// NewServer creates a new server with traffic routed by envoy.
|
||||
|
@ -64,12 +64,6 @@ func NewServer(opts *config.Options, grpcPort, httpPort string) (*Server, error)
|
|||
opts: opts,
|
||||
}
|
||||
|
||||
if srv.opts.ProxyLogLevel != "" {
|
||||
srv.logLevel = srv.opts.ProxyLogLevel
|
||||
} else {
|
||||
srv.logLevel = srv.opts.LogLevel
|
||||
}
|
||||
|
||||
err = srv.writeConfig()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error writing initial envoy configuration: %w", err)
|
||||
|
@ -88,7 +82,7 @@ func (srv *Server) Run(ctx context.Context) error {
|
|||
|
||||
srv.cmd = exec.CommandContext(ctx, envoyPath,
|
||||
"-c", configFileName,
|
||||
"--log-level", srv.logLevel,
|
||||
"--log-level", "trace",
|
||||
"--log-format", "[LOG_FORMAT]%l--%n--%v",
|
||||
"--log-format-escaped",
|
||||
"--disable-hot-restart",
|
||||
|
@ -268,7 +262,7 @@ func (srv *Server) addTraceConfig(traceOpts *config.TracingOptions, bootCfg *env
|
|||
}
|
||||
|
||||
// We only support zipkin in envoy currently
|
||||
if traceOpts.Provider != config.ZipkinTracingProviderName {
|
||||
if traceOpts.Provider != trace.ZipkinTracingProviderName {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -354,6 +348,11 @@ func (srv *Server) handleLogs(rc io.ReadCloser) {
|
|||
msg = s
|
||||
}
|
||||
|
||||
// ignore empty messages
|
||||
if msg == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
log.WithLevel(lvl).
|
||||
Str("service", "envoy").
|
||||
Str("name", name).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue