newHandler(api *ResourceAPI) http.Handler { mux := http.NewServeMux() mux.HandleFunc("/", api.healthCheck) mux.HandleFunc("/readiness", api.readinessHandler) mux.HandleFunc("/path/to/resource", api.saveResource) var h http.Handler = mux h = otelMiddleware(h) return h } func otelMiddleware(next http.Handler) http.Handler { return otelhttp.NewHandler(next, "server", otelhttp.WithMessageEvents(otelhttp.ReadEvents, otelhttp.WriteEvents), otelhttp.WithFilter( filters.All( // ignore health check endpoints filters.Not(filters.Path("/")), filters.Not(filters.Path("/readiness")), ), ), ) } ヘルスチェックのリクエストは無視 する