Skip to content
CAI
Software that uses CAICheck a score

newrelic/elixir_agent

60.2

Adequate · 15 November 2026

10.3k

lines of production code

Elixir

primary language

5

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Features

Add Ecto SQL telemetry instrumentation

New files in lib/new\_relic/telemetry/ecto introduce support for tracking Ecto database operations. The handler captures query metrics (duration, queue time, decode time) and reports them as datastore spans and metrics, including SQL statements, table names, and operations. The metadata module parses queries to identify the database adapter (Postgres, MySQL, or generic Ecto adapters) and extracts table names and operations from SELECT, INSERT, UPDATE, DELETE, and CREATE TABLE statements. The supervisor detects Ecto repos via the :ecto.repo.init event and starts child processes to handle telemetry for each repo.

_lib/new\relic/telemetry/ecto · high confidence

Add Ecto example app with multi-database support

The Ecto example application now includes a complete setup supporting PostgreSQL, MySQL, and SQLite3. The application initializes and migrates all three repositories on startup, and the HTTP router exercises error handling, counting, streaming, and deletion operations across each database adapter to demonstrate multi-adapter compatibility.

_examples/apps/ecto\example/lib · high confidence

Add Erlang VM and application process sampling

The agent now includes a new sampler subsystem that periodically collects metrics from the Erlang runtime and monitored processes. The Beam sampler reports memory usage (total, processes, ETS, atoms, binary, code), garbage collection counts, I/O bytes, reductions, run queue lengths, scheduler utilization, and CPU utilization. The ETS sampler tracks the size and memory consumption of named ETS tables. The Process sampler monitors specific registered processes for memory, message queue length, and reductions. Additionally, the TopProcess sampler identifies the top processes by memory and message queue activity. These samples are reported as custom events to New Relic.

_lib/new\relic/sampler · high confidence

Add Oban example app for distributed tracing

An example application demonstrating auto-instrumentation of Oban, specifically showing how to connect a job to the Distributed Trace that enqueued it using \NewRelic.accept\_distributed\_trace\_headers/1\.

_examples/apps/oban\example · high confidence

Add Oban example application with distributed tracing support

An example application demonstrating Oban job processing has been added, featuring a worker that integrates with New Relic by accepting distributed trace headers from job metadata. The application is configured to use PostgreSQL-based notifiers and inline testing mode, providing a reference implementation for users looking to set up Oban with distributed tracing capabilities.

_examples/apps/oban\example/lib · high confidence

Add Redix example app and local development infrastructure

Users can now run a new Redix example application that demonstrates auto-instrumentation of a Redis database. To facilitate local testing and development, the examples directory now includes a docker-compose.yml file that spins up PostgreSQL, MySQL, and Redis services, along with updated README documentation and standard Elixir project configuration files (.formatter.exs, .gitignore) for the example apps.

examples · high confidence

Add Redix example application with HTTP endpoints

Introduces a new example application that demonstrates Redix usage via a Plug/Phoenix HTTP interface. The app starts a Redix connection with synchronous connection enabled and exposes endpoints to execute Redis commands, including setting and getting keys, running pipelines, and managing connections by PID.

_examples/apps/redix\example/lib · high confidence

Add W3C Trace Context Validation Service example app

A new example application, W3cTraceContextValidation, has been added to demonstrate W3C Trace Context validation. The app runs an HTTP server on port 4002 and exposes a POST /test endpoint that accepts validation directions, forwards them to specified URLs, and integrates with New Relic distributed tracing via the NewRelic.Tracer and NewRelic.distributed\_trace\_headers libraries.

_examples/apps/w3c\_trace\_context\validation · high confidence

Add W3C Trace Context support for distributed tracing

The library now implements parsing and encoding for the W3C Trace Context \traceparent\ and \tracestate\ headers. This enables interoperability with other services that follow the W3C standard, allowing trace context to be propagated correctly across service boundaries. The implementation includes validation for header formats and handles New Relic-specific state within the tracestate header.

_lib/new\_relic/distributed\_trace/w3c\_trace\context · high confidence

