docbrown/app/services/instrumentation.rb
Jamie Gaskins 5a0a46887c
Instrument EmailDigestArticleCollector (#13153)
* Instrument EmailDigestArticleCollector

On DEV, since we skip this with sidekiq-cron and instead process them
inline using Heroku Scheduler (which is not instrumented), we miss out
on all instrumentation for this process and have no idea how long it
takes to process each user.

With this instrumentation in place, we can see how long it takes to
process each user and aggregate them to see how long it takes to process
all users.

This commit also adds an Instrumentation mixin that we can use to
instrument blocks easily:

    instrument "MyClass.my_method", tags: { article: article.id } do |span|
      # ...
    end

* Add Instrumentation mixin

Oops, completely forgot to commit this file
2021-03-29 09:33:32 -04:00

7 lines
259 B
Ruby

module Instrumentation
def instrument(operation, tags: [], &block)
# TODO: (@jgaskins): Extract the knowledge of which tracing library
# we're using, like we did with ForemStatsDriver
Datadog.tracer.trace operation, tags: tags, &block
end
end