Documentation ¶
Overview ¶
Package klogga is a generated GoMock package.
Package klogga is a generated GoMock package.
Index ¶
- Constants
- func InitHostname()
- func RoundDur(d time.Duration) string
- func SetHostname(hn string)
- type ComponentName
- type Enricher
- type Exporter
- type ExportersSlice
- type Factory
- type LogLevel
- type MockExporter
- type MockExporterMockRecorder
- type MockTracer
- type MockTracerMockRecorder
- type NilExporterTracer
- type ObjectVal
- type Span
- func CreateErrSpanFrom(ctx context.Context, span *Span) *Span
- func CtxActiveSpan(ctx context.Context) *Span
- func Message(message string, opts ...SpanOption) *Span
- func Start(ctx1 context.Context, opts ...SpanOption) (span *Span, ctx context.Context)
- func StartFromParentID(ctx context.Context, parentSpanID SpanID, traceID TraceID) (*Span, context.Context)
- func StartLeaf(ctx context.Context, opts ...SpanOption) (span *Span)
- func (s *Span) Class() string
- func (s *Span) Component() ComponentName
- func (s *Span) DeferErr(err error) *Span
- func (s *Span) DeferErrs() error
- func (s *Span) Duration() time.Duration
- func (s *Span) EWState() string
- func (s *Span) EnrichFrom(e Enricher) *Span
- func (s *Span) Err(err error) error
- func (s *Span) ErrRecover(rec interface{}, stackBytes []byte) *Span
- func (s *Span) ErrSpan(err error) *Span
- func (s *Span) ErrVoid(err error)
- func (s *Span) ErrWrapf(err error, format string, args ...interface{}) error
- func (s *Span) Errs() error
- func (s *Span) FlushTo(trs Tracer)
- func (s *Span) GlobalTag(key string, value interface{}) *Span
- func (s *Span) HasDeferErr() bool
- func (s *Span) HasErr() bool
- func (s *Span) HasWarn() bool
- func (s *Span) Host() string
- func (s *Span) ID() SpanID
- func (s *Span) IsFinished() bool
- func (s *Span) Json() ([]byte, error)
- func (s *Span) Level(level LogLevel) *Span
- func (s *Span) Message(message string) *Span
- func (s *Span) Name() string
- func (s *Span) OverrideName(newName string) *Span
- func (s *Span) Package() string
- func (s *Span) PackageClass() string
- func (s *Span) Parent() *Span
- func (s *Span) ParentID() SpanID
- func (s *Span) SetComponent(name ComponentName)
- func (s *Span) Stack() []*Span
- func (s *Span) StartedTs() time.Time
- func (s *Span) Stop()
- func (s *Span) Stringify(endWith ...string) string
- func (s *Span) Tag(key string, value interface{}) *Span
- func (s *Span) Tags() map[string]interface{}
- func (s *Span) TraceID() TraceID
- func (s *Span) Val(key string, value interface{}) *Span
- func (s *Span) ValAsJson(key string, value string) *Span
- func (s *Span) ValAsObj(key string, value interface{}) *Span
- func (s *Span) Vals() map[string]interface{}
- func (s *Span) Warn(err error) *Span
- func (s *Span) WarnWith(err error) error
- func (s *Span) Warns() error
- type SpanID
- type SpanOption
- type SpanSlice
- type StringAsJSONVal
- type TraceID
- func (t TraceID) AsNullableUUID() *uuid.UUID
- func (t TraceID) AsUUID() uuid.UUID
- func (t TraceID) Bytes() []byte
- func (t TraceID) IsZero() bool
- func (t TraceID) MarshalJSON() ([]byte, error)
- func (t TraceID) MarshalText() ([]byte, error)
- func (t TraceID) String() string
- func (t *TraceID) UnmarshalJSON(bb []byte) error
- type Tracer
- type TracerProvider
- type WriterExporter
- type WriterTracer
Constants ¶
const SpanIDSize = 8
const TimestampLayout = "2006-01-02 15:04:05.000"
const TraceIDSize = 16
Variables ¶
This section is empty.
Functions ¶
func InitHostname ¶
func InitHostname()
InitHostname call this in your app initialization if you want to have host name set automatically on span start
func SetHostname ¶
func SetHostname(hn string)
SetHostname set custom hostname that will appear on the span from the start
Types ¶
type ComponentName ¶
type ComponentName string
func (ComponentName) String ¶
func (c ComponentName) String() string
type Exporter ¶
type Exporter interface { Write(ctx context.Context, spans []*Span) error Shutdown(ctx context.Context) error }
Exporter generic tracer interface, should not be used outside implementations to be more generic accepts batches right away
type ExportersSlice ¶
type ExportersSlice []Exporter
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory combines different exporters constructs tracers with proper names
func NewFactory ¶
func (*Factory) AddExporter ¶
AddExporter adds another exporter to the factory. All previously created tracers as well as new tracers will write to all exporters. Do not use for concurrently executing goroutines that write spans. Intended to be used in the sequential app initialization.
func (*Factory) Named ¶
func (tf *Factory) Named(componentName ComponentName) Tracer
Named creates a named tracer for specified component
type LogLevel ¶
type LogLevel int
LogLevel log levels simplify compatibility with some logging systems
type MockExporter ¶
type MockExporter struct {
// contains filtered or unexported fields
}
MockExporter is a mock of Exporter interface.
func NewMockExporter ¶
func NewMockExporter(ctrl *gomock.Controller) *MockExporter
NewMockExporter creates a new mock instance.
func (*MockExporter) EXPECT ¶
func (m *MockExporter) EXPECT() *MockExporterMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockExporterMockRecorder ¶
type MockExporterMockRecorder struct {
// contains filtered or unexported fields
}
MockExporterMockRecorder is the mock recorder for MockExporter.
func (*MockExporterMockRecorder) Shutdown ¶
func (mr *MockExporterMockRecorder) Shutdown(ctx interface{}) *gomock.Call
Shutdown indicates an expected call of Shutdown.
func (*MockExporterMockRecorder) Write ¶
func (mr *MockExporterMockRecorder) Write(ctx, spans interface{}) *gomock.Call
Write indicates an expected call of Write.
type MockTracer ¶
type MockTracer struct {
// contains filtered or unexported fields
}
MockTracer is a mock of Tracer interface.
func NewMockTracer ¶
func NewMockTracer(ctrl *gomock.Controller) *MockTracer
NewMockTracer creates a new mock instance.
func (*MockTracer) EXPECT ¶
func (m *MockTracer) EXPECT() *MockTracerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockTracerMockRecorder ¶
type MockTracerMockRecorder struct {
// contains filtered or unexported fields
}
MockTracerMockRecorder is the mock recorder for MockTracer.
func (*MockTracerMockRecorder) Finish ¶
func (mr *MockTracerMockRecorder) Finish(span interface{}) *gomock.Call
Finish indicates an expected call of Finish.
func (*MockTracerMockRecorder) Name ¶
func (mr *MockTracerMockRecorder) Name() *gomock.Call
Name indicates an expected call of Name.
type NilExporterTracer ¶
type NilExporterTracer struct{}
func (NilExporterTracer) Finish ¶
func (NilExporterTracer) Finish(*Span)
func (NilExporterTracer) Name ¶
func (NilExporterTracer) Name() ComponentName
type ObjectVal ¶
type ObjectVal struct {
// contains filtered or unexported fields
}
func ValJson ¶
ValJson Use to directly inform klogga that is value is a valid json and no conversion is needed
func ValObject ¶
func ValObject(obj interface{}) *ObjectVal
ValObject explicitly indicates that the underlying value is a nested object, to be stored in a complex field like jsonb
func (ObjectVal) MarshalJSON ¶
type Span ¶
type Span struct {
// contains filtered or unexported fields
}
Span describes a structured unit of log (tracing) with an interval Span is a (TODO) serializable and independent of the way it is exported (traced) to any storage
func CreateErrSpanFrom ¶
CreateErrSpanFrom creates span describing an error in a flat way
func CtxActiveSpan ¶
CtxActiveSpan returns current active span from context (for new spans, current span is a parent span) careful no to Write this span, parent call should do it
func Message ¶
func Message(message string, opts ...SpanOption) *Span
Message is the simplest way to start a span, in the shortest way possible it doesn't use context, and doesn't return one. It is strongly discouraged to use Message unless for testing purposes.
func Start ¶
Start preferred way to start a new span, automatically sets basic span fields like class, name, host
func StartFromParentID ¶
func StartFromParentID(ctx context.Context, parentSpanID SpanID, traceID TraceID) (*Span, context.Context)
StartFromParentID starts new span with externally defined parent span ID Deprecated: use SpanOptions
func StartLeaf ¶
func StartLeaf(ctx context.Context, opts ...SpanOption) (span *Span)
StartLeaf start new span without returning resulting context i.e. no child spans possibility
func (*Span) Component ¶
func (s *Span) Component() ComponentName
func (*Span) Duration ¶
Duration returns current duration for running span returns total duration for stopped span
func (*Span) EnrichFrom ¶
func (*Span) ErrRecover ¶
ErrRecover convenience method to be used with recover() calls
func (*Span) GlobalTag ¶
GlobalTag set the tag that is also propagated to all child spans not thread safe
func (*Span) HasDeferErr ¶
func (*Span) IsFinished ¶
func (*Span) Level ¶
Level for compatibility with some logging systems overridden by errors and warns in the Span
func (*Span) Message ¶
Message shorthand for generic Val("message", ... ) value overwrites previous message usage of specific tags and values is preferred!
func (*Span) OverrideName ¶
func (*Span) PackageClass ¶
func (*Span) SetComponent ¶
func (s *Span) SetComponent(name ComponentName)
SetComponent should be used only in custom and special cases NamedTracer should decide the component name for the span
func (*Span) Stringify ¶
Stringify full span data string to be used in text tracers deliberately ignores host field
type SpanID ¶
type SpanID [8]byte
SpanID like in OpenTelemetry
func ParseSpanID ¶
func SpanIDFromBytes ¶
func SpanIDFromBytesOrZero ¶
func SpanIDFromString ¶
func (SpanID) AsNullableBytes ¶
func (SpanID) MarshalJSON ¶
func (SpanID) MarshalText ¶
func (*SpanID) UnmarshalJSON ¶
type SpanOption ¶
type SpanOption interface {
// contains filtered or unexported methods
}
func WithDone ¶
func WithDone(ts time.Time, duration time.Duration) SpanOption
WithDone make already finished span
func WithName ¶
func WithName(name string) SpanOption
func WithPackageClass ¶
func WithPackageClass(p, c string) SpanOption
WithPackageClass overrides reflection-retrieved package and class
func WithParentSpanID ¶
func WithParentSpanID(parentSpanID SpanID) SpanOption
func WithTimestamp ¶
func WithTimestamp(ts time.Time) SpanOption
WithTimestamp make span to have started with custom timestamp to create a done span, use WithDone
func WithTraceID ¶
func WithTraceID(traceID TraceID) SpanOption
type StringAsJSONVal ¶
type StringAsJSONVal struct {
// contains filtered or unexported fields
}
func (StringAsJSONVal) MarshalJSON ¶
func (o StringAsJSONVal) MarshalJSON() ([]byte, error)
func (StringAsJSONVal) String ¶
func (o StringAsJSONVal) String() string
type TraceID ¶
func NewTraceID ¶
func NewTraceID() TraceID
func TraceIDFromBytes ¶
func TraceIDFromBytesOrZero ¶
func TraceIDFromString ¶
func (TraceID) AsNullableUUID ¶
func (TraceID) MarshalJSON ¶
func (TraceID) MarshalText ¶
func (*TraceID) UnmarshalJSON ¶
type Tracer ¶
type Tracer interface { Finish(span *Span) Name() ComponentName }
type TracerProvider ¶
type TracerProvider interface { NamedPkg() Tracer Named(componentName ComponentName) Tracer }
TracerProvider use to allow components/adapters to have name overrides implemented by Factory
type WriterExporter ¶
type WriterExporter struct {
// contains filtered or unexported fields
}
func NewWriterExporter ¶
func NewWriterExporter(writer io.Writer) *WriterExporter
type WriterTracer ¶
type WriterTracer struct {
// contains filtered or unexported fields
}
WriterTracer adapts tracer to a Writer interface
func NewWriterTracer ¶
func NewWriterTracer(trs Tracer) *WriterTracer
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
adapters
|
|
exporters
|
|
influxdb18
Package influx_exporter is a generated GoMock package.
|
Package influx_exporter is a generated GoMock package. |
util
|
|