Add example app demonstrating Mix.Task instrumentation and graceful degradation

This change introduces the \instrumented\_task\ example application, which serves as a reference for instrumenting Mix tasks. It includes an \InstrumentedTask\ that uses \NewRelic.Instrumented.Mix.Task\ to enable monitoring, and an \UninstrumentedTask\ that explicitly calls \NewRelic.report\_custom\_metric\ to demonstrate that instrumentation calls do not fail if the New Relic agent application is not started. The entry also adds standard project scaffolding files such as \.formatter.exs\, \.gitignore\, and \README.md\ to support this example.

_examples/apps/instrumented\task · high confidence

Add support for New Relic Span Events and Distributed Tracing

This change introduces the ability to capture and report New Relic Span Events, enabling Distributed Tracing capabilities. It adds a new \NewRelic.Span.Event\ module to format span data (including trace IDs, parent IDs, and category-specific attributes for HTTP and datastore calls) and a \NewRelic.Span.Reporter\ module to handle reporting. The reporter routes spans to either the standard Span Event Harvester or the Infinite Tracing Harvester based on the configured distributed tracing feature flags.

_lib/new\relic/span · high confidence

Auto-instrumentation for Mix tasks and non-linked Task processes

New Relic now automatically instruments Mix tasks and connects non-linked Task processes to the calling transaction. The \NewRelic.Instrumented.Mix.Task\ macro allows Mix tasks to be wrapped so that their execution is tracked as a transaction. Additionally, \NewRelic.Instrumented.Task\ and \NewRelic.Instrumented.Task.Supervisor\ provide pre-instrumented wrappers for functions like \Task.start\, \Task.async\_stream\, and \Task.Supervisor.async\_nolink\, ensuring that background work is associated with the parent transaction context.

_lib/new\relic/instrumented · high confidence

Initial implementation of custom and transaction event harvesters

This change introduces the initial code for the New Relic agent's event harvesting subsystem, specifically adding the \CustomEvent.Harvester\ and \TransactionEvent.Harvester\ modules. These components manage the collection, sampling, and reporting of custom and transaction events to the New Relic collector, including logic for attribute processing, priority-based storage for transaction events, and supportability metric reporting.

_lib/new\_relic/harvest/collector/custom\event · high confidence

Initial implementation of error trace and transaction error event harvesters

This change introduces the initial agent code for collecting and sending error data to New Relic. It adds two new GenServer-based harvesters: one for error traces (capped at a fixed reservoir of 20) and one for transaction error events (using a configurable reservoir size). These components buffer errors locally, deduplicate traces, and send formatted payloads via the collector protocol upon harvest, while logging debug details and reporting supportability metrics.

_lib/new\_relic/harvest/collector/error\_trace, lib/new\_relic/harvest/collector/transaction\_error\event · high confidence

Initial implementation of span event harvesting

Introduces the SpanEvent Harvester, a new GenServer responsible for collecting, prioritizing, and sending span event data to New Relic. This component manages a priority queue of span events, applies sampling logic based on reservoir size, and formats the data for transmission via the collector protocol, enabling detailed distributed tracing support.

_lib/new\_relic/harvest/collector/span\event · high confidence

Initial implementation of the New Relic collector communication layer

This change introduces the core infrastructure for the New Relic Elixir agent to communicate with the New Relic collector. It adds the \AgentRun\ GenServer to manage the connection lifecycle (preconnect, connect, reconnect) and store agent metadata in persistent terms and ETS. The \Protocol\ module handles HTTP requests to the collector, implementing protocol version 17, handling specific HTTP status codes (like 410 for shutdown and 401/409 for restarts), and managing retries. The \Connect\ module defines the payload sent during connection, including app names, labels, and utilization data. Finally, a \Supervisor\ is added to manage the various harvesters (metrics, transactions, errors, spans) based on configuration received from the collector.

_lib/new\relic/harvest/collector · high confidence

Initial implementation of the metric harvester

