Add OpenTelemetry instrumentation with middleware-only approach

This commit is contained in:
Mistral Vibe
2026-04-04 12:19:48 +02:00
committed by Gabriel Radureau
parent c38d7c6d76
commit 36f0b79b90
13 changed files with 452 additions and 46 deletions

View File

@@ -45,4 +45,4 @@ func (h *apiV1GreetHandler) handleGreetPath(w http.ResponseWriter, r *http.Reque
func (h *apiV1GreetHandler) writeJSONResponse(w http.ResponseWriter, message string) {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]string{"message": message})
}
}

View File

@@ -16,7 +16,7 @@ func NewService() *Service {
// Implements the Greeter interface.
func (s *Service) Greet(ctx context.Context, name string) string {
log.Trace().Ctx(ctx).Str("name", name).Msg("Greet function called")
if name == "" {
return "Hello world!"
}

View File

@@ -25,4 +25,4 @@ func TestService_Greet(t *testing.T) {
}
})
}
}
}