Add user.roles to the intake
Currently, if I call this:
set_context({"username": "my_username"}, "user")
it does nothing. I'm told that it does nothing because the APM Server intake isn't looking for this field. Maybe add all of the fields listed on this page https://www.elastic.co/guide/en/apm/server/current/exported-fields-ecs.html#_user
I'm using v 6.2.3. This thread has some more information https://discuss.elastic.co/t/in-the-python-elastic-apm-v-6-2-3-library-how-do-i-set-the-user-roles-field/298982
@Robinson664 I'd be interested to hear more about the use case you try to achieve? Trying to avoid adding support for all ecs defined fields without a clear use case, as it mains some maintenance effort .
@simitt do you only support a subset of the ecs fields? I've been assuming that this list https://www.elastic.co/guide/en/apm/server/current/exported-fields-ecs.html is the list of all fields that we could use. We want to be able to monitor activity by different dimensions, including user roles. We want to use standardized ecs fields to do this instead of custom fields. Does that make sense?
Hi @Robinson664 , apologies for the slow response on this. Yes, we currently only support a well defined set, as we want to be intentional about how many data are indexed into Elasticsearch and the maintainance overhead for (potentially unused) fields. Therefore we generally focus on fields that are used by the curated APM UI and offer labels for custom use cases.
I don't generally see a problem with extending the Intake API for user.roles, but cannot make promises when we will be able to get to it, and if this will be supported by all apm agents.
Until then, you can make use of labels, which are indexed and are supported by all apm agents. This way the user.roles are showing up as labels, instead of the ECS default field. I understand this is not what you intended to do, but might be an acceptable solution for you for now, to still cover your use case?