Introduces the \NewRelic.Harvest.Collector.Metric.Harvester\ module, which provides the core logic for collecting and sending metric data. This component supports reporting and incrementing custom metrics, aggregates metric data using Erlang's \:counters\ for memory efficiency, and handles the serialization and transmission of metric payloads to the collector.

_lib/new\relic/harvest/collector/metric · high confidence

Initial import of New Relic agent utility modules

This change introduces a new set of utility modules for the New Relic Elixir agent, including Apdex calculation, error normalization and formatting, event processing with string size limits, HTTP client functionality with gzip compression and SSL verification via CAStore, a priority queue for event harvesting, request start time parsing, and vendor detection for AWS, Kubernetes, and Docker environments.

_lib/new\relic/util · high confidence

Initial import of New Relic metric data structures and transformation logic

This change introduces the core data structures and transformation logic for New Relic metrics. It adds the \NewRelic.Metric\ struct to hold metric fields such as name, scope, call counts, and timing statistics (total, min, max, exclusive time). It also adds \NewRelic.Metric.MetricData\, which provides functions to transform various event types—including custom metrics, HTTP dispatcher events, web and other transactions, caller durations, and datastore operations—into the appropriate metric names and statistical values required by the New Relic agent.

_lib/new\relic/metric · high confidence

Initial public API for New Relic transaction and attribute management

The library introduces a new public API module (\NewRelic\) that allows users to manually manage transactions and report data. Key capabilities include setting transaction names (\set\_transaction\_name\), reporting custom attributes with automatic flattening of nested structures (\add\_attributes\), and starting/stopping 'Other' transactions for non-web processes like background jobs or tasks (\start\_transaction\, \stop\_transaction\, \other\_transaction\ macro). It also provides functions to ignore transactions (\ignore\_transaction\), exclude processes from transaction tracking (\exclude\_from\_transaction\), and manually connect processes to existing transactions (\get\_transaction\, \connect\_to\_transaction\).

lib · high confidence

Initial release of the New Relic Elixir agent

This entry marks the initial import of the New Relic Elixir agent (version 1.42.0), providing a comprehensive solution for monitoring Elixir applications. The agent includes telemetry-based auto-instrumentation for key libraries such as Plug, Phoenix, Phoenix LiveView, Ecto, Redix, Finch, Oban, and Absinthe. It supports distributed tracing with W3C trace context, allows for manual instrumentation via macros and custom transactions, and integrates with the Elixir Logger for error reporting and logs in context. The repository also establishes standard project infrastructure, including a formatter configuration, CI badges, a Code of Conduct, and an Apache 2.0 license.

(repo-wide) · high confidence

Introduce dimensional metrics harvester for New Relic Telemetry SDK

A new harvester module has been added to the New Relic Telemetry SDK to support dimensional metrics reporting. This component aggregates count, gauge, and summary metrics by name and attributes, handling aggregation logic such as summing counts, updating gauge values, and tracking min/max/sum/count for summaries. It exposes an API for reporting these metrics and manages the harvest cycle, including calculating the interval duration and sending the aggregated data via the Telemetry SDK API.

_lib/new\_relic/harvest/telemetry\_sdk/dimensional\metrics · high confidence

Introduce distributed trace sampling and W3C trace context support

This change adds the core infrastructure for distributed tracing within the New Relic agent. It introduces a \BackoffSampler\ GenServer that uses Erlang counters to efficiently manage sampling rates and trigger backoff cycles based on sampling targets. It also implements W3C Trace Context support, allowing the agent to extract and generate \traceparent\ and \tracestate\ headers, including parsing New Relic-specific data from the trace state. Additionally, it provides context structures and encoding/decoding logic for New Relic's proprietary distributed trace payloads, ensuring proper validation and access restriction.

_lib/new\_relic/distributed\trace · high confidence

New Absinthe example app with automatic GraphQL instrumentation

Added a new example application (\examples/apps/absinthe\_example\) demonstrating automatic instrumentation of an Absinthe GraphQL API via the New Relic Agent. The app includes a Phoenix/Plug-based server, an Absinthe schema with query and subscription fields, and resolvers instrumented with \NewRelic.Tracer\. It also includes tests verifying that telemetry handlers are correctly attached for both query execution and subscription registration, ensuring that transaction metrics and spans are captured for GraphQL operations.

