Skip to content

Commit 7bfd915

Browse files
authored
Merge pull request #508 from newrelic/vince/release-1.33.0
Release version 1.33.0
2 parents 2da9ab4 + 6dca2a1 commit 7bfd915

File tree

4 files changed

+88
-79
lines changed

4 files changed

+88
-79
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
## CHANGELOG
22

3+
### `v1.33.0`
4+
5+
#### Fixes
6+
* Fix unit for Oban queue time attribute [#504](https://github.com/newrelic/elixir_agent/pull/504)
7+
8+
#### Tweaks
9+
* Improve nested attribute flattening [#505](https://github.com/newrelic/elixir_agent/pull/505)
10+
* Support Logger "report" messages in Logs in Context [#506](https://github.com/newrelic/elixir_agent/pull/506)
11+
12+
------
13+
314
### `v1.32.0`
415

516
#### Features

README.md

Lines changed: 56 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[![Hex Docs](https://img.shields.io/badge/hex-docs-blue.svg)](https://hexdocs.pm/new_relic_agent/)
88
[![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://opensource.org/licenses/Apache-2.0)
99

10-
The experimental open-source Elixir agent allows you to monitor your `Elixir` applications with New Relic. It helps you track transactions, distributed traces, other parts of your application's behavior, and provides an overview of underlying [BEAM activity](https://github.com/newrelic/elixir_agent/wiki/BEAM-stats-page).
10+
The experimental open-source Elixir agent allows you to monitor your `Elixir` applications with New Relic. It helps you track transactions, distributed traces, other parts of your application's behavior, and provides an overview of underlying BEAM activity.
1111

1212
[View the Documentation](https://hexdocs.pm/new_relic_agent)
1313

@@ -50,7 +50,7 @@ If using an Elixir version before 1.18.x, please also add `:jason` to your depen
5050

5151
## Configuration
5252

53-
You need to set a few required configuration keys so we can authenticate properly.
53+
You need to set two required configuration keys so we can authenticate properly.
5454

5555
#### Via Application config
5656

@@ -67,18 +67,7 @@ You can also configure these attributes via `ENV` vars, which helps keep secrets
6767
* `NEW_RELIC_APP_NAME`
6868
* `NEW_RELIC_LICENSE_KEY`
6969

70-
#### HTTP Client Settings
71-
72-
`:httpc` client settings can be overridden if needed. For example, the HTTP connect timeout can be increased which can help alleviate errors related to timeouts connecting to New Relic:
73-
74-
```elixir
75-
config :new_relic_agent,
76-
app_name: "My App",
77-
license_key: "license_key",
78-
httpc_request_options: [connect_timeout: 5000]
79-
```
80-
81-
## Telemetry-based Instrumentation
70+
## Telemetry-based auto-instrumentation
8271

8372
Some common Elixir packages are auto-instrumented via [`telemetry`](https://github.com/beam-telemetry/telemetry)
8473

@@ -91,67 +80,39 @@ Some common Elixir packages are auto-instrumented via [`telemetry`](https://gith
9180
* [`Oban`](https://github.com/oban-bg/oban): See [NewRelic.Telemetry.Oban](https://hexdocs.pm/new_relic_agent/NewRelic.Telemetry.Oban.html) for details.
9281
* [`Absinthe`](https://github.com/absinthe-graphql/absinthe): See [NewRelic.Telemetry.Absinthe](https://hexdocs.pm/new_relic_agent/NewRelic.Telemetry.Absinthe.html) for details.
9382

94-
## Agent features
83+
## Opt-In agent features
9584

96-
There are a few agent features that can be enabled via configuration. Please see the documentation for more information.
85+
There are a few advanced agent features that can be enabled via configuration. Please see the documentation for more information.
9786

98-
* [Logs In Context](https://hexdocs.pm/new_relic_agent/NewRelic.Config.html#feature/1-logs-in-context)
99-
* [Infinite Tracing](https://hexdocs.pm/new_relic_agent/NewRelic.Config.html#feature/1-infinite-tracing)
87+
* [Logs In Context](https://hexdocs.pm/new_relic_agent/NewRelic.Config.html#feature/1-logs-in-context) - See your logs in the context of the Transaction / Distributed Trace where they originated.
88+
* [Infinite Tracing](https://hexdocs.pm/new_relic_agent/NewRelic.Config.html#feature/1-infinite-tracing) - Use a New Relic Trace Observer to get tail based sampling of Distributed Traces.
10089
* [Security Controls](https://hexdocs.pm/new_relic_agent/NewRelic.Config.html#feature?/1-security)
10190

102-
## Manual Instrumentation
91+
## Manual instrumentation
10392

104-
#### Transactions
93+
#### Custom Transactions
10594

106-
Transactions are the main unit of work reported to New Relic. `Plug` and `Phoenix` instrumentation automatically report a Web Transaction for each request. `Oban` instrumentation reports an "Other" Transaction for each job. You can also report custom transactions for work done in your app.
95+
Transactions are the main unit of work reported to New Relic. `Plug` and `Phoenix` instrumentation automatically report a Web Transaction for each request. `Oban` instrumentation reports an "Other" Transaction for each job.
10796

108-
These Transactions will propagate to any process spawned and linked (ex: `Task.async`), but will _not_ follow a process that isn't linked (ex: `Task.Supervisor.async_nolink`).
109-
110-
---
111-
112-
To manually connect a Transaction to an unlinked process, you can use `NewRelic.get_transaction` and `NewRelic.connect_to_transaction`. See the docs for those functions for further details.
97+
You may start an Custom "Other" Transaction for work outside auto-instrumented systems. This could used be while consuming from a message queue, for example.
11398

11499
```elixir
115-
tx = NewRelic.get_transaction()
116-
117-
spawn(fn ->
118-
NewRelic.connect_to_transaction(tx)
119-
# ...
120-
end)
121-
```
122-
123-
---
124-
125-
To exclude a process from the Transaction:
100+
defmodule Worker do
101+
use NewRelic.Tracer
126102

127-
```elixir
128-
Task.async(fn ->
129-
NewRelic.exclude_from_transaction()
130-
Work.wont_be_tracked()
131-
end)
103+
def process_messages do
104+
NewRelic.other_transaction("Worker", "ProcessMessages") do
105+
# ...
106+
end
107+
end
108+
end
132109
```
133110

134-
---
111+
#### Transaction propagation
135112

136-
To prevent reporting an individual transaction:
113+
Transactions will propagate to any process spawned and linked (ex: `Task.async`), but will _not_ follow a process that isn't linked (ex: `Task.Supervisor.async_nolink`).
137114

138-
```elixir
139-
NewRelic.ignore_transaction()
140-
```
141-
142-
You can configure some paths to be automatically ignored:
143-
144-
```elixir
145-
config :new_relic_agent,
146-
ignore_paths: [
147-
"/health",
148-
~r/longpoll/
149-
]
150-
```
151-
152-
---
153-
154-
If you are using a `Task` to spawn work, you can use the pre-instrumented `NewRelic.Instrumented.Task` convenience module to make this easier. Just `alias` it in your module and all your Tasks will be instrumented. You may also use the functions directly.
115+
If you are using a `Task.Supervisor.async_nolink` to spawn work, you can use the pre-instrumented `NewRelic.Instrumented.Task` wrapper module to make this easier. Just `alias` it in your module and all your Tasks will be instrumented. You may also use the functions directly.
155116

156117
```elixir
157118
alias NewRelic.Instrumented.Task
@@ -161,25 +122,17 @@ Task.Supervisor.async_nolink(MyTaskSupervisor, fn ->
161122
end)
162123
```
163124

164-
---
125+
For more fine grained control of Transaction propagation, check out the following functions:
165126

166-
You may start an "Other" Transaction for non-HTTP related work. This could used be while consuming from a message queue, for example.
127+
* `NewRelic.exclude_from_transaction/0`
128+
* `NewRelic.ignore_transaction/0`
129+
* `NewRelic.get_transaction/0`
130+
* `NewRelic.connect_to_transaction/1`
131+
* `NewRelic.disconnect_from_transaction/0`
167132

168-
```elixir
169-
defmodule Worker do
170-
use NewRelic.Tracer
133+
#### Function tracing
171134

172-
def process_messages do
173-
NewRelic.other_transaction("Worker", "ProcessMessages") do
174-
# ...
175-
end
176-
end
177-
end
178-
```
179-
180-
#### Function Tracing
181-
182-
`NewRelic.Tracer` enables detailed Function tracing. Annotate a function and it'll show up as a span in Transaction Traces / Distributed Traces, and we'll collect aggregate stats about it. Install it by adding `use NewRelic.Tracer` to any module, and annotating any function with an `@trace` module attribute
135+
`NewRelic.Tracer` enables detailed function tracing. Annotate a function and it'll show up as a span in Transaction Traces / Distributed Traces, and we'll collect aggregate stats about it. Install it by adding `use NewRelic.Tracer` to any module, and annotating any function with an `@trace` module attribute.
183136

184137
```elixir
185138
defmodule MyModule do
@@ -213,7 +166,7 @@ end
213166

214167
#### Distributed Tracing
215168

216-
Requests to other services can be connected with an additional outgoing header.
169+
Incoming Distributed Traces are automatically connected if incoming HTTP requests have trace headers. Requests to other services can be connected with an additional outgoing header.
217170

218171
```elixir
219172
defmodule MyExternalService do
@@ -239,6 +192,31 @@ defmodule Mix.Tasks.Example do
239192
end
240193
```
241194

195+
## Advanced configuration
196+
197+
#### HTTP client settings
198+
199+
`:httpc` client settings can be overridden if needed. For example, the HTTP connect timeout can be increased which can help alleviate errors related to timeouts connecting to New Relic:
200+
201+
```elixir
202+
config :new_relic_agent,
203+
app_name: "My App",
204+
license_key: "license_key",
205+
httpc_request_options: [connect_timeout: 5000]
206+
```
207+
208+
#### Ignore paths
209+
210+
You can configure some paths to be automatically ignored:
211+
212+
```elixir
213+
config :new_relic_agent,
214+
ignore_paths: [
215+
"/health",
216+
~r/longpoll/
217+
]
218+
```
219+
242220
#### Disabling
243221

244222
If you want to disable the agent, you can do it in two different ways:

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.32.0
1+
1.33.0

lib/new_relic.ex

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,15 @@ defmodule NewRelic do
163163

164164
@doc """
165165
Call to exclude the current process from being part of the Transaction.
166+
167+
## Example:
168+
169+
```elixir
170+
Task.async(fn ->
171+
NewRelic.exclude_from_transaction()
172+
Work.wont_be_included()
173+
end)
174+
```
166175
"""
167176
@spec exclude_from_transaction() :: any()
168177
defdelegate exclude_from_transaction(), to: NewRelic.Transaction.Reporter
@@ -186,6 +195,17 @@ defmodule NewRelic do
186195
187196
This connection will persist until the process exits or
188197
`NewRelic.disconnect_from_transaction/0` is called.
198+
199+
## Example:
200+
201+
```elixir
202+
tx = NewRelic.get_transaction()
203+
204+
spawn(fn ->
205+
NewRelic.connect_to_transaction(tx)
206+
# ...
207+
end)
208+
```
189209
"""
190210
@spec connect_to_transaction(tx_ref) :: any()
191211
defdelegate connect_to_transaction(ref), to: NewRelic.Transaction.Reporter

0 commit comments

Comments
 (0)