tracygo

package module
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: Apache-2.0 Imports: 1 Imported by: 7

README

TracyGo

INFO

TracyGo provides functionality for tracing a correlation identifier through multiple go microservices.

The library includes middlewares for the following frameworks:

Supported Go Versions

This library supports the most recent Go, currently 1.21.

How to install

go get github.com/Clarilab/tracygo/v2

How to import

import "github.com/Clarilab/tracygo/v2"

How to use

In the examples folder you will find some example applications. One using the atreugo middleware, one using the fiber middleware. Both examples also demonstrate how to use the resty middleware.

Documentation

Overview

The TracyGo package provides functionality for tracing a correlation identifier through multiple go microservices.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(tracy *TracyGo)

Option is an optional func.

func WithCorrelationID

func WithCorrelationID(id string) Option

WithCorrelationID returns a function that sets the key for the correlationId header.

func WithRequestID

func WithRequestID(id string) Option

WithRequestID returns a function that sets the key for the requestId header.

type TracyGo

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

TracyGo is a struct for the tracy object.

func New

func New(options ...Option) *TracyGo

New creates a new TracyGo object and uses the options on it.

func (*TracyGo) CorrelationIDKey added in v2.1.0

func (t *TracyGo) CorrelationIDKey() string

CorrelationIDKey returns the underlying correlationID key.

func (*TracyGo) CorrelationIDromContext added in v2.1.0

func (t *TracyGo) CorrelationIDromContext(ctx context.Context) string

FromContext returns the correlationID from the given context, or the an empty string.

func (*TracyGo) NewContextWithCorrelationID added in v2.1.0

func (t *TracyGo) NewContextWithCorrelationID(ctx context.Context, correlationID string) context.Context

NewContextWithCorrelationID sets the correlationID to use in the given context. If ctx is nil, a new context without value is created.

func (*TracyGo) NewContextWithRequestID added in v2.1.0

func (t *TracyGo) NewContextWithRequestID(ctx context.Context, requestID string) context.Context

NewContextWithRequestID sets the requestID to use in the given context. If ctx is nil, a new context without value is created.

func (*TracyGo) RequestIDFromContext added in v2.1.0

func (t *TracyGo) RequestIDFromContext(ctx context.Context) string

FromContext returns the correlationID from the given context, or the an empty string.

func (*TracyGo) RequestIDKey added in v2.1.0

func (t *TracyGo) RequestIDKey() string

RequestIDKey returns the underlying requestID key.

Jump to

Keyboard shortcuts

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