Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsTraceSensitiveAttributesEnabled ¶ added in v1.0.4
func IsTraceSensitiveAttributesEnabled() bool
IsTraceSensitiveAttributesEnabled returns if sensitive data traced with TraceLogger.SetSensitiveAttributes will trace the data. Defaults to false, which means that function is a noop and does nothing.
func ObjectAttribute ¶ added in v1.0.4
ObjectAttribute writes the specified value as a json encoded value.
Types ¶
type RootTraceLogger ¶
type RootTraceLogger interface { TraceLogger // Close the tracer and send data to the telemetry collector Close() }
type TraceLogger ¶
type TraceLogger interface { // StartSpan retrieves a logger from the current context and starts a new span // named after the current function. StartSpan(attrs ...attribute.KeyValue) (context.Context, TraceLogger) // StartSpanWithName retrieves a logger from the current context and starts a span with // the specified name. StartSpanWithName(ops string, attrs ...attribute.KeyValue) (context.Context, TraceLogger) // SetAttributes applies additional key/value pairs to the current trace span. SetAttributes(attrs ...attribute.KeyValue) // SetSensitiveAttributes applies attributes that contain SENSITIVE DATA. It is only enabled on debug builds of Porter with the traceSensitiveAttributes build tag set. SetSensitiveAttributes(attrs ...attribute.KeyValue) // EndSpan finishes the span and submits it to the otel endpoint. EndSpan(opts ...trace.SpanEndOption) // Debug logs a message at the debug level. Debug(msg string, attrs ...attribute.KeyValue) // Debugf formats a message and logs it at the debug level. Debugf(format string, args ...interface{}) // Info logs a message at the info level. Info(msg string, attrs ...attribute.KeyValue) // Infof formats a message and logs it at the info level. Infof(format string, args ...interface{}) // Warn logs a message at the warning level. Warn(msg string, attrs ...attribute.KeyValue) // Warnf formats a message and prints it at the warning level. Warnf(format string, args ...interface{}) // Error logs a message at the error level, when the specified error is not nil, // and marks the current span as failed. // Example: return log.Error(err) // Only log it in the function that generated the error, not when bubbling // it up the call stack. Error(err error, attrs ...attribute.KeyValue) error // Errorf logs a message at the error level and marks the current span as failed. Errorf(format string, arg ...interface{}) error // ShouldLog returns if the current log level includes the specified level. ShouldLog(level zapcore.Level) bool // IsTracingEnabled returns if the current logger is configed to send trace data. IsTracingEnabled() bool }
TraceLogger how porter emits traces and logs to any configured listeners.
func LoggerFromContext ¶
func LoggerFromContext(ctx context.Context) TraceLogger
LoggerFromContext retrieves a logger from the specified context. When the context is missing a logger/tracer, no-op implementations are provided.
func StartSpan ¶
StartSpan retrieves a logger from the current context and starts a new span named after the current function.
func StartSpanWithName ¶
func StartSpanWithName(ctx context.Context, op string, attrs ...attribute.KeyValue) (context.Context, TraceLogger)
StartSpanWithName retrieves a logger from the current context and starts a span with the specified name.
type Tracer ¶
type Tracer struct { trace.Tracer // IsNoOp indicates that this tracer is a no-op, it doesn't do anything IsNoOp bool // contains filtered or unexported fields }
Tracer wraps an open telemetry tracer connection in Porter so that its cleanup function can be moved around with it.