Documentation
¶
Overview ¶
Package slackcontext defines getters and setters for execution-scoped values that are propagated through context.Context during the execution of a Slack command. These values may include unique identifiers, session metadata, host information, version details, and other execution data.
All values should be set in the context before a Slack command begins execution. The values can then be accessed throughout the command's execution lifecycle using the provided getter methods.
Each value is stored with an unexported key type to prevent collisions with other packages using context values. The package provides type-safe accessors for retrieving these values.
Index ¶
- func MockContext(ctx context.Context) context.Context
- func OpenTracingSpan(ctx context.Context) (opentracing.Span, error)
- func OpenTracingTraceID(ctx context.Context) (string, error)
- func OpenTracingTracer(ctx context.Context) (opentracing.Tracer, error)
- func ProjectID(ctx context.Context) (string, error)
- func SessionID(ctx context.Context) (string, error)
- func SetOpenTracingSpan(ctx context.Context, span opentracing.Span) context.Context
- func SetOpenTracingTraceID(ctx context.Context, traceID string) context.Context
- func SetOpenTracingTracer(ctx context.Context, tracer opentracing.Tracer) context.Context
- func SetProjectID(ctx context.Context, projectID string) context.Context
- func SetSessionID(ctx context.Context, sessionID string) context.Context
- func SetSystemID(ctx context.Context, systemID string) context.Context
- func SetVersion(ctx context.Context, version string) context.Context
- func SystemID(ctx context.Context) (string, error)
- func Version(ctx context.Context) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MockContext ¶
MockContext sets values in the context that are guaranteed to exist before the Cobra root command is executed.
func OpenTracingSpan ¶
func OpenTracingSpan(ctx context.Context) (opentracing.Span, error)
OpenTracingSpan returns the `opentracing.Span“ associated with `ctx`, or `nil` and `slackerror.ErrContextValueNotFound` if no `Span` could be found.
func OpenTracingTraceID ¶
OpenTracingTraceID returns the trace ID associated with `ctx`, or `""` and `slackerror.ErrContextValueNotFound` if no trace ID could be found.
func OpenTracingTracer ¶
func OpenTracingTracer(ctx context.Context) (opentracing.Tracer, error)
OpenTracingTracer returns the `opentracing.Tracer` associated with `ctx`, or `nil` and `slackerror.ErrContextValueNotFound` if no `Tracer` could be found.
func ProjectID ¶
ProjectID returns the project ID associated with `ctx`, or `""` and `slackerror.ErrContextValueNotFound` if no project ID could be found.
func SessionID ¶
SessionID returns the session ID associated with `ctx`, or `""` and `slackerror.ErrContextValueNotFound` if no session ID could be found.
func SetOpenTracingSpan ¶
SetOpenTracingSpan returns a new `context.Context` that holds a reference to the span. If span is nil, a new context without an active span is returned.
func SetOpenTracingTraceID ¶
SetOpenTracingTraceID returns a new `context.Context` that holds a reference to the `traceID`.
func SetOpenTracingTracer ¶
SetOpenTracingSpan returns a new `context.Context` that holds a reference to the `opentracing.Tracer`. If tracer is nil, a new context without a tracer returned.
func SetProjectID ¶
SetProjectID returns a new `context.Context` that holds a reference to the `projectID` and updates the `opentracing.Span` tag with the `projectID`.
func SetSessionID ¶
SetSessionID returns a new `context.Context` that holds a reference to the `sessionID`.
func SetSystemID ¶
SetSystemID returns a new `context.Context` that holds a reference to the `systemID` and updates the `opentracing.Span` tag with the `systemID`.
func SetVersion ¶
SetVersion adds the slack-cli version to Golang context for trace logging
Types ¶
This section is empty.