MCPcopy Create free account
hub / github.com/astercloud/aster / processMiddleware

Function processMiddleware

examples/telemetry/main.go:268–283  ·  view source on GitHub ↗

辅助函数

(ctx context.Context, _ telemetry.Span)

Source from the content-addressed store, hash-verified

266// 辅助函数
267
268func processMiddleware(ctx context.Context, _ telemetry.Span) {
269 tracer := telemetry.GetGlobalTracer()
270
271 middlewares := []string{"auth", "rate-limit", "logging"}
272 for _, mw := range middlewares {
273 _, span := tracer.StartSpan(
274 ctx,
275 "middleware."+mw,
276 telemetry.WithSpanKind(telemetry.SpanKindInternal),
277 )
278
279 time.Sleep(10 * time.Millisecond)
280 span.SetStatus(telemetry.StatusCodeOK, mw+" passed")
281 span.End()
282 }
283}
284
285func processLLM(ctx context.Context, _ telemetry.Span) {
286 tracer := telemetry.GetGlobalTracer()

Callers 1

agentTracingExampleFunction · 0.85

Calls 5

GetGlobalTracerFunction · 0.92
WithSpanKindFunction · 0.92
StartSpanMethod · 0.65
SetStatusMethod · 0.65
EndMethod · 0.65

Tested by

no test coverage detected