package
1.0.1
Repository: https://github.com/apus-run/van.git
Documentation: pkg.go.dev

# README

tracing

func InitTrace(serviceName string) {
	exporter, err := tracer.NewJaegerAgentExporter("192.168.3.37", "6831")
	if err != nil {
		panic(err)
	}

	resource := tracer.NewResource(
		tracer.WithServiceName(serviceName),
		tracer.WithEnvironment("dev"),
		tracer.WithServiceVersion("demo"),
	)

	tracer.Init(exporter, resource) // collect all by default
}

func NewRouter(
    r := gin.Default()
    r.Use(middleware.Tracing("your-service-name"))

    // ......
)

// if necessary, you can create a span in the program
func SpanDemo(serviceName string, spanName string, ctx context.Context) {
	_, span := otel.Tracer(serviceName).Start(
		ctx, spanName,
		trace.WithAttributes(attribute.String(spanName, time.Now().String())),
	)
	defer span.End()

	// ......
}

# Functions

Tracing returns interceptor that will trace incoming requests.
WithPropagators specifies propagators to use for extracting information from the HTTP requests.
WithTracerProvider specifies a tracer provider to use for creating a tracer.

# Type aliases

TraceOption specifies instrumentation configuration options.