spandex-project/spandex

Tags should not be required to be a keyword list, and should support nesting

GregMefford opened this issue · 2 comments

Ultimately, these get encoded back into a map and sent to the collector, so there's no reason to enforce that they be a Keyword list (i.e. atom keys).

For example, it would be nice to be able to include some map of key-value pairs that were decoded from a JSON payload, but you don't want to convert all the keys to atoms. Also in this scenario, it would be nice to be able to have nested maps as values. On a Datadog-specific note: I believe this is possible, but we'd have to traverse the maps and change the names to a flat structure of dot-syntax keys like parent.child.key: value.

Yeah, that makes sense to me. We should be able to change the type of that option to [:map, :keyword], and then add code to handle that change on the sender side. I think we also want to make sure that they all get merged correctly.

I'm pretty sure merging tags is the right answer, at least. I'm pretty confident that it is.

Here is an example of how tags can be used:
tags = %{ "elasticsearch.body" => body, "elasticsearch.method" => "GET", "elasticsearch.endpoint" => endpoint }

This then allows metadata to each span to something like this:
monitor-elasticsearch-datadog-apm-error-stack-trace-v3

(from this article here: https://www.datadoghq.com/blog/monitor-elasticsearch-datadog/)