changed CHANGELOG.md
 
@@ -1,5 1,10 @@
1
1
## CHANGELOG
2
2
3
### `v1.26.0`
4
5
Features
6
* Increase timestamp resolution. [#343](https://github.com/newrelic/elixir_agent/pull/343)
7
3
8
### `v1.25.3`
4
9
5
10
Fixes
changed VERSION
 
@@ -1 1 @@
1
- 1.25.3
1
1.26.0
changed hex_metadata.config
 
@@ -158,4 158,4 @@
158
158
{<<"optional">>,true},
159
159
{<<"repository">>,<<"hexpm">>},
160
160
{<<"requirement">>,<<">= 0.11.0">>}]]}.
161
- {<<"version">>,<<"1.25.3">>}.
161
{<<"version">>,<<"1.26.0">>}.
changed lib/new_relic/harvest/collector/metric/harvester.ex
 
@@ -152,8 152,8 @@ defmodule NewRelic.Harvest.Collector.Metric.Harvester do
152
152
defp get(counter, index), do: :counters.get(counter, index)
153
153
154
154
# counters store integers, so we encode values
155
- # into integers keeping 3 decimal places of precision
156
- @precision 1_000
155
# into integers keeping 4 decimal places of precision
156
@precision 10_000
157
157
@compile {:inline, encode: 1, decode: 1}
158
158
defp encode(val), do: round(val * @precision)
159
159
defp decode(val), do: val / @precision
changed lib/new_relic/telemetry/ecto/handler.ex
 
@@ -9,7 9,7 @@ defmodule NewRelic.Telemetry.Ecto.Handler do
9
9
%{type: :ecto_sql_query, repo: repo} = metadata,
10
10
config
11
11
) do
12
- end_time = System.system_time(:millisecond)
12
end_time = System.system_time(:microsecond) / 1000
13
13
14
14
duration_ms = total_time |> to_ms
15
15
duration_s = duration_ms / 1000
 
@@ -100,7 100,7 @@ defmodule NewRelic.Telemetry.Ecto.Handler do
100
100
end
101
101
102
102
defp to_ms(nil), do: nil
103
- defp to_ms(ns), do: System.convert_time_unit(ns, :nanosecond, :millisecond)
103
defp to_ms(ns), do: System.convert_time_unit(ns, :nanosecond, :microsecond) / 1000
104
104
105
105
defp maybe_add(map, _, nil), do: map
106
106
defp maybe_add(map, key, value), do: Map.put(map, key, value)
changed lib/new_relic/telemetry/plug.ex
 
@@ -213,7 213,7 @@ defmodule NewRelic.Telemetry.Plug do
213
213
end
214
214
215
215
defp to_ms(duration),
216
- do: System.convert_time_unit(duration, :native, :millisecond)
216
do: System.convert_time_unit(duration, :native, :microsecond) / 1000
217
217
218
218
@request_start_header "x-request-start"
219
219
defp maybe_report_queueing(meta) do
changed lib/new_relic/telemetry/redix.ex
 
@@ -90,8 90,8 @@ defmodule NewRelic.Telemetry.Redix do
90
90
%{commands: commands} = meta,
91
91
config
92
92
) do
93
- end_time_ms = System.system_time(:millisecond)
94
- duration_ms = System.convert_time_unit(duration, :native, :millisecond)
93
end_time_ms = System.system_time(:microsecond) / 1000
94
duration_ms = System.convert_time_unit(duration, :native, :microsecond) / 1000
95
95
duration_s = duration_ms / 1000
96
96
start_time_ms = end_time_ms - duration_ms
changed lib/new_relic/tracer/macro.ex
 
@@ -214,7 214,7 @@ defmodule NewRelic.Tracer.Macro do
214
214
end
215
215
216
216
duration_ms =
217
- System.convert_time_unit(end_time_mono - start_time_mono, :native, :millisecond)
217
System.convert_time_unit(end_time_mono - start_time_mono, :native, :microsecond) / 1000
218
218
219
219
duration_acc = Process.get({:nr_duration_acc, parent_ref}, 0)
220
220
Process.put({:nr_duration_acc, parent_ref}, duration_acc duration_ms)
changed lib/new_relic/tracer/report.ex
 
@@ -218,7 218,7 @@ defmodule NewRelic.Tracer.Report do
218
218
end
219
219
220
220
defp duration_ms(start_time_mono, end_time_mono),
221
- do: System.convert_time_unit(end_time_mono - start_time_mono, :native, :millisecond)
221
do: System.convert_time_unit(end_time_mono - start_time_mono, :native, :microsecond) / 1000
222
222
223
223
defp function_name({m, f}, f), do: "#{inspect(m)}.#{f}"
224
224
defp function_name({m, f}, i), do: "#{inspect(m)}.#{f}:#{i}"
changed lib/new_relic/transaction/complete.ex
 
@@ -43,7 43,8 @@ defmodule NewRelic.Transaction.Complete do
43
43
defp transform_time_attrs(%{system_time: system_time, duration: duration} = tx) do
44
44
start_time_ms = System.convert_time_unit(system_time, :native, :millisecond)
45
45
duration_us = System.convert_time_unit(duration, :native, :microsecond)
46
- duration_ms = System.convert_time_unit(duration, :native, :millisecond)
46
duration_ms = duration_us / 1000
47
duration_s = duration_ms / 1000
47
48
48
49
tx
49
50
|> Map.drop([:system_time, :duration, :end_time_mono])
 
@@ -52,7 53,7 @@ defmodule NewRelic.Transaction.Complete do
52
53
end_time: start_time_ms duration_ms,
53
54
duration_us: duration_us,
54
55
duration_ms: duration_ms,
55
- duration_s: duration_ms / 1000
56
duration_s: duration_s
56
57
})
57
58
end
58
59
 
@@ -62,7 63,8 @@ defmodule NewRelic.Transaction.Complete do
62
63
) do
63
64
start_time_ms = System.convert_time_unit(start_time, :native, :millisecond)
64
65
duration_us = System.convert_time_unit(end_time_mono - start_time_mono, :native, :microsecond)
65
- duration_ms = System.convert_time_unit(end_time_mono - start_time_mono, :native, :millisecond)
66
duration_ms = duration_us / 1000
67
duration_s = duration_ms / 1000
66
68
67
69
tx
68
70
|> Map.drop([:start_time_mono, :end_time_mono])
 
@@ -71,7 73,7 @@ defmodule NewRelic.Transaction.Complete do
71
73
end_time: start_time_ms duration_ms,
72
74
duration_us: duration_us,
73
75
duration_ms: duration_ms,
74
- duration_s: duration_ms / 1000
76
duration_s: duration_s
75
77
})
76
78
end