_examples/apps/absinthe\example · high confidence

New Ecto example application added

An example application demonstrating how to instrument an Ecto database app with New Relic via telemetry has been added to the examples directory. The example includes a README explaining that the instrumentation is fully automatic, along with standard project configuration files like a formatter config and a gitignore to support local development.

_examples/apps/ecto\example · high confidence

New Phoenix example app with LiveView and Bandit support

Added a new \phx\_example\ application that demonstrates auto-instrumentation for Phoenix, including Phoenix LiveView and the Bandit web server. The example app is configured to run on two endpoints (Cowboy on port 4004 and Bandit on port 4005) and includes LiveView routes, controllers, and layouts. Comprehensive tests verify that metrics, transaction events, and spans are correctly generated for standard Phoenix requests, LiveView interactions, and error scenarios.

_examples/apps/phx\example · high confidence

New Relic Elixir Agent v1.31.0 initial release

This release introduces the New Relic Elixir Agent, providing automatic instrumentation for Phoenix, Plug, Ecto, Redix, Oban, Absinthe, and Finch via Telemetry. It supports Distributed Tracing (W3C Trace Context and New Relic headers), Logs in Context, infinite tracing, and configurable feature toggles for error collection, query collection, and function argument collection. The agent requires Erlang/OTP 21.2+ and uses the native JSON library if available, falling back to Jason.

_lib/new\relic · high confidence

New Telemetry SDK for logs, spans, and metrics

The library introduces a new Telemetry SDK module that provides dedicated harvesters for logs, spans, and dimensional metrics. This SDK configures specific API endpoints for logs, traces, and metrics based on region and environment settings, supports infinite tracing via a configurable trace observer host, and manages background harvesting cycles for each telemetry type through a dedicated supervisor tree.

_lib/new\_relic/harvest/telemetry\sdk · high confidence

New automatic instrumentation for Absinthe, Ecto, Finch, Oban, Phoenix, Phoenix LiveView, Plug, and Redix

The telemetry module now includes dedicated instrumentation handlers for Absinthe, Ecto, Finch, Oban, Phoenix, Phoenix LiveView, Plug, and Redix. These new components automatically discover and instrument their respective libraries via telemetry events, capturing transaction metrics, distributed trace spans, and datastore or external call details. Each instrumentation is enabled by default but can be individually disabled or configured (e.g., for query collection) via specific feature flags in the agent configuration.

_lib/new\relic/telemetry · high confidence

Transaction trace harvesting implementation

The agent now includes a dedicated harvester for transaction traces, which collects and stores trace data based on configurable minimum duration, maximum named traces, and maximum slow traces settings. This component aggregates trace information and prepares it for sending to the New Relic collector, supporting the collection of performance metrics for transaction monitoring.

_lib/new\_relic/harvest/collector/transaction\trace · high confidence

Behavioural changes

Example app now supports Postgres, MySQL, and SQLite3 repositories

The Ecto example application has been updated to demonstrate support for multiple database adapters. The configuration now defines three repositories—PostgresRepo, MySQLRepo, and SQLite3Repo—each with its own connection settings (host, port, credentials), allowing users to run the example against any of these three database systems.

_examples/apps/ecto\example/config · high confidence

Initial configuration structure for New Relic agent

The application now includes a base configuration file that conditionally imports environment-specific settings, loading a secret configuration file when available in non-test environments. A dedicated test configuration is introduced to set the logger level to warning and define New Relic agent parameters, including the application name, license key, collector bypass mode, automatic attributes, and specific paths to ignore for web transactions.

config · high confidence

Introduce structured error reporting for transactions and processes

Added new modules \NewRelic.Error.Reporter.CrashReport\ and \NewRelic.Error.Reporter.ErrorMsg\ to handle error reporting for both transaction and process contexts. \CrashReport\ specifically filters out non-500 HTTP errors and prevents double-reporting of exceptions re-raised by PlugCowboy, while \ErrorMsg\ provides a standardized way to parse and report error messages and stack traces. These changes ensure that errors are correctly attributed to the relevant process or transaction and reported to New Relic with appropriate metadata.

