question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Align Custom context API with other agents and add documentation

See original GitHub issue

We 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: screen shot 2018-10-03 at 10 29 54

So, tasks are:

  • Decide on a final API

  • Implement

  • Document

  • Notify @formgeist

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
formgeistcommented, Oct 4, 2018

@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.

0reactions
felixbarnycommented, Oct 29, 2018

Discussion about whether to deprecate custom context is carried on here: https://github.com/elastic/apm/issues/7.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deprecating custom context in favor of tags · Issue #7 - GitHub
We offer custom context and tags in most agent APIs. ... Align Custom context API with other agents and add documentation ...
Read more >
Context API - TetraScience
Context API provides properties and functions that allow you to read and write files and more. ... custom_metadata: custom metadata of the document...
Read more >
Using React Context for state management in Next.js - Netlify
Ever wondered how you should manage state information across your Next.js applications without installing anything extra? Look no further!
Read more >
Using React Context API with Gatsby
Gatsby is a React-based open source framework with performance, scalability and security built-in. Collaborate, build and deploy 1000x ...
Read more >
How to Work with the React Context API - Toptal
Let's refactor the app and demonstrate what it can do. In a few words, the Context API allows you to have a central...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found