Movatterモバイル変換


[0]ホーム

URL:


observe

packagemodule
v0.0.0-...-9145d8aLatest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2024 License:Apache-2.0Imports:19Imported by:2

Details

Repository

github.com/dylibso/observe-sdk

Links

Documentation

Index

Constants

View Source
const (ErrorLogLevel = 1Warn           = 2Info           = 3Debug          = 4)

Variables

This section is empty.

Functions

funcAddOtelKeyValueInt64

func AddOtelKeyValueInt64(kvs ...*common.KeyValue) *common.KeyValue

funcGetOtelAttrFromSpan

func GetOtelAttrFromSpan(attrstring, span *trace.Span) (int, *common.KeyValue)

funcNewOtelKeyValueInt64

func NewOtelKeyValueInt64(keystring, valueint64) *common.KeyValue

funcNewOtelKeyValueString

func NewOtelKeyValueString(keystring, valuestring) *common.KeyValue

funcNewOtelSpan

func NewOtelSpan(traceIdstring, parentId []byte, namestring, start, endtime.Time) *trace.Span

Types

typeAdapter

type Adapter interface {Start(context.Context)Stop(waitbool)HandleTraceEvent(eTraceEvent)}

The primary interface that every Adapter needs to followStart() and Stop() can just call the implementations on AdapterBaseor provide some custom logic. HandleTraceEvent is called afteran invocation of a wasm module is done and all events are collected.

typeAdapterBase