_lib/new\relic/error/reporter · high confidence

New direct and macro-based function tracing implementation

The tracer module has been refactored to introduce a new direct tracing API (lib/new\_relic/tracer/direct.ex) and a macro-based instrumentation system (lib/new\_relic/tracer/macro.ex). The direct API allows manual span management with configurable limits on open spans, while the macro system automatically wraps functions marked with @trace, supporting guards and private functions. This change also introduces support for extended attributes, configurable argument tracing, and improved handling of external calls and datastore metrics, replacing previous tracing mechanisms with a more flexible and robust foundation.

_lib/new\relic/tracer · high confidence

New error reporting infrastructure using Logger filters

The error collection subsystem has been replaced with a new implementation that hooks into the Erlang/OTP \:logger\ system via primary filters instead of the legacy \error\_logger\ handler. This change introduces dedicated modules for handling crash reports and error messages, formatting them into New Relic-specific event and trace structures, and managing the lifecycle through a new supervisor. Users benefit from more robust error capture that integrates with modern logging standards and correctly distinguishes between transaction-scoped and process-scoped errors.

_lib/new\relic/error · high confidence

New example configuration for New Relic agent integration

The examples/config directory now includes a config.exs file that sets up the New Relic agent for the example application. This configuration defines the application name, trusted account key, and license key, and enables bypass\_collector mode. It also dynamically imports configuration files from sub-applications and conditionally imports a secret.exs file when not in the test environment, while setting the logger level to debug.

examples/config · high confidence

New harvest infrastructure with dedicated supervisors and cycle management

The library introduces a new internal architecture for managing data harvesting, replacing previous implementations with a structured supervision tree. This includes a main Harvest Supervisor that initializes task and collector supervisors, a DataSupervisor for namespace-specific cycles, and a HarvesterSupervisor (DynamicSupervisor) to manage individual harvester processes. The HarvestCycle GenServer now handles the periodic triggering of harvests, swapping harvester instances, and sending data via a Task, while the HarvesterStore uses an ETS table to track current harvester PIDs. This change provides a more robust and isolated mechanism for collecting and sending telemetry data (metrics, traces, events, logs, spans) to New Relic.

_lib/new\relic/harvest · high confidence

Redix example app configures HTTP port 4003

The Redix example application now includes a configuration file that sets the HTTP server port to 4003, allowing users to run the example service on this specific port.

_examples/apps/redix\example/config · high confidence

Refactored transaction tracking with Erlang trace-based process monitoring

The transaction tracking mechanism has been restructured to use a dedicated Erlang trace GenServer (\NewRelic.Transaction.ErlangTrace\) that automatically detects and tracks spawned linked processes (via \proc\_lib\ and \Task.Supervised\) for inclusion in transaction traces. This change introduces a sidecar architecture where a \Sidecar\ GenServer manages transaction state and attributes, while the trace manager handles process lifecycle events. The completion logic (\Complete\ module) now builds a hierarchical segment tree from these tracked processes, ensuring that child process durations are correctly accounted for in total transaction timing and metrics.

_lib/new\relic/transaction · high confidence

Test coverage

Added integration tests for Ecto example app metrics and query parsing; Added integration tests for New Relic collector connectivity and telemetry data posting; Added test coverage for core agent components; Added tests for Ecto and Finch telemetry instrumentation; Added tests for Oban job instrumentation and distributed tracing; Added tests for Redix instrumentation in the example app; Added tests for Telemetry SDK configuration and harvesters; Added tests for auto-instrumented Task module; New test helper module for agent testing.

Dependencies

Updated example applications and agent dependencies

The example applications (Absinthe, Ecto, Oban, Phoenix, Redix, W3C Trace Context, and Instrumented Task) have been updated with new dependency specifications and lockfiles, and the main agent's \mix.exs\ has been updated to support newer versions of optional dependencies such as \plug\, \phoenix\, \ecto\, and \telemetry\.

