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

Coerce TT segment attributes #316

Merged
merged 2 commits into from Mar 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/new_relic/span/event.ex
Expand Up @@ -72,7 +72,8 @@ defmodule NewRelic.Span.Event do
component: category[:component] || "component",
"span.kind": "client"
})
|> Map.merge(NewRelic.Util.coerce_attributes(custom))
|> NewRelic.Util.coerce_attributes()
|> Map.merge(custom)
end

def merge_category_attributes(%{category: "datastore"} = span, category_attributes) do
Expand All @@ -88,7 +89,8 @@ defmodule NewRelic.Span.Event do
component: category[:component] || "component",
"span.kind": "client"
})
|> Map.merge(NewRelic.Util.coerce_attributes(custom))
|> NewRelic.Util.coerce_attributes()
|> Map.merge(custom)
end

def merge_category_attributes(span, category_attributes),
Expand Down
8 changes: 5 additions & 3 deletions lib/new_relic/transaction/trace.ex
Expand Up @@ -57,17 +57,19 @@ defmodule NewRelic.Transaction.Trace do
duration: duration,
metric_name: metric_name
}) do
attributes = first_segment.attributes |> NewRelic.Util.coerce_attributes()

[
0,
duration,
"ROOT",
first_segment.attributes,
attributes,
[
[
0,
duration,
metric_name,
first_segment.attributes,
attributes,
Enum.map(segments, &format_child_segments/1)
]
]
Expand All @@ -79,7 +81,7 @@ defmodule NewRelic.Transaction.Trace do
segment.relative_start_time,
segment.relative_end_time,
segment.metric_name,
segment.attributes,
segment.attributes |> NewRelic.Util.coerce_attributes(),
Enum.map(segment.children, &format_child_segments/1),
segment.class_name,
segment.method_name
Expand Down