lib/labkit/tracing.rb in gitlab-labkit-0.13.2 vs lib/labkit/tracing.rb in gitlab-labkit-0.13.3
- old
+ new
@@ -26,9 +26,15 @@
def self.tracing_url_template
ENV["GITLAB_TRACING_URL"]
end
+ # Check if the current request is being traced.
+ def self.sampled?
+ context = OpenTracing.active_span&.context
+ context && context.respond_to?(:sampled?) && context.sampled?
+ end
+
def self.stacktrace_operations
@stacktrace_operations ||= Set.new(ENV["GITLAB_TRACING_INCLUDE_STACKTRACE"].to_s.split(",").map(&:strip))
end
def self.tracing_url_enabled?