From 82bcebbb895f746182bd07ae689eeee902b63d6c Mon Sep 17 00:00:00 2001 From: Matt Bray Date: Thu, 24 Mar 2022 21:01:56 +0000 Subject: [PATCH] chore(cohttp): optional service_name --- src/integrations/cohttp/opentelemetry_cohttp_lwt.ml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/integrations/cohttp/opentelemetry_cohttp_lwt.ml b/src/integrations/cohttp/opentelemetry_cohttp_lwt.ml index 64802204..6fb98ec4 100644 --- a/src/integrations/cohttp/opentelemetry_cohttp_lwt.ml +++ b/src/integrations/cohttp/opentelemetry_cohttp_lwt.ml @@ -19,7 +19,7 @@ module Server : sig (Server.make () ~callback:callback_traced) *) val trace : - service_name:string -> + ?service_name:string -> ?attrs:Otel.Span.key_value list -> ('conn -> Request.t -> 'body -> (Response.t * 'body) Lwt.t) -> 'conn -> Request.t -> 'body -> (Response.t * 'body) Lwt.t @@ -112,11 +112,11 @@ end = struct let headers = Header.remove (Request.headers req) header_x_ocaml_otel_traceparent in { req with headers } - let trace ~service_name ?(attrs=[]) callback = + let trace ?service_name ?(attrs=[]) callback = fun conn req body -> let scope = get_trace_context ~from:`External req in Otel_lwt.Trace.with_ - ~service_name + ?service_name "request" ~kind:Span_kind_server ?trace_id:(Option.map (fun scope -> scope.Otel.Trace.trace_id) scope)