mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-08 20:07:55 -04:00
finally redact these logs
This commit is contained in:
parent
ae92077389
commit
7b5b451b2c
2 changed files with 11 additions and 12 deletions
|
|
@ -1,17 +1,6 @@
|
|||
{ resource =
|
||||
Some(
|
||||
{ attributes =
|
||||
[{ key = "service.namespace";
|
||||
value = Some(String_value("ocaml-otel.test"));
|
||||
};
|
||||
{ key = "service.name"; value = Some(String_value("emit_logs")); };
|
||||
{ key = "process.runtime.version";
|
||||
value = Some(String_value("5.3.0"));
|
||||
};
|
||||
{ key = "process.runtime.name";
|
||||
value = Some(String_value("ocaml"));
|
||||
}
|
||||
];
|
||||
{ attributes = [];
|
||||
dropped_attributes_count = 0 (* absent *);
|
||||
entity_refs = [];
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
module Client = Opentelemetry_client
|
||||
module L = Opentelemetry_proto.Logs
|
||||
module Res = Opentelemetry_proto.Resource
|
||||
|
||||
(* NOTE: This port must be different from that used by other integration tests,
|
||||
to prevent socket binding clashes. *)
|
||||
|
|
@ -18,6 +19,14 @@ let tests (signal_batches : Client.Resource_signal.t list) =
|
|||
| Logs ls ->
|
||||
ls (* Mask out the times so tests don't change in between runs *)
|
||||
|> List.map (fun (l : L.resource_logs) ->
|
||||
let masked_resource =
|
||||
l.resource
|
||||
|> Option.map (fun (r : Res.resource) ->
|
||||
let r = Res.copy_resource r in
|
||||
(* just remove the metadata... *)
|
||||
Res.resource_set_attributes r [];
|
||||
r)
|
||||
in
|
||||
let masked_scope_logs =
|
||||
List.map
|
||||
(fun (sl : L.scope_logs) ->
|
||||
|
|
@ -40,6 +49,7 @@ let tests (signal_batches : Client.Resource_signal.t list) =
|
|||
in
|
||||
let l = L.copy_resource_logs l in
|
||||
L.resource_logs_set_scope_logs l masked_scope_logs;
|
||||
Option.iter (L.resource_logs_set_resource l) masked_resource;
|
||||
l)
|
||||
|> List.iter (Format.printf "%a\n" L.pp_resource_logs)
|
||||
| _ -> ())
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue