Import path:
gitlab.soludian.com/soludian/fountain/libs/ftracer
ftracer
import "gitlab.soludian.com/soludian/fountain/libs/ftracer"Index
- Constants
- Variables
- func CompatibleExtractGRPCTraceID(header metadata.MD)
- func CompatibleExtractHTTPTraceID(ctx fiber.Ctx)
- func CompatibleParse(traceID string) string
- func CustomTag(key string, val string) attribute.KeyValue
- func ExtractTraceID(ctx context.Context) string
- func IsGlobalTracerRegistered() bool
- func SetGlobalTracer(tp trace.TracerProvider)
- type Option
- type Tracer
Constants
const KPackageName = "ftracer"Variables
var GetFountainInstance = Lib.GetFountainInstancevar GetFountainManager = Lib.GetFountainManagerSử 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()var InstallFountainInstance = Lib.InstallFountainInstanceSử 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()var InstallFountainInstances = Lib.InstallFountainInstancesTruy cập thẳng tới bộ quản lý thư viện
var Lib = lib_3rd.NewLib(newTracer, lib_3rd.WithDefaultConfigFunc[config, client](DefaultConfig))var (
// String...
String = attribute.String
)var WithConfigKey = Lib.WithConfigKeyfunc CompatibleExtractGRPCTraceID
func CompatibleExtractGRPCTraceID(header metadata.MD)CompatibleExtractGRPCTraceID... Deprecated This method will be removed in v1.2.0
func CompatibleExtractHTTPTraceID
func CompatibleExtractHTTPTraceID(ctx fiber.Ctx)CompatibleExtractHTTPTraceID... Deprecated This method will be removed in v1.2.0
func CompatibleParse
func CompatibleParse(traceID string) stringCompatibleParse... openTrace: 18af9db18a77f4b7:18af9db18a77f4b7:0000000000000000:0 openTelemetry: 00-18af9db18a77f4b718af9db18a77f4b7-18af9db18a77f4b7-00 https://www.w3.org/TR/trace-context/
func CustomTag
func CustomTag(key string, val string) attribute.KeyValueCustomTag...
func ExtractTraceID
func ExtractTraceID(ctx context.Context) stringExtractTraceID HTTP uses request.Context, don't use it wrong
func IsGlobalTracerRegistered
func IsGlobalTracerRegistered() boolIsGlobalTracerRegistered returns a `bool` to indicate if a tracer has been globally registered
func SetGlobalTracer
func SetGlobalTracer(tp trace.TracerProvider)SetGlobalTracer...
type Option
Option optional
type Option func(c *config)func WithOtlpResourceOption
func WithOtlpResourceOption(options ...resource.Option) OptionWithOtlpResourceOption customize otlp resource Option
func WithOtlpTraceGrpcOption
func WithOtlpTraceGrpcOption(options ...otlptracegrpc.Option) OptionWithOtlpTraceGrpcOption custom otlp Option
func WithTracerProviderOption
func WithTracerProviderOption(options ...trace_sdk.TracerProviderOption) OptionWithTracerProviderOption...
type Tracer
Tracer is otel span tracer
type Tracer struct {
// contains filtered or unexported fields
}func NewTracer
func NewTracer(kind trace.SpanKind, opts ...propagationOption) *TracerNewTracer create new tracer instance
func (*Tracer) Start
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