Commit graph

5 commits

Author SHA1 Message Date
Andrew Newdigate
d022ce8655 Add OpenTracing instrumentation for Action View Render events
This change adds three new instrumentations, driven through rails
notifications: render_template.action_view,
render_collection.action_view and render_partial.action_view.

These can help developers understand why renders are taking a long
time which may in turn help them to improve their performance.
2019-01-30 13:38:19 +02:00
Andrew Newdigate
1b90ffc573 Adds tracing support for ActiveRecord notifications
This change will publish distributed tracing spans related to
SQL ActiveRecord queries. These queries are unbound, so will still
contain parameter substitution strings in place of actual parameter
values.

This ensures that the SQL strings do not need to be scrubbed, since the
values are not included in the SQL.

More details of rails instrumentation can be found here:
https://guides.rubyonrails.org/active_support_instrumentation.html
2019-01-24 13:11:09 +02:00
Andrew Newdigate
ca464b6033 Adds inter-service OpenTracing propagation
This change allows the GitLab rails and sidekiq components to receive
tracing spans from upstream services such as Workhorse and pass these
spans on to downstream services including Gitaly and Sidekiq.

This change will also emit traces for incoming and outgoing requests
using the propagated trace information. This will allow operators and
engineers to view traces across the Workhorse, GitLab Rails, Sidekiq and
Gitaly components.

Additional intra-service instrumentation will be added in future
changes.
2019-01-22 18:15:30 +02:00
Andrew Newdigate
625bdc5ade Avoid overwriting default jaeger values with nil
During the review process for adding opentracing factories, a bug was
introduced which caused Jaeger to initialize an invalid tracer. The
bug was due to use sending nil through as a kwarg when the Jaeger
initializer used a non-nil default value.

This is fairly insidious as, the tracer looks like a tracer, but, when
methods are invoked, it throws `NoMethodError` errors. To ensure that
this issue does not happen in future, the tests have been changed to
ensure that the tracer works as expected. This could avoid problems
in future when upgrading to newer versions of Jaeger.
2019-01-18 13:05:15 +02:00
Andrew Newdigate
57a8859a11 Conditionally initialize the global opentracing tracer
This change will instantiate an OpenTracing tracer and configure it
as the global tracer when the GITLAB_TRACING environment variable is
configured. GITLAB_TRACING takes a "connection string"-like value,
encapsulating the driver (eg jaeger, etc) and options for the driver.

Since each service, whether it's written in Ruby or Golang, uses the
same connection-string, it should be very easy to configure all
services in a cluster, or even a single development machine to be
setup to use tracing.

Note that this change does not include instrumentation or propagation
changes as this is a way of breaking a previous larger change into
components. The instrumentation and propagation changes will follow
in separate changes.
2019-01-17 12:32:44 +02:00