tracygo

package module
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 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.22.3.

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 correlation id header.

func WithRequestID

func WithRequestID(id string) Option

WithRequestID returns a function that sets the key for the request id 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 correlation id key.

func (*TracyGo) CorrelationIDromContext added in v2.1.0

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

FromContext returns the correlation id 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 correlation id 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 request id 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 request id key.

Directories

Path Synopsis
examples
middleware

Jump to

Keyboard shortcuts

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