traces

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: MIT Imports: 8 Imported by: 1

Documentation

Overview

Package traces defines types and interfaces for collecting and publishing GCI workflow traces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCallText

func GetCallText(ctx context.Context) string

GetCallText returns the call text from the context, or an empty string if no call text is set.

func GetClientName

func GetClientName(ctx context.Context) string

GetClientName returns the client name from the context, or an empty string if no client name is set.

func GetComposedAt

func GetComposedAt(ctx context.Context) time.Time

GetComposedAt returns the time the response was composed, or the zero time if no composed at time is set.

func GetHandledAt

func GetHandledAt(ctx context.Context) time.Time

GetHandledAt returns the time the request was handled by the controller, or the zero time if no handled at time is set.

func GetParsedAt

func GetParsedAt(ctx context.Context) time.Time

GetParsedAt returns the time the request was parsed, or the zero time if no parsed at time is set.

func GetPlayerName added in v0.9.0

func GetPlayerName(ctx context.Context) string

GetPlayerName returns the player name from the context, or an empty string if no player name is set.

func GetReceivedAt

func GetReceivedAt(ctx context.Context) time.Time

GetReceivedAt returns the time the request was received, or the zero time if no received at time is set.

func GetRecognizedAt

func GetRecognizedAt(ctx context.Context) time.Time

GetRecognizedAt returns the time the request was recognized, or the zero time if no recognized at time is set.

func GetRequest

func GetRequest(ctx context.Context) any

GetRequest returns the request from the context, or nil if no request is set.

func GetRequestError

func GetRequestError(ctx context.Context) error

GetRequestError returns the error from the context, or nil if no error is set.

func GetRequestText

func GetRequestText(ctx context.Context) string

GetRequestText returns the request text from the context, or an empty string if no request text is set.

func GetSubmittedAt

func GetSubmittedAt(ctx context.Context) time.Time

GetSubmittedAt returns the time the response was submitted to the SRS client, or the zero time if no submitted at time is set.

func GetSynthesizedAt

func GetSynthesizedAt(ctx context.Context) time.Time

GetSynthesizedAt returns the time the response audio was synthesized, or the zero time if no synthesized at time is set.

func GetTraceID

func GetTraceID(ctx context.Context) string

GetTraceID returns the trace ID from the context, or an empty string if no trace ID is set.

func NewRequestContext

func NewRequestContext() context.Context

NewRequestContext returns a new context with a new trace ID.

func WithCallText

func WithCallText(ctx context.Context, text string) context.Context

WithCallText returns a new context with the given call text.

func WithClientName

func WithClientName(ctx context.Context, name string) context.Context

WithClientName returns a new context with the given client name.

func WithComposedAt

func WithComposedAt(ctx context.Context, composedAt time.Time) context.Context

WithComposedAt returns a new context with the given time the response was composed.

func WithHandledAt

func WithHandledAt(ctx context.Context, handledAt time.Time) context.Context

WithHandledAt returns a new context with the given time the request was handled by the controller.

func WithParsedAt

func WithParsedAt(ctx context.Context, parsedAt time.Time) context.Context

WithParsedAt returns a new context with the given time the request was parsed.

func WithPlayerName added in v0.9.0

func WithPlayerName(ctx context.Context, name string) context.Context

WithPlayerName returns a new context with the given player name.

func WithReceivedAt

func WithReceivedAt(ctx context.Context, receivedAt time.Time) context.Context

WithReceivedAt returns a new context with the given time the request was received.

func WithRecognizedAt

func WithRecognizedAt(ctx context.Context, recognizedAt time.Time) context.Context

WithRecognizedAt returns a new context with the given time the request was recognized.

func WithRequest

func WithRequest(ctx context.Context, request any) context.Context

WithRequest returns a new context with the given request.

func WithRequestError

func WithRequestError(ctx context.Context, err error) context.Context

WithRequestError returns a new context with the given error.

func WithRequestText

func WithRequestText(ctx context.Context, text string) context.Context

WithRequestText returns a new context with the given request text.

func WithSubmittedAt

func WithSubmittedAt(ctx context.Context, submittedAt time.Time) context.Context

WithSubmittedAt returns a new context with the given time the response was submitted to the SRS client.

func WithSynthesizedAt

func WithSynthesizedAt(ctx context.Context, synthesizedAt time.Time) context.Context

WithSynthesizedAt returns a new context with the given time the response audio was synthesized.

func WithTraceID

func WithTraceID(ctx context.Context, traceID string) context.Context

WithTraceID returns a new context with the given trace ID.

func WithoutRequestText

func WithoutRequestText(ctx context.Context) context.Context

WithoutRequestText returns a new context without any request text. This is useful for removing user input whe enhanced privacy is desired.

Types

type DiscordWebhook

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

DiscordWebhook publishes traces as Discord chat messages.

func NewDiscordWebhook

func NewDiscordWebhook(webhookID, token string) (*DiscordWebhook, error)

NewDiscordWebhook creates a new DiscordWebhook which sends messages to the given webhook.

func (*DiscordWebhook) Trace

func (w *DiscordWebhook) Trace(ctx context.Context)

Trace sends any trace information in the context to the Discord webhook.

type LogTracer

type LogTracer struct{}

LogTracer publishes traces as structured logs.

func (*LogTracer) Trace

func (*LogTracer) Trace(ctx context.Context)

Trace logs any trace information in the context.

type Tracer

type Tracer interface {
	// Trace publishes any trace in the given context.
	Trace(context.Context)
}

Tracer publishes traces to a remote service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL