Allow for ddtrace users to configure custom tags for events that ship with the library
P.S I'm using this entry on the contribution guidelines as a template
Datadog has a set of integrations that instrument an event coming out of an application. Like for example an sql query:

However the spans managed in a trace for an existing integration do not allow for custom tagging.
With the ability to configure custom tags for those existing integrations, teams can classify particular events. Giving the users an end result that looks like this:

In this example we are classifying SQL queries by a team of "owners" in a large codebase
An external API would look something like this:
Datadog.configure do |c|
c.on_event("sql.query") do |span|
span.set_tag("two", 1 + 1)
end
end
Using lambdas give users the flexibility to compute the value of tags on the fly 馃槃
馃憢 @mariogintili, thank you for your feature suggestion.
In an integration where application code is invoked while ddtrace has an open span, it is possible to augment the current span using Datadog.tracer.active_span. For example: during the execution of #perform on a Sidekiq job, it is possible to modify the active sidekiq.job span by acquiring its reference from Datadog.tracer.active_span. This is a narrow scope, and it doesn't address the use case you suggest, where there's not application callback with the open span instance.
In the specific case of activerecord, there's the ability to configure integration-level settings on a per-database level. But currently the only relevant field to be overwritten is service_name, and that forces queries to be separated into distinct services in the backend and UI, which might not be what you are looking for.
We have plans to revamp the internals of ddtrace to allow for span creation and completion to behave similar to events (e.g. _"start span postgres.query"_, _"finish span postgres.query"_). With this model, it would be possible to expose a subscription mechanism that would allow one to subscribe to postgres.query events and do as they please with the relevant span instance.
I'll keep you suggestion open to ensure we have cover you use case when we start working the internal changes necessary.
Depending on how much context is needed in order to set the tag, you may be able to use a Processor to post-process the trace and add the necessary tags: https://github.com/DataDog/dd-trace-rb/blob/master/docs/GettingStarted.md#processing-pipeline
Thanks - I believe we've patched this internally in our team. Will leave the issue open in case someone else finds this conversation useful 馃尀
Most helpful comment
Depending on how much context is needed in order to set the tag, you may be able to use a Processor to post-process the trace and add the necessary tags: https://github.com/DataDog/dd-trace-rb/blob/master/docs/GettingStarted.md#processing-pipeline