New Relic agent developer mode vs. local mock collector for integration tests without production credentials
0 reputation · 27 Sept 2026, 01:45 UTC
0 reputation · 27 Sept 2026, 01:45 UTC
I want to run an integration test suite that exercises a New Relic language agent's instrumentation hooks against a test application, without using a real license key and without any data reaching a live New Relic account.
Two documented approaches seem possible: enabling the agent's developer mode (via developer_mode: true in the config or the NEW_RELIC_DEVELOPER_MODE environment variable), which initializes the agent but discards metric data locally, or pointing the agent at a local mock collector by overriding the host and port and capturing the payloads with a stub server.
The unresolved decision is which approach gives reliable verification. Developer mode appears to only confirm data was discarded, while a mock collector would let me inspect actual payload structure — but introduces the risk of misconfigured networking leaking traffic to the real collector endpoint. I am also unsure whether developer mode behaves identically across agent versions, since some older agents reportedly reject placeholder license keys and fail to start.
Specifically:
collector.newrelic.com occurs if the stub is unreachable?35275 reputation · 27 Sept 2026, 13:33 UTC
Choose developer mode when you only need to verify that the agent’s instrumentation hooks are exercised and that no data is sent; choose a local mock collector when you must inspect the exact payload (headers, JSON/MsgPack body) to assert on metric or event structure.
Developer mode initializes the agent, runs the normal metric collection and serialization pipeline, then discards the payload before transmission. This means the serialization code path is exercised, but older agents may short‑circuit or reject a placeholder license key, so the behavior is not uniform across versions. A mock collector receives the full payload, letting you verify structure, but you must prevent any fallback to the real collector.
developer_mode: true or NEW_RELIC_DEVELOPER_MODE=1) initializes instrumentation and typically runs the full payload serialization path; data is dropped locally.127.0.0.1 captures the exact payload; setting the agent’s host to 127.0.0.1 and providing any non‑empty license key prevents the agent from attempting the default collector.newrelic.com endpoint.developer_mode: true in the agent config or export NEW_RELIC_DEVELOPER_MODE=1.license_key (required for agents that validate the key).netstat -tunp or tcpdump to verify no outbound traffic to collector.newrelic.com.127.0.0.1: that records incoming requests.host: 127.0.0.1port: <port>license_key: dummy (any non‑empty value)ssl: false (if the agent permits disabling TLS for the custom host)collector.newrelic.com.| Agent | Log line indicating developer mode or custom host |
|---|---|
| Java | New Relic Agent started in developer mode or Connecting to collector at 127.0.0.1: |
| Node.js | New Relic agent started in developer mode |
| Python | Developer mode enabled |
| Go | Starting agent in developer mode |
| .NET | New Relic Agent started in developer mode |
| Ruby | New Relic agent started in developer mode |
| PHP | New Relic agent started in developer mode |
To be certain that developer mode will not fail due to license‑key validation, please confirm the specific New Relic language agent and its version you are using. If it is a pre‑2020 release, you may need to provide a valid‑looking license key or switch to the mock collector approach.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.