svix-webhooks
svix-webhooks copied to clipboard
Remove the duplicated spans in the otel logging
All of the logs are duplicated and show both under span
and under spans
. This is unnecessary and wasteful, we can just keep spans
.
We just need to verify that spans.0 is always equivalent to span
, because if the ordering is reversed it would suck a bit (because it'll be hard to know the top level).
What's the common way of doing it?
Speak with @svix-james too, maybe it's not wanted/needed, though I think it is?
It's not uncommon for logs to include both a top-level field and a field within a nested object, particularly when the nested object is an array. This can provide more context for the log and make it easier to understand.
As for verifying that spans.0
is equivalent to span, you can do this by comparing the two fields in your code. For example, you could use an if
statement to check if spans[0] == span
, and take some action based on the result of this comparison.
Alternatively, you could just use the span
field and ignore the spans
field entirely, if you don't need the additional context provided by the nested object. Ultimately, the approach you take will depend on your specific needs and the structure of your logs.