Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: lazy sampling #3956

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from
Draft
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions lib/datadog/tracing/trace_operation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,23 @@ def resource
@resource || (root_span && root_span.resource)
end

# When retrieving tags or metrics we need to include root span tags for sampling purposes
def get_tag(key)
super || (root_span && root_span.get_tag(key))
end

def get_metric(key)
@metric[key?] || (root_span && root_span.get_metric(key))
end

def tags
all_tags = {}
all_tags.merge(root_span.tags) if root_span
all_tags.merge(@tags)
all_tags.merge(@metrics)
all_tags
end

# Returns true if the resource has been explicitly set
#
# @return [Boolean]
Expand Down