scoutapp / scout_apm_elixir

ScoutAPM Elixir Agent. Supports Phoenix and other frameworks.
https://scoutapm.com
Other
36 stars 20 forks source link

Add support for request Context #10

Closed cschneid closed 7 years ago

cschneid commented 7 years ago

The Ruby agent has supported a Context api, where an application can add small snippets of information to a request, which will be saved and displayed in a trace on the web site.

For instance:

admincontroller_index

We should reimplement this in the Elixir agent as well.

Hypothetical api:

ScoutApm.Context.add(%{
  user: "chris@scoutapp.com",
  subscription: :jumbo,
  messages: 1802
})

No nested maps, and the data types would be simple strings, atoms, numbers. (anything else?)

karmajunkie commented 7 years ago

Tuples, lists, and maps would be good to have available as well.

karmajunkie commented 7 years ago

oh, i see you already addressed the maps question—any particular reason to disallow those? Just to prevent overdoing it on stored request data?

itsderek23 commented 7 years ago

oh, i see you already addressed the maps question—any particular reason to disallow those? Just to prevent overdoing it on stored request data?

Good question. Two primary reasons:

  1. Currently our UI only supports top-level keys. We don't handle nested context values.
  2. We're working on a new way to query request data, including filtering by context, called Explorer. This won't support nested values initially.

Expanding a tuple into the parent context (ie: prefixing user keys with user_) seems like an OK workaround. We aren't ruling out additional types in the future.

karmajunkie commented 7 years ago

Ok, good to know, thanks for the update!