Align Custom context API with other agents and add documentation
See original GitHub issueWe have the custom context implemented for Transactions only, and as a key-value map. I looked at the Node agent and the Python agent documentation and it seems we are not fully aligned, both in the type of data we expect there and in the way it is accessible.
Currently, one would have to use transaction.getContext().getCustom()
in order to access it through the public API. This doesn’t seem like the API we would like to expose, maybe transaction.setCustomContext()
or something like that would be cleaner. Both Node and Python agents expose this through the main Agent API, which is corresponding to Java agent exposing it through ElasticApm.setCustomContext()
. The latter makes sense because it means it is relevant to anything being traced at the moment, either a Transaction or an Error, but it may complicate stuff for us a bit due to the way we implement that.
As data, Node agent allows any Object that can be serilized into JSON, and the Python agent allows a flat dictionary. Current implementation of key-value pair is like Python agent, but I am not sure what the difference is between that and the tags…
Anyway, once it is exposed the way we want it to, this needs to be also documented and then we need to notify someone from the UI team so that this documentation will be referenced from the UI, like the following:
So, tasks are:
-
Decide on a final API
-
Implement
-
Document
-
Notify @formgeist
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (7 by maintainers)
Top GitHub Comments
@eyalkoren for now I think at least adding links to the user and tags references is fine. Sounds like there’s a bigger overhaul to be done if we’re moving away from custom context and pushing the tags option more. If tags are made more useful by allowing numbers and booleans, and it means we can move the custom object in the next big version (7.0?) than I’m all for that. The less confusion for us and for the customer if there’s a single place to put custom data and let that be searchable as well.
Discussion about whether to deprecate custom context is carried on here: https://github.com/elastic/apm/issues/7.