type AdapterBase struct {TraceEvents chanTraceEvent// contains filtered or unexported fields}

Shared implementation for all Adapters

funcNewAdapterBase

func NewAdapterBase(batchSizeint, flushPeriodtime.Duration)AdapterBase

func (*AdapterBase)HandleTraceEvent

func (b *AdapterBase) HandleTraceEvent(teTraceEvent)

func (*AdapterBase)MakeOtelCallSpans

func (b *AdapterBase) MakeOtelCallSpans(eventCallEvent, parentId []byte, traceIdstring) []*trace.Span

MakeOtelCallSpans recursively constructs call spans in open telemetry format

func (*AdapterBase)NewTraceCtx

func (a *AdapterBase) NewTraceCtx(ctxcontext.Context, rwazero.Runtime, wasm []byte, opts *Options) (*TraceCtx,error)

func (*AdapterBase)SetFlusher

func (b *AdapterBase) SetFlusher(fFlusher)

func (*AdapterBase)Start

func (b *AdapterBase) Start(ctxcontext.Context, aAdapter)

func (*AdapterBase)Stop

func (b *AdapterBase) Stop(waitbool)

Stops the adapter and waits for all flushes to complete.Set wait parameter to false if you don't want to wait

typeCallEvent

type CallEvent struct {Raw      []RawEventTimetime.TimeDurationtime.Duration// contains filtered or unexported fields}

func (CallEvent)FunctionIndex

func (eCallEvent) FunctionIndex()uint32

func (CallEvent)FunctionName

func (eCallEvent) FunctionName()string

func (CallEvent)RawEvents

func (eCallEvent) RawEvents() []RawEvent

func (*CallEvent)Stop

func (e *CallEvent) Stop(attime.Time)

func (CallEvent)Within

func (eCallEvent) Within() []Event

typeCustomEvent

type CustomEvent struct {Timetime.TimeNamestringMetadata map[string]interface{}}

funcNewCustomEvent

func NewCustomEvent(namestring)CustomEvent

func (CustomEvent)RawEvents

func (eCustomEvent) RawEvents() []RawEvent

typeEvent

type Event interface {RawEvents() []RawEvent}

typeEventBucket

type EventBucket struct {// contains filtered or unexported fields}

EventBucket is a bucket for outgoing TraceEvents.It only schedules flushes when the bucket goes from empty to 1 item.At most the latency to flush the bucket will be flushPeriod.It will also flush the TraceEvents in batches according to batch size

funcNewEventBucket

func NewEventBucket(batchSizeint, flushPeriodtime.Duration) *EventBucket

NewEventBucket creates an EventBucket

func (*EventBucket)Wait

func (b *EventBucket) Wait()

Wait will block until all pending flushes are done

typeEventKind

type EventKindint
const (CallEventKind =iotaMemoryGrowCustomMetricSpanTagsLog)

typeFlusher

type Flusher interface {Flush(events []TraceEvent)error}

typeLogEvent

type LogEvent struct {Timetime.TimeMessagestringLevelLogLevel}

func (LogEvent)RawEvents

func (eLogEvent) RawEvents() []RawEvent

typeLogLevel

type LogLeveluint

typeMemoryGrowEvent

type MemoryGrowEvent struct {RawRawEventTimetime.Time}

func (MemoryGrowEvent)FunctionIndex

func (eMemoryGrowEvent) FunctionIndex()uint32

func (MemoryGrowEvent)FunctionName

func (eMemoryGrowEvent) FunctionName()string

func (MemoryGrowEvent)MemoryGrowAmount

func (eMemoryGrowEvent) MemoryGrowAmount()uint32

func (MemoryGrowEvent)RawEvents

func (eMemoryGrowEvent) RawEvents() []RawEvent

typeMetricEvent

type MetricEvent struct {Timetime.TimeFormatMetricFormatMessagestring}

func (MetricEvent)RawEvents

func (eMetricEvent) RawEvents() []RawEvent

typeMetricFormat

type MetricFormatuint
const (StatsdFormatMetricFormat = 1)

typeOptions

type Options struct {SpanFilter        *SpanFilterChannelBufferSizeint}

Specify options to change what or how the adapter receives ObserveEvents

funcNewDefaultOptions

func NewDefaultOptions() *Options

Create a default configuration

typeOtelTrace

type OtelTrace struct {TraceIdstringTracesData *trace.TracesData}

funcNewOtelTrace

func NewOtelTrace(traceIdstring, serviceNamestring, spans []*trace.Span) *OtelTrace

func (*OtelTrace)SetMetadata

func (t *OtelTrace) SetMetadata(te *TraceEvent, meta map[string]string)

typeRawEvent

type RawEvent struct {KindRawEventKindStack            []experimental.InternalFunctionFunctionIndexuint32FunctionNamestringMemoryGrowAmountuint32Timetime.TimeDurationtime.Duration}

Represents the raw event in our Observe form.Events are transformed into vendor specific formatsin the Adapters.

typeRawEventKind

type RawEventKindint
const (RawEnterRawEventKind =iotaRawExitRawMemoryGrowRawMetricRawSpanTagsRawLogRawUnknownEvent)

typeSpanFilter

type SpanFilter struct {MinDurationtime.Duration}

Definition of how to filter our Spans to reduce noise

typeSpanTagsEvent

type SpanTagsEvent struct {RawRawEventTimetime.TimeTags []string}

func (SpanTagsEvent)RawEvents

func (eSpanTagsEvent) RawEvents() []RawEvent

typeTelemetryId

type TelemetryId struct {// contains filtered or unexported fields}

This is a shared type for a span or trace id.It's represented by 2 uint64s and can be transformedto different string or int representations where needed.

funcNewSpanId

func NewSpanId()TelemetryId

Create a new span id

funcNewTraceId

func NewTraceId()TelemetryId

Create a new trace id

func (*TelemetryId)FromBytes

func (t *TelemetryId) FromBytes(id []byte)error

func (*TelemetryId)FromString

func (t *TelemetryId) FromString(idstring)error

func (TelemetryId)Lsb

func (idTelemetryId) Lsb()uint64

func (TelemetryId)Msb

func (idTelemetryId) Msb()uint64

func (TelemetryId)ToHex16

func (tTelemetryId) ToHex16()string

Encode this id into a 16 byte hex (32 chars)Uses both 16 byte uint64 values

func (TelemetryId)ToHex8

func (tTelemetryId) ToHex8()string

Encode this id into an 8 byte hex (16 chars)Just uses the least significant of the 16 bytes

func (TelemetryId)ToUint64

func (tTelemetryId) ToUint64()uint64

Some adapters may need a raw representation

typeTraceCtx

type TraceCtx struct {Options *Options// contains filtered or unexported fields}

TraceCtx holds the context for a trace, or wasm module invocation.It collects holds a channel to the Adapter and from the wazero ListenerIt will collect events throughout the invocation of the function. CallingFinish() will then submit those events to the Adapter to be processed and sent

func (*TraceCtx)Abort

Null implementation of the Abort() method to satisfy the FunctionListener interface.

func (*TraceCtx)After

Null implementation of the After() method to satisfy the FunctionListener interface.

func (*TraceCtx)Before

Implements the Before() method to satisfy the FunctionListener interface.This takes events from the wazero runtime and sends them to the `raw` channel on the TraceCtx.

func (*TraceCtx)Finish

func (t *TraceCtx) Finish()

Finish() will stop the trace and send theTraceEvent payload to the adapter

func (*TraceCtx)Metadata

func (t *TraceCtx) Metadata(metadata interface{})

func (*TraceCtx)NewFunctionListener

Implements the NewFunctionListener() method to satisfy the FunctionListener interface

func (*TraceCtx)NewListener

Implements the NewListener() method to satisfy the FunctionListener interface

func (*TraceCtx)SetTraceId

func (t *TraceCtx) SetTraceId(idstring)error

typeTraceEvent

type TraceEvent struct {Events      []EventTelemetryIdTelemetryIdAdapterMeta interface{}}

The payload that contains all the Eventsfrom a single wasm module invocation

Source Files

View all Source files

Directories

PathSynopsis
adapter
bin
datadogcommand
honeycombcommand
lightstepcommand
otelstdoutcommand
stdoutcommand

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp