changed
CHANGELOG.md
|
@@ -1,6 1,14 @@
|
1
1
|
## CHANGELOG
|
2
2
|
|
3
3
|
|
4
|
### `v1.14.0`
|
5
|
|
6
|
Features
|
7
|
|
8
|
* Minor internal refactor to enable reporting spans after they complete. [#160](https://github.com/newrelic/elixir_agent/pull/160)
|
9
|
|
10
|
------
|
11
|
|
4
12
|
### `v1.13.1`
|
5
13
|
|
6
14
|
Fixes
|
changed
VERSION
|
@@ -1 1 @@
|
1
|
- 1.13.1
|
1
|
1.14.0
|
changed
hex_metadata.config
|
@@ -73,7 73,6 @@
|
73
73
|
<<"lib/new_relic/error/reporter.ex">>,
|
74
74
|
<<"lib/new_relic/error/logger_handler.ex">>,
|
75
75
|
<<"lib/new_relic/error/event.ex">>,<<"lib/new_relic/error/trace.ex">>,
|
76
|
- <<"lib/new_relic/error/error_logger_handler.ex">>,
|
77
76
|
<<"lib/new_relic/enabled_supervisor.ex">>,<<"lib/new_relic.ex">>,<<"priv">>,
|
78
77
|
<<"priv/cacert.pem">>,<<"mix.exs">>,<<"README.md">>,<<"CHANGELOG.md">>,
|
79
78
|
<<"VERSION">>]}.
|
|
@@ -96,4 95,4 @@
|
96
95
|
{<<"optional">>,false},
|
97
96
|
{<<"repository">>,<<"hexpm">>},
|
98
97
|
{<<"requirement">>,<<"~> 1.1">>}]]}.
|
99
|
- {<<"version">>,<<"1.13.1">>}.
|
98
|
{<<"version">>,<<"1.14.0">>}.
|
removed
lib/new_relic/error/error_logger_handler.ex
|
@@ -1,45 0,0 @@
|
1
|
- defmodule NewRelic.Error.ErrorLoggerHandler do
|
2
|
- @behaviour :gen_event
|
3
|
- @moduledoc false
|
4
|
-
|
5
|
- # http://erlang.org/doc/man/error_logger.html
|
6
|
-
|
7
|
- def add_handler() do
|
8
|
- :error_logger.delete_report_handler(NewRelic.Error.ErrorLoggerHandler)
|
9
|
- :error_logger.add_report_handler(NewRelic.Error.ErrorLoggerHandler)
|
10
|
- end
|
11
|
-
|
12
|
- def remove_handler() do
|
13
|
- :error_logger.delete_report_handler(NewRelic.Error.ErrorLoggerHandler)
|
14
|
- end
|
15
|
-
|
16
|
- def init(args) do
|
17
|
- NewRelic.sample_process()
|
18
|
- {:ok, args}
|
19
|
- end
|
20
|
-
|
21
|
- def handle_info(_msg, state), do: {:ok, state}
|
22
|
- def handle_call(request, _state), do: exit({:bad_call, request})
|
23
|
- def code_change(_old_vsn, state, _extra), do: {:ok, state}
|
24
|
- def terminate(_reason, _state), do: :ok
|
25
|
-
|
26
|
- def handle_event({_type, gl, _report}, state)
|
27
|
- when node(gl) != node() do
|
28
|
- {:ok, state}
|
29
|
- end
|
30
|
-
|
31
|
- def handle_event({:error_report, _gl, {pid, :crash_report, [report | _]}}, state)
|
32
|
- when is_list(report) do
|
33
|
- if NewRelic.Transaction.Reporter.tracking?(pid) do
|
34
|
- NewRelic.Error.Reporter.report_error(:transaction, report)
|
35
|
- else
|
36
|
- Task.Supervisor.start_child(NewRelic.Error.TaskSupervisor, fn ->
|
37
|
- NewRelic.Error.Reporter.report_error(:process, report)
|
38
|
- end)
|
39
|
- end
|
40
|
-
|
41
|
- {:ok, state}
|
42
|
- end
|
43
|
-
|
44
|
- def handle_event(_, state), do: {:ok, state}
|
45
|
- end
|
changed
lib/new_relic/error/supervisor.ex
|
@@ -22,9 22,9 @@ defmodule NewRelic.Error.Supervisor do
|
22
22
|
supervise(children, strategy: :one_for_one)
|
23
23
|
end
|
24
24
|
|
25
|
- def add_handler(), do: apply(logger_module(), :add_handler, [])
|
26
|
- def remove_handler(), do: apply(logger_module(), :remove_handler, [])
|
25
|
def add_handler(),
|
26
|
do: NewRelic.Error.LoggerHandler.add_handler()
|
27
27
|
|
28
|
- def logger_module(),
|
29
|
- do: (Process.whereis(:logger) && Error.LoggerHandler) || Error.ErrorLoggerHandler
|
28
|
def remove_handler(),
|
29
|
do: NewRelic.Error.LoggerHandler.remove_handler()
|
30
30
|
end
|
changed
lib/new_relic/transaction/complete.ex
|
@@ -14,6 14,7 @@ defmodule NewRelic.Transaction.Complete do
|
14
14
|
tx_attrs
|
15
15
|
|> transform_name_attrs
|
16
16
|
|> transform_time_attrs
|
17
|
|> transform_queue_duration
|
17
18
|
|> extract_transaction_info(pid)
|
18
19
|
|
19
20
|
report_transaction_event(tx_attrs)
|
|
@@ -56,11 57,14 @@ defmodule NewRelic.Transaction.Complete do
|
56
57
|
duration_ms: duration_ms,
|
57
58
|
duration_s: duration_ms / 1000
|
58
59
|
})
|
59
|
- |> add_queue_duration(start_time)
|
60
60
|
end
|
61
61
|
|
62
|
- defp add_queue_duration(%{request_start_s: request_start_s} = tx, start_time) do
|
63
|
- start_time_s = System.convert_time_unit(start_time, :native, :microsecond) / 1_000_000
|
62
|
defp transform_time_attrs(%{start_time: _, end_time: _} = tx) do
|
63
|
tx
|
64
|
end
|
65
|
|
66
|
defp transform_queue_duration(%{request_start_s: request_start_s, start_time: start_time} = tx) do
|
67
|
start_time_s = start_time / 1000.0
|
64
68
|
queue_duration = max(0, start_time_s - request_start_s)
|
65
69
|
|
66
70
|
tx
|
|
@@ -68,7 72,7 @@ defmodule NewRelic.Transaction.Complete do
|
68
72
|
|> Map.put(:queueDuration, queue_duration)
|
69
73
|
end
|
70
74
|
|
71
|
- defp add_queue_duration(tx, _), do: tx
|
75
|
defp transform_queue_duration(tx), do: tx
|
72
76
|
|
73
77
|
defp extract_transaction_info(tx_attrs, pid) do
|
74
78
|
{function_segments, tx_attrs} = Map.pop(tx_attrs, :trace_function_segments, [])
|
|
@@ -228,7 232,7 @@ defmodule NewRelic.Transaction.Complete do
|
228
232
|
|> Map.merge(%{
|
229
233
|
class_name: class_name,
|
230
234
|
method_name: nil,
|
231
|
- metric_name: metric_name |> String.replace("/", ""),
|
235
|
metric_name: metric_name,
|
232
236
|
attributes: attributes
|
233
237
|
})
|
234
238
|
end
|