ehtracygo

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: Apache-2.0 Imports: 2 Imported by: 1

README

Info

This libary can be used to enhance the https://github.com/looplab/eventhorizon library with the functionality to trace the X-Correlation-ID through events.

Supported Go Versions:

This library supports two most recent Go, currently 1.16

Install

go get github.com/Clarilab/eh-tracygo

Usage

Get Correlation-ID from Context:

import (
    ehtracygo "github.com/Clarilab/eh-tracygo"
)

func someFunction(ctx context.Context) {
    correlationID := ehtracygo.FromContext(ctx)
}

Add Correlation-ID to Context:

import (
    ehtracygo "github.com/Clarilab/eh-tracygo"
)

func someFunction(ctx context.Context, correlationID string) {
    ctx = ehtracygo.NewContext(ctx, correlationID)
}

Documentation

Index

Constants

View Source
const (
	DefaultCorrelationID string = ""
)

Strings used to marshal context values.

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context) string

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

func NewContext

func NewContext(ctx context.Context, correlationID string) context.Context

NewContext sets the correlationID to use in the context.

Types

This section is empty.

Jump to

Keyboard shortcuts

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