xtrace

package
v0.0.0-...-f54e1bb Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: BSD-3-Clause Imports: 6 Imported by: 1

README

xtrace

import "github.com/blueprint-uservices/blueprint/runtime/plugins/xtrace"

Package xtrace provides xtrace-based runtime components to be used by blueprint application workflows and blueprint generated code. The package provides the following runtime components: (i) XTracerImpl: a client-wrapper implementation of the XTracer interface to a xtrace server. Used by the xtrace plugin for providing context propagation between multiple processes. (ii) XTraceLogger: an xtrace-based logger implementation of the [Logger] interface. Once initialized, the logger sets itself as the default logger for logging across blueprint applications.

Index

type XTraceLogger

Implementation of the [backend.Logger] interface Note: This logger should only be used in conjunction with the XTracerImpl tracer. Using this logger without using the XTracerImpl tracer would result in no-op logging behavior.

type XTraceLogger struct {
    backend.Logger
}

func NewXTraceLogger
func NewXTraceLogger(ctx context.Context, addr string) (*XTraceLogger, error)

Returns a new instance of XTracerImpl that connects to a xtrace server running at `addr`. REQUIRED: An xtrace server must be running at `addr`

func (*XTraceLogger) Debug
func (l *XTraceLogger) Debug(ctx context.Context, format string, args ...any) (context.Context, error)

Implements backend.Logger

func (*XTraceLogger) Error
func (l *XTraceLogger) Error(ctx context.Context, format string, args ...any) (context.Context, error)

Implements backend.Logger

func (*XTraceLogger) Info
func (l *XTraceLogger) Info(ctx context.Context, format string, args ...any) (context.Context, error)

Implements backend.Logger

func (*XTraceLogger) Logf
func (l *XTraceLogger) Logf(ctx context.Context, opts backend.LogOptions, format string, args ...any) (context.Context, error)

Implements backend.Logger

func (*XTraceLogger) Warn
func (l *XTraceLogger) Warn(ctx context.Context, format string, args ...any) (context.Context, error)

Implements backend.Logger

type XTracer

Represents the XTrace tracer interface exposed to applications and used by the xtrace plugin.

type XTracer interface {
    // Creates an event in the current trace with `msg` as content.
    Log(ctx context.Context, msg string) (context.Context, error)
    // Creates an event in the current trace with `msg` as content along with `tags` as the keywords for the text.
    LogWithTags(ctx context.Context, msg string, tags ...string) (context.Context, error)
    // Starts a new trace with given `tags`
    StartTask(ctx context.Context, tags ...string) (context.Context, error)
    // Stops the current running trace.
    StopTask(ctx context.Context) (context.Context, error)
    // Merges the incoming `other` baggage into the current trace's existing baggage.
    Merge(ctx context.Context, other tracingplane.BaggageContext) (context.Context, error)
    // Sets the current trace's `baggage` to the one provided.
    Set(ctx context.Context, baggage tracingplane.BaggageContext) (context.Context, error)
    // Returns the current trace's baggage.
    Get(ctx context.Context) (tracingplane.BaggageContext, error)
    // Returns true if there is an ongoing trace.
    IsTracing(ctx context.Context) (bool, error)
}

type XTracerImpl

Implementation of the XTracer interface

type XTracerImpl struct {
    XTracer
}

func NewXTracerImpl
func NewXTracerImpl(ctx context.Context, addr string) (*XTracerImpl, error)

Returns a new instance of XTracerImpl that connects to a xtrace server running at `addr`. REQUIRED: An xtrace server must be running at `addr`

func (*XTracerImpl) Get
func (xt *XTracerImpl) Get(ctx context.Context) (tracingplane.BaggageContext, error)

Implements the XTracer interface

func (*XTracerImpl) IsTracing
func (xt *XTracerImpl) IsTracing(ctx context.Context) (bool, error)

Implements the XTracer interface

func (*XTracerImpl) Log
func (xt *XTracerImpl) Log(ctx context.Context, msg string) (context.Context, error)

Implements the XTracer interface

func (*XTracerImpl) LogWithTags
func (xt *XTracerImpl) LogWithTags(ctx context.Context, msg string, tags ...string) (context.Context, error)

Implements the XTracer interface

func (*XTracerImpl) Merge
func (xt *XTracerImpl) Merge(ctx context.Context, other tracingplane.BaggageContext) (context.Context, error)

Implements the XTracer interface

func (*XTracerImpl) Set
func (xt *XTracerImpl) Set(ctx context.Context, baggage tracingplane.BaggageContext) (context.Context, error)

Implements the XTracer interface

func (*XTracerImpl) StartTask
func (xt *XTracerImpl) StartTask(ctx context.Context, tags ...string) (context.Context, error)

