Skip to content

Import path: gitlab.soludian.com/soludian/fountain/libs/ftracer

ftracer

go
import "gitlab.soludian.com/soludian/fountain/libs/ftracer"

Index

Constants

go
const KPackageName = "ftracer"

Variables

go
var GetFountainInstance = Lib.GetFountainInstance

go
var GetFountainManager = Lib.GetFountainManager

Sử dụng khi config instance ở dạng key:value; Nếu config instance ở dạng key:array thì sử dụng hàm InstallFountainInstances Nếu config ở dạng key:array thì sẽ chỉ install config phần tử đầu tiên mà thôi

Install with config format <key>:<value>; eg: ftracer:<value>

Usage:

config.yaml:

ftracer:
  - name: default_name
    ...

code.go

ftracer.InstallFountainInstance()

ftracer.WithConfigKey("ftracer").InstallFountainInstance()
go
var InstallFountainInstance = Lib.InstallFountainInstance

Sử dụng khi config instance ở dạng key:array<value>; Sẽ luôn cố gắng khởi tạo kể cả khi config ở dạng key:value

Install with config format <key>:array<value>; eg: ftracer:array<value>

Usage:

config.yaml:

ftracer:
  - name: default_name
    ...

code.go

ftracer.InstallFountainInstances()

ftracer.WithConfigKey("ftracer").InstallFountainInstances()
go
var InstallFountainInstances = Lib.InstallFountainInstances

Truy cập thẳng tới bộ quản lý thư viện

go
var Lib = lib_3rd.NewLib(newTracer, lib_3rd.WithDefaultConfigFunc[config, client](DefaultConfig))

go
var (
    // String...
    String = attribute.String
)

go
var WithConfigKey = Lib.WithConfigKey

func CompatibleExtractGRPCTraceID

go
func CompatibleExtractGRPCTraceID(header metadata.MD)

CompatibleExtractGRPCTraceID... Deprecated This method will be removed in v1.2.0

func CompatibleExtractHTTPTraceID

go
func CompatibleExtractHTTPTraceID(ctx fiber.Ctx)

CompatibleExtractHTTPTraceID... Deprecated This method will be removed in v1.2.0

func CompatibleParse

go
func CompatibleParse(traceID string) string

CompatibleParse... openTrace: 18af9db18a77f4b7:18af9db18a77f4b7:0000000000000000:0 openTelemetry: 00-18af9db18a77f4b718af9db18a77f4b7-18af9db18a77f4b7-00 https://www.w3.org/TR/trace-context/

func CustomTag

go
func CustomTag(key string, val string) attribute.KeyValue

CustomTag...

func ExtractTraceID

go
func ExtractTraceID(ctx context.Context) string

ExtractTraceID HTTP uses request.Context, don't use it wrong

func IsGlobalTracerRegistered

go
func IsGlobalTracerRegistered() bool

IsGlobalTracerRegistered returns a `bool` to indicate if a tracer has been globally registered

func SetGlobalTracer

go
func SetGlobalTracer(tp trace.TracerProvider)

SetGlobalTracer...

type Option

Option optional

go
type Option func(c *config)

func WithOtlpResourceOption

go
func WithOtlpResourceOption(options ...resource.Option) Option

WithOtlpResourceOption customize otlp resource Option

func WithOtlpTraceGrpcOption

go
func WithOtlpTraceGrpcOption(options ...otlptracegrpc.Option) Option

WithOtlpTraceGrpcOption custom otlp Option

func WithTracerProviderOption

go
func WithTracerProviderOption(options ...trace_sdk.TracerProviderOption) Option

WithTracerProviderOption...

type Tracer

Tracer is otel span tracer

go
type Tracer struct {
    // contains filtered or unexported fields
}

func NewTracer

go
func NewTracer(kind trace.SpanKind, opts ...propagationOption) *Tracer

NewTracer create new tracer instance

func (*Tracer) Start

go
func (t *Tracer) Start(ctx context.Context, spanName string, carrier propagation.TextMapCarrier, opts ...trace.SpanStartOption) (context.Context, trace.Span)

Start start tracing span

Generated by gomarkdoc