Notes
This release of the Python agent adds support for Azure CosmosDB, adds instrumentation for HTTPX2 and new LangChain/LangGraph streaming events APIs, adds support for newer OpenTelemetry database semantic conventions, and resolves several issues including incomplete package reporting, a package lookup performance penalty, and a MySQL database name reporting bug.
Install the agent using easy_install/pip/distribute via the Python Package Index, using conda via the Conda-Forge Package Index, or download it directly from the New Relic download site.
New features
-
Added support for Azure CosmosDB
- The Python agent now instruments Azure Cosmos DB client operations, reporting datastore metrics and traces for database, container, and user operations performed through the
azure-cosmosSDK.
- The Python agent now instruments Azure Cosmos DB client operations, reporting datastore metrics and traces for database, container, and user operations performed through the
-
Added support for HTTPX2
-
Added LangChain/LangGraph streaming events instrumentation
-
Added support for newer OpenTelemetry database semantic conventions
- When running the Python agent alongside OpenTelemetry (Hybrid Agent mode), the agent now reads both the legacy and newer OpenTelemetry database span attribute names (
db.name/db.namespace,db.statement/db.query.text,db.mongodb.collection/db.collection.name), so database tracing continues to work correctly regardless of which semantic convention version the OpenTelemetry instrumentation library emits.
- When running the Python agent alongside OpenTelemetry (Hybrid Agent mode), the agent now reads both the legacy and newer OpenTelemetry database span attribute names (
Bugs
-
Fixed incomplete package reporting to New Relic
- Previously, the Python agent could omit some installed packages from the Environment data reported to New Relic if module discovery took longer than the fixed time window allotted during the slow harvest cycle, and the package list wasn't refreshed after an agent restart. Package capture now runs during the fast harvest cycle and is fully re-captured on agent shutdown/restart, so the reported package list is complete.
-
Reduced overhead of package version lookups
- Previously, looking up installed package versions rescanned the filesystem for every package on every lookup, incurring an O(n^2) time penalty that scaled with the number of installed packages during agent initialization. The result of
importlib.metadata.packages_distributions()is now cached after the first lookup to avoid this overhead.
- Previously, looking up installed package versions rescanned the filesystem for every package on every lookup, incurring an O(n^2) time penalty that scaled with the number of installed packages during agent initialization. The result of
-
Fixed
get_linking_metadatato properly pass through the specified application- Previously, calling
newrelic.agent.get_linking_metadata(application=...)ignored theapplicationargument and always returned linking metadata for the default application. This affected processes reporting to more than one application. The specified application is now correctly passed through. - Thank you ckarnell for the contribution!
- Previously, calling
-
Fixed MySQL database name reporting when using the
databasekeyword argument- Previously, the agent only checked the legacy
dbkeyword argument when parsing the database name from mysql-connector-python connection arguments, so connections made using the moderndatabasekeyword argument reported no database name in datastore metrics. The agent now checksdatabasefirst, falling back todb.
- Previously, the agent only checked the legacy
-
Fixed warning when accessing LangGraph v1.1+
GraphOutputvalues- Previously, LangGraph v1.1+ instrumentation accessed
GraphOutputreturn values using deprecated item-access syntax, triggering a deprecation warning. The agent now readsGraphOutput.valuedirectly.
- Previously, LangGraph v1.1+ instrumentation accessed
Support statement
We recommend updating to the latest agent version as soon as it's available. If you can't upgrade to the latest version, update your agents to a version no more than 90 days old. Read more about keeping agents up to date.
See the New Relic Python agent EOL policy for information about agent releases and support dates.