Ave,
on the #ash_framework on slack we have discussed potential extension of the otel support to automatically populate the attributes with useful information.
I am currently using GitHub - am-kantox/telemetria: The helper application that simplifies and standardizes telemetry usage which allows you to automatically generate otel traces. It does also populate attributes with with args and result of the function call. Maybe similar approach could be added to ash? The “public?” flag looks like a decent point to start? A fellow user mentioned that it might pose issues when very big blobs are the arguments. Maybe it could be somewhat configurable? Maybe skip relationships?
I would like to open discussion on this matter in the thread. I would be happy to make a contribution if we reach an agreement.
So the first step is likely to modify opentelemetry_ash to look for a configuration variable for what metadata from the action call to add as attributes. It should likely configure an MFA for example that takes the metadata and returns attributes for the span. Then we can just make sure that there is enough info in the metadata to log whatever you want (not sure if we pass the changeset or not for example, but there is no reason we can’t add it )
It was me who suggested he posted here so we could discuss what dsl we should strive to implement and contribute back to opentelemetry_ash since it is extremely barebones for now
Some lose thoughts:
annotation on action? Is it possible to add action modifiers so we can do something like trace [:attrfoo,:attrbaror trace fn context -> … or trace_name «not_the_action_name»
Resource level dsl doing the above, but more in the style of field_names from AshGraphql
Domain level (or top level config) that lets you configure the name patterns (domain.resource.actionName etc)
I am looking for guidance from @zachdaniel on best practices too.
We could support a DSL option that configures metadata reported to any given tracer yes. And potentially at the domain/resource/action level. However it would likely need to be more advanced than a list of fields. Probably a function of the changeset/query/action input in question.