(dependencies) · high confidence

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 53 → 60 (+7.1)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.4) — scores are not directly comparable.

Lenses

  • Code Health 98 → 94 (-3.9)
  • Architecture 88 → 98 (+10.3)
  • Maturity 58 → 58 (-0.1)
  • Readiness 28 → 41 (+13.1)
  • Security 98 → 100 (+1.6)

Resolved (9)

  • Duplicated block (15 lines × 5) (lib/new_relic/metric/metric_data.ex)
  • Duplicated block (20 lines × 3) (lib/new_relic/metric/metric_data.ex)
  • Leaked secret: high-entropy-secret (examples/apps/phx_example/config/config.exs)
  • Leaked secret: high-entropy-secret (examples/apps/phx_example/config/config.exs)
  • Leaked secret: signing-key (examples/apps/phx_example/config/config.exs)
  • Leaked secret: signing-key (examples/apps/phx_example/config/config.exs)
  • Medium CVE: EEF-[CVE redacted] (mix.lock)
  • Off-boarding risk: anonymized user #1
  • Projects may be oversized for their cohesion

New (46)

  • Duplicated block (15 lines × 5) (lib/new_relic/metric/metric_data.ex)
  • Duplicated block (20 lines × 3) (lib/new_relic/metric/metric_data.ex)
  • Edited copies of one member (3 members, 3+ corresponding lines) (lib/new_relic/aggregate/reporter.ex)
  • Edited copies of one member (3 members, 3+ corresponding lines) (lib/new_relic/harvest/collector/custom_event/harvester.ex)
  • Edited copies of one member (3 members, 5+ corresponding lines) (lib/new_relic/harvest/collector/error_trace/harvester.ex)
  • Edited copies of one member (3 members, 6+ corresponding lines) (lib/new_relic/sampler/ets.ex)
  • Edited copies of one member (3 members, 9+ corresponding lines) (lib/new_relic/util.ex)
  • Edited copies of one member (4 members, 10+ corresponding lines) (lib/new_relic/transaction/complete.ex)
  • Edited copies of one member (4 members, 11+ corresponding lines) (lib/new_relic/harvest/collector/custom_event/harvester.ex)
  • Edited copies of one member (4 members, 3+ corresponding lines) (lib/new_relic/harvest/collector/custom_event/harvester.ex)
  • Edited copies of one member (4 members, 9+ corresponding lines) (examples/apps/absinthe_example/lib/application.ex)
  • Edited copies of one member (6 members, 2+ corresponding lines) (lib/new_relic/harvest/collector/custom_event/harvester.ex)
  • Edited copy of a member (10 corresponding lines) (lib/new_relic/metric/metric_data.ex)
  • Edited copy of a member (11 corresponding lines) (lib/new_relic/harvest/telemetry_sdk/logs/harvester.ex)
  • Edited copy of a member (11 corresponding lines) (lib/new_relic/span/event.ex)
  • Edited copy of a member (13 corresponding lines) (lib/new_relic/telemetry/plug.ex)
  • Edited copy of a member (14 corresponding lines) (lib/new_relic/transaction/complete.ex)
  • Edited copy of a member (15 corresponding lines) (lib/new_relic/metric/metric_data.ex)
  • Edited copy of a member (15 corresponding lines) (lib/new_relic/telemetry/absinthe.ex)
  • Edited copy of a member (2 corresponding lines) (lib/new_relic/harvest/collector/span_event/harvester.ex)
  • …and 26 more

Changes since last survey

  • 2 commits — 2 feature/other, 0 fixes

By area

  • (root) — 1 commit
  • lib/new_relic — 1 commit

Notable commits

  • change: Bump version 1.43.0 (#574)
  • change: Retry connecting when collector is unreachable at boot (#573)

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

newrelic/elixir_agent was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 15 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 51a6e8396e9108a87c1bc54ccecee8b1fecf4c56 — the exact code this score is about.
  • Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.65+preprod-3c33c1882dc1.