Implements the XTracer interface

func (*XTracerImpl) StopTask
func (xt *XTracerImpl) StopTask(ctx context.Context) (context.Context, error)

Implements the XTracer interface

Generated by gomarkdoc

Documentation

Overview

Package xtrace provides xtrace-based runtime components to be used by blueprint application workflows and blueprint generated code. The package provides the following runtime components: (i) XTracerImpl: a client-wrapper implementation of the XTracer interface to a xtrace server. Used by the xtrace plugin for providing context propagation between multiple processes. (ii) XTraceLogger: an xtrace-based logger implementation of the [Logger] interface. Once initialized, the logger sets itself as the default logger for logging across blueprint applications.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type XTraceLogger

type XTraceLogger struct {
	backend.Logger
}

Implementation of the backend.Logger interface Note: This logger should only be used in conjunction with the XTracerImpl tracer. Using this logger without using the XTracerImpl tracer would result in no-op logging behavior.

func NewXTraceLogger

func NewXTraceLogger(ctx context.Context, addr string) (*XTraceLogger, error)

Returns a new instance of XTracerImpl that connects to a xtrace server running at `addr`. REQUIRED: An xtrace server must be running at `addr`

func (*XTraceLogger) Debug

func (l *XTraceLogger) Debug(ctx context.Context, format string, args ...any) (context.Context, error)

Implements backend.Logger

func (*XTraceLogger) Error

func (l *XTraceLogger) Error(ctx context.Context, format string, args ...any) (context.Context, error)

Implements backend.Logger

func (*XTraceLogger) Info

func (l *XTraceLogger) Info(ctx context.Context, format string, args ...any) (context.Context, error)

Implements backend.Logger

func (*XTraceLogger) Logf

func (l *XTraceLogger) Logf(ctx context.Context, opts backend.LogOptions, format string, args ...any) (context.Context, error)

Implements backend.Logger

func (*XTraceLogger) Warn

func (l *XTraceLogger) Warn(ctx context.Context, format string, args ...any) (context.Context, error)

Implements backend.Logger

type XTracer

type XTracer interface {
	// Creates an event in the current trace with `msg` as content.
	Log(ctx context.Context, msg string) (context.Context, error)
	// Creates an event in the current trace with `msg` as content along with `tags` as the keywords for the text.
	LogWithTags(ctx context.Context, msg string, tags ...string) (context.Context, error)
	// Starts a new trace with given `tags`
	StartTask(ctx context.Context, tags ...string) (context.Context, error)
	// Stops the current running trace.
	StopTask(ctx context.Context) (context.Context, error)
	// Merges the incoming `other` baggage into the current trace's existing baggage.
	Merge(ctx context.Context, other tracingplane.BaggageContext) (context.Context, error)
	// Sets the current trace's `baggage` to the one provided.
	Set(ctx context.Context, baggage tracingplane.BaggageContext) (context.Context, error)
	// Returns the current trace's baggage.
	Get(ctx context.Context) (tracingplane.BaggageContext, error)
	// Returns true if there is an ongoing trace.
	IsTracing(ctx context.Context) (bool, error)
}

Represents the XTrace tracer interface exposed to applications and used by the xtrace plugin.

type XTracerImpl

type XTracerImpl struct {
	XTracer
}

Implementation of the XTracer interface

func NewXTracerImpl

func NewXTracerImpl(ctx context.Context, addr string) (*XTracerImpl, error)

Returns a new instance of XTracerImpl that connects to a xtrace server running at `addr`. REQUIRED: An xtrace server must be running at `addr`

func (*XTracerImpl) Get

Implements the XTracer interface

func (*XTracerImpl) IsTracing

func (xt *XTracerImpl) IsTracing(ctx context.Context) (bool, error)

Implements the XTracer interface

func (*XTracerImpl) Log

func (xt *XTracerImpl) Log(ctx context.Context, msg string) (context.Context, error)

Implements the XTracer interface

func (*XTracerImpl) LogWithTags

func (xt *XTracerImpl) LogWithTags(ctx context.Context, msg string, tags ...string) (context.Context, error)

Implements the XTracer interface

func (*XTracerImpl) Merge

Implements the XTracer interface

func (*XTracerImpl) Set

Implements the XTracer interface

func (*XTracerImpl) StartTask

func (xt *XTracerImpl) StartTask(ctx context.Context, tags ...string) (context.Context, error)

Implements the XTracer interface

func (*XTracerImpl) StopTask

func (xt *XTracerImpl) StopTask(ctx context.Context) (context.Context, error)

Implements the XTracer interface

Jump to

Keyboard shortcuts

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