changed CHANGELOG.md
 
@@ -1,5 1,11 @@
1
1
## CHANGELOG
2
2
3
### `v1.17.1`
4
5
Fixes
6
7
* Handle cases where another New Relic agent sends a bad `tracestate` header. [#206](https://github.com/newrelic/elixir_agent/pull/206)
8
3
9
### `v1.17.0`
4
10
5
11
Features
changed VERSION
 
@@ -1 1 @@
1
- 1.17.0
1
1.17.1
changed hex_metadata.config
 
@@ -116,4 116,4 @@
116
116
{<<"optional">>,true},
117
117
{<<"repository">>,<<"hexpm">>},
118
118
{<<"requirement">>,<<"~> 3.3">>}]]}.
119
- {<<"version">>,<<"1.17.0">>}.
119
{<<"version">>,<<"1.17.1">>}.
changed lib/new_relic/distributed_trace/w3c_trace_context/trace_state.ex
 
@@ -116,38 116,58 @@ defmodule NewRelic.DistributedTrace.W3CTraceContext.TraceState do
116
116
decode_member(vendor_type(key), key, value)
117
117
end
118
118
119
- defp decode_member(:new_relic, key, value) do
120
- [
121
- version,
122
- parent_type,
123
- account_id,
124
- app_id,
125
- span_id,
126
- transaction_id,
127
- sampled,
128
- priority,
129
- timestamp
130
- ] = String.split(value, "-")
119
@version_0 "0-"
120
@version_0_range 1..8
131
121
132
- [trusted_account_key, _] = String.split(key, "@")
133
-
134
- [
135
- %{
136
- key: :new_relic,
137
- value: %__MODULE__.NewRelicState{
138
- trusted_account_key: trusted_account_key,
139
- version: version |> String.to_integer(),
140
- parent_type: parent_type |> decode_type(),
141
- account_id: account_id,
142
- app_id: app_id,
143
- span_id: span_id,
144
- transaction_id: transaction_id,
145
- sampled: sampled |> decode_sampled(),
146
- priority: priority |> decode_priority(),
147
- timestamp: timestamp |> String.to_integer()
122
defp decode_member(:new_relic, key, @version_0 <> _ = value) do
123
with [
124
"0",
125
parent_type,
126
account_id,
127
app_id,
128
span_id,
129
transaction_id,
130
sampled,
131
priority,
132
timestamp
133
] <- String.split(value, "-"),
134
[
135
trusted_account_key,
136
_
137
] <- String.split(key, "@") do
138
[
139
%{
140
key: :new_relic,
141
value: %__MODULE__.NewRelicState{
142
trusted_account_key: trusted_account_key,
143
version: 0,
144
parent_type: parent_type |> decode_type(),
145
account_id: account_id,
146
app_id: app_id,
147
span_id: span_id,
148
transaction_id: transaction_id,
149
sampled: sampled |> decode_sampled(),
150
priority: priority |> decode_priority(),
151
timestamp: timestamp |> String.to_integer()
152
}
148
153
}
149
- }
150
- ]
154
]
155
else
156
_ ->
157
NewRelic.log(:debug, "Bad W3C NR tracestate: `#{key}`: `#{value}`")
158
[]
159
end
160
end
161
162
# Future versions can have more elements, but meaning of existing fields won't change
163
defp decode_member(:new_relic, key, future_value) do
164
version_0_value =
165
future_value
166
|> String.split("-")
167
|> Enum.slice(@version_0_range)
168
|> Enum.join("-")
169
170
decode_member(:new_relic, key, @version_0 <> version_0_value)
151
171
end
152
172
153
173
defp decode_member(:other, key, value) do
changed lib/new_relic/telemetry/ecto.ex
 
@@ -4,7 4,10 @@ defmodule NewRelic.Telemetry.Ecto do
4
4
@moduledoc """
5
5
`NewRelic.Telemetry.Ecto` provides `Ecto` instrumentation via `telemetry`.
6
6
7
- Repos are auto-discovered and instrumented. We automatically gather:
7
Repos are auto-discovered and instrumented. Make sure your Ecto app depends
8
on `new_relic_agent` so that the agent can detect when your Repos start.
9
10
We automatically gather:
8
11
9
12
* Datastore metrics
10
13
* Transaction Trace segments