mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-08 03:47:59 -04:00
feat otel.trace: use "otel.error" to influence a span status
This commit is contained in:
parent
461811a2cb
commit
420ad5484e
1 changed files with 6 additions and 1 deletions
|
|
@ -41,6 +41,11 @@ module Well_known = struct
|
|||
data
|
||||
in
|
||||
!kind, data
|
||||
|
||||
(** Key to store an error [Otel.Span.status] with the message.
|
||||
Set ["otrace.error" = "mymsg"] in a span data to set the span's status
|
||||
to [{message="mymsg"; code=Error}]. *)
|
||||
let status_error_key = "otrace.error"
|
||||
end
|
||||
|
||||
open Well_known
|
||||
|
|
@ -145,7 +150,7 @@ module Internal = struct
|
|||
let kind, attrs = otel_attrs_of_otrace_data scope.attrs in
|
||||
|
||||
let status : Span.status =
|
||||
match List.assoc_opt "exception.message" scope.attrs with
|
||||
match List.assoc_opt Well_known.status_error_key scope.attrs with
|
||||
| Some (`String message) -> { message; code = Span.Status_code_error }
|
||||
| _ -> { message = ""; code = Span.Status_code_ok }
|
||||
in
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue