1
0
Fork 0

Add exprimental flag for OTLP logs integration

This commit is contained in:
Kevin Pollet 2024-12-12 12:22:05 +01:00 committed by GitHub
parent 26738cbf93
commit d953ee69b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 63 additions and 4 deletions

View file

@ -1,6 +1,7 @@
package main
import (
"errors"
"fmt"
"io"
stdlog "log"
@ -22,6 +23,14 @@ func init() {
}
func setupLogger(staticConfiguration *static.Configuration) error {
// Validate that the experimental flag is set up at this point,
// rather than validating the static configuration before the setupLogger call.
// This ensures that validation messages are not logged using an un-configured logger.
if staticConfiguration.Log != nil && staticConfiguration.Log.OTLP != nil &&
(staticConfiguration.Experimental == nil || !staticConfiguration.Experimental.OTLPLogs) {
return errors.New("the experimental OTLPLogs feature must be enabled to use OTLP logging")
}
// configure log format
w := getLogWriter(staticConfiguration)