Documentation
¶
Index ¶
- Constants
- Variables
- func AuditLogEnd(id uint64, err error)
- func AuditLogStart(id uint64, cmd, client, user string, keysAndValues ...interface{})
- func ChildSpan(ctx context.Context, lvl uint64, operationName string) (opentracing.Span, context.Context)
- func ClearDebugLevel(lvl uint64)
- func ClearDebugLevelEnum(val DebugLevel)
- func ClearDebugLevelStrs(list string)
- func ClearDebugLevels(vals []DebugLevel)
- func ContextWithSpan(ctx context.Context, span opentracing.Span) context.Context
- func DebugLog(lvl uint64, msg string, keysAndValues ...interface{})deprecated
- func DebugSLog(slog *zap.SugaredLogger, lvl uint64, msg string, keysAndValues ...interface{})
- func EnumDecodeHook(from, to reflect.Type, data interface{}) (interface{}, error)
- func FatalLog(msg string, keysAndValues ...interface{})
- func FinishTracer()
- func ForceLogSpan(span opentracing.Span)
- func GetDebugLevel() uint64
- func GetDebugLevelStrs() string
- func GetEnumParseHelp(t reflect.Type) (string, string, bool)
- func GetLineno(skip int) string
- func GetTags(span opentracing.Span) map[string]interface{}
- func IgnoreSpanTag(tag string) bool
- func InfoLog(msg string, keysAndValues ...interface{})
- func InitTracer(tlsConfig *tls.Config)
- func IsShow(cmd string) bool
- func NewReporter(serviceName string, tlsConfig *tls.Config, rc *config.ReporterConfig, ...) (jaeger.Reporter, io.Closer)
- func NewSpanFromGrpc(ctx context.Context, lvl uint64, spanName string) opentracing.Span
- func NewSpanFromString(lvl uint64, val, spanName string, opts ...opentracing.StartSpanOption) opentracing.Span
- func NoLogSpan(span opentracing.Span)
- func NoTracingSpan() opentracing.Span
- func SetContextTags(ctx context.Context, tags map[string]string)
- func SetDebugLevel(lvl uint64)
- func SetDebugLevelEnum(val DebugLevel)
- func SetDebugLevelStrs(list string)
- func SetDebugLevels(vals []DebugLevel)
- func SetTags(span opentracing.Span, tags map[string]string)
- func SetupLoggers(logFile string)
- func SpanFromContext(ctx context.Context) opentracing.Span
- func SpanLog(ctx context.Context, lvl uint64, msg string, keysAndValues ...interface{})
- func SpanToString(ctx context.Context) string
- func SpanTraceID(ctx context.Context) string
- func StartSpan(lvl uint64, operationName string, opts ...opentracing.StartSpanOption) opentracing.Span
- func StartTestSpan(ctx context.Context, opts ...opentracing.StartSpanOption) context.Context
- func StreamClientTraceGrpc(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, ...) (grpc.ClientStream, error)
- func UnaryClientTraceGrpc(ctx context.Context, method string, req, resp interface{}, cc *grpc.ClientConn, ...) error
- func Unsuppress(ospan opentracing.Span)
- func WarnLog(msg string, keysAndValues ...interface{})
- type DebugLevel
- func (DebugLevel) EnumDescriptor() ([]byte, []int)
- func (e DebugLevel) MarshalJSON() ([]byte, error)
- func (e DebugLevel) MarshalYAML() (interface{}, error)
- func (x DebugLevel) String() string
- func (e *DebugLevel) UnmarshalJSON(b []byte) error
- func (e *DebugLevel) UnmarshalYAML(unmarshal func(interface{}) error) error
- type FieldMap
- type MatchOpt
- type MatchOptions
- type ReporterCloser
- type Span
- type SpanCarrier
- type SpanConfig
- type SpanLineno
- type TraceData
- type WithHasLogs
- type WithNoLogStartFinish
- type WithNoTracing
- type WithSuppress
- type WithSuppressWithoutLogs
Constants ¶
const ( DebugLevelEtcd uint64 = 1 << 0 DebugLevelApi uint64 = 1 << 1 DebugLevelNotify uint64 = 1 << 2 DebugLevelDmedb uint64 = 1 << 3 DebugLevelDmereq uint64 = 1 << 4 DebugLevelLocapi uint64 = 1 << 5 DebugLevelInfra uint64 = 1 << 6 DebugLevelMetrics uint64 = 1 << 7 DebugLevelUpgrade uint64 = 1 << 8 DebugLevelInfo uint64 = 1 << 9 DebugLevelSampled uint64 = 1 << 10 DebugLevelEvents uint64 = 1 << 11 DebugLevelFedapi uint64 = 1 << 12 )
Variables ¶
var DebugLevelStrings = []string{
"etcd",
"api",
"notify",
"dmedb",
"dmereq",
"locapi",
"infra",
"metrics",
"upgrade",
"info",
"sampled",
"events",
"fedapi",
}
var DebugLevel_CamelName = map[int32]string{
0: "Etcd",
1: "Api",
2: "Notify",
3: "Dmedb",
4: "Dmereq",
5: "Locapi",
6: "Infra",
7: "Metrics",
8: "Upgrade",
9: "Info",
10: "Sampled",
11: "Events",
12: "Fedapi",
}
var DebugLevel_CamelValue = map[string]int32{
"Etcd": 0,
"Api": 1,
"Notify": 2,
"Dmedb": 3,
"Dmereq": 4,
"Locapi": 5,
"Infra": 6,
"Metrics": 7,
"Upgrade": 8,
"Info": 9,
"Sampled": 10,
"Events": 11,
"Fedapi": 12,
}
var DebugLevel_name = map[int32]string{
0: "etcd",
1: "api",
2: "notify",
3: "dmedb",
4: "dmereq",
5: "locapi",
6: "infra",
7: "metrics",
8: "upgrade",
9: "info",
10: "sampled",
11: "events",
12: "fedapi",
}
var DebugLevel_value = map[string]int32{
"etcd": 0,
"api": 1,
"notify": 2,
"dmedb": 3,
"dmereq": 4,
"locapi": 5,
"infra": 6,
"metrics": 7,
"upgrade": 8,
"info": 9,
"sampled": 10,
"events": 11,
"fedapi": 12,
}
var IgnoreLvl uint64 = 99999
var JaegerUnitTest bool
var ReporterMetrics *metricstest.Backend
var SamplingEnabled = true
var ShowMethodNames = map[string]struct{}{}
var SpanServiceName string
Functions ¶
func AuditLogEnd ¶
func AuditLogStart ¶
func ClearDebugLevel ¶
func ClearDebugLevel(lvl uint64)
func ClearDebugLevelEnum ¶
func ClearDebugLevelEnum(val DebugLevel)
func ClearDebugLevelStrs ¶
func ClearDebugLevelStrs(list string)
func ClearDebugLevels ¶
func ClearDebugLevels(vals []DebugLevel)
func ContextWithSpan ¶
func DebugSLog ¶
func DebugSLog(slog *zap.SugaredLogger, lvl uint64, msg string, keysAndValues ...interface{})
func EnumDecodeHook ¶
DecodeHook for use with the mapstructure package. Allows decoding to handle protobuf enums that are represented as strings.
func FinishTracer ¶
func FinishTracer()
func ForceLogSpan ¶
func ForceLogSpan(span opentracing.Span)
func GetDebugLevel ¶
func GetDebugLevel() uint64
func GetDebugLevelStrs ¶
func GetDebugLevelStrs() string
func GetEnumParseHelp ¶
GetEnumParseHelp gets end-user specific messages for enum parse errors. It returns the enum type name, a help message with valid values, and a bool that indicates if a type was matched.
func GetTags ¶
func GetTags(span opentracing.Span) map[string]interface{}
func IgnoreSpanTag ¶
func InitTracer ¶
InitTracer configures the Jaeger OpenTracing client to log traces. Set JAEGER_ENDPOINT to http://<jaegerhost>:14268/api/traces to specify the Jaeger server.
func NewReporter ¶
func NewReporter(serviceName string, tlsConfig *tls.Config, rc *config.ReporterConfig, logger jaeger.Logger) (jaeger.Reporter, io.Closer)
Adapted from config.NewReporter, in order to be able to pass in TLS config to http transport. If the jaeger client code could expose transport (or tls.Config) in their Configuration, then we could avoid this duplication of NewReporter.
func NewSpanFromGrpc ¶
NewSpanFromGrpc is used on server-side in controller/audit.go to extract span
func NewSpanFromString ¶
func NewSpanFromString(lvl uint64, val, spanName string, opts ...opentracing.StartSpanOption) opentracing.Span
func NoLogSpan ¶
func NoLogSpan(span opentracing.Span)
func NoTracingSpan ¶
func NoTracingSpan() opentracing.Span
This span only logs to disk, and does not actually do any tracing. It is primarily for use during init for logging to disk before Jaeger is initialized, or for unit tests.
func SetDebugLevel ¶
func SetDebugLevel(lvl uint64)
func SetDebugLevelEnum ¶
func SetDebugLevelEnum(val DebugLevel)
func SetDebugLevelStrs ¶
func SetDebugLevelStrs(list string)
func SetDebugLevels ¶
func SetDebugLevels(vals []DebugLevel)
func SetupLoggers ¶
func SetupLoggers(logFile string)
SetupLoggers allows for overriding default loggers, primarily for e2e tests. Must be called before InitTracer().
func SpanFromContext ¶
func SpanFromContext(ctx context.Context) opentracing.Span
func SpanToString ¶
func SpanTraceID ¶
func StartSpan ¶
func StartSpan(lvl uint64, operationName string, opts ...opentracing.StartSpanOption) opentracing.Span
func StartTestSpan ¶
func StartTestSpan(ctx context.Context, opts ...opentracing.StartSpanOption) context.Context
Convenience function for test routines. Does not require InitTracer().
func StreamClientTraceGrpc ¶
func StreamClientTraceGrpc(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error)
func UnaryClientTraceGrpc ¶
func UnaryClientTraceGrpc(ctx context.Context, method string, req, resp interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error
func Unsuppress ¶
func Unsuppress(ospan opentracing.Span)
Types ¶
type DebugLevel ¶
type DebugLevel int32
const ( DebugLevel_etcd DebugLevel = 0 DebugLevel_api DebugLevel = 1 DebugLevel_notify DebugLevel = 2 DebugLevel_dmedb DebugLevel = 3 DebugLevel_dmereq DebugLevel = 4 DebugLevel_locapi DebugLevel = 5 DebugLevel_infra DebugLevel = 6 DebugLevel_metrics DebugLevel = 7 DebugLevel_upgrade DebugLevel = 8 DebugLevel_info DebugLevel = 9 DebugLevel_sampled DebugLevel = 10 DebugLevel_events DebugLevel = 11 DebugLevel_fedapi DebugLevel = 12 )
func DebugLevels ¶
func DebugLevels() []DebugLevel
func ParseDebugLevel ¶
func ParseDebugLevel(data interface{}) (DebugLevel, error)
func (DebugLevel) EnumDescriptor ¶
func (DebugLevel) EnumDescriptor() ([]byte, []int)
func (DebugLevel) MarshalJSON ¶
func (e DebugLevel) MarshalJSON() ([]byte, error)
func (DebugLevel) MarshalYAML ¶
func (e DebugLevel) MarshalYAML() (interface{}, error)
func (DebugLevel) String ¶
func (x DebugLevel) String() string
func (*DebugLevel) UnmarshalJSON ¶
func (e *DebugLevel) UnmarshalJSON(b []byte) error
custom JSON encoding/decoding
func (*DebugLevel) UnmarshalYAML ¶
func (e *DebugLevel) UnmarshalYAML(unmarshal func(interface{}) error) error
type FieldMap ¶
type FieldMap struct {
// contains filtered or unexported fields
}
func MakeFieldMap ¶
func NewFieldMap ¶
func (*FieldMap) Has ¶
Has checks if the key is set. Note that setting a parent key implies that all child keys are also set.
func (*FieldMap) HasOrHasChild ¶
HasOrHasChild checks if the key, or any child of the key is set. Note that as with Has(), if a parent of the key is set, this returns true.
type MatchOpt ¶
type MatchOpt func(*MatchOptions)
func MatchFilter ¶
func MatchFilter() MatchOpt
func MatchIgnoreBackend ¶
func MatchIgnoreBackend() MatchOpt
func MatchSortArrayedKeys ¶
func MatchSortArrayedKeys() MatchOpt
type MatchOptions ¶
type ReporterCloser ¶
type ReporterCloser struct {
// contains filtered or unexported fields
}
func (*ReporterCloser) Close ¶
func (s *ReporterCloser) Close() error
type Span ¶
Wrap Span so we can override Finish()
func (*Span) Tracer ¶
func (s *Span) Tracer() opentracing.Tracer
type SpanCarrier ¶
type SpanCarrier struct { Data TraceData Config SpanConfig }
type SpanConfig ¶
type SpanConfig struct { Suppress bool // ignore log for show commands etc NoTracing bool // special span that only logs to disk SuppressWithoutLogs bool // ignore start, and ignore finish unless span has logs HasLogs bool NoLogStartFinish bool // don't write logs for start and finish, used when span is short and only for logging a single message }
func (*SpanConfig) ToOptions ¶
func (s *SpanConfig) ToOptions() []opentracing.StartSpanOption
type SpanLineno ¶
type SpanLineno struct {
// contains filtered or unexported fields
}
func WithSpanLineno ¶
func WithSpanLineno(lineno string) SpanLineno
func (SpanLineno) Apply ¶
func (s SpanLineno) Apply(options *opentracing.StartSpanOptions)
type TraceData ¶
TraceData is used to transport trace/span across boundaries, such as via etcd (stored on disk) or notify (cached in keys map).
func (TraceData) ForeachKey ¶
type WithHasLogs ¶
type WithHasLogs struct{}
WithHasLogs is used to propagate the hasLogs state of a span across process API calls
func (WithHasLogs) Apply ¶
func (s WithHasLogs) Apply(options *opentracing.StartSpanOptions)
type WithNoLogStartFinish ¶
type WithNoLogStartFinish struct{}
WithNoLogStartFinish suppresses the file log for Start and Finish calls, used for very short spans created just to log a single log.
func (WithNoLogStartFinish) Apply ¶
func (s WithNoLogStartFinish) Apply(options *opentracing.StartSpanOptions)
type WithNoTracing ¶
type WithNoTracing struct{}
WithNoTracing only logs to disk
func (WithNoTracing) Apply ¶
func (s WithNoTracing) Apply(options *opentracing.StartSpanOptions)
type WithSuppress ¶
type WithSuppress struct{}
WithSuppress suppresses the span (effectively disables it)
func (WithSuppress) Apply ¶
func (s WithSuppress) Apply(options *opentracing.StartSpanOptions)
type WithSuppressWithoutLogs ¶
type WithSuppressWithoutLogs struct{}
WithSuppressWithoutLogs suppresses the span unless there are logs associated with the span. Note the start and finish log messages to disk are always skipped.
func (WithSuppressWithoutLogs) Apply ¶
func (s WithSuppressWithoutLogs) Apply(options *opentracing.StartSpanOptions)