Skip to content

feat: Improve New Relic ASGI instrumentation handling with enhanced e…#165

Merged
rostilos merged 1 commit intomainfrom
1.5.5-rc
Mar 6, 2026
Merged

feat: Improve New Relic ASGI instrumentation handling with enhanced e…#165
rostilos merged 1 commit intomainfrom
1.5.5-rc

Conversation

@rostilos
Copy link
Owner

@rostilos rostilos commented Mar 6, 2026

…rror logging

@codecrow-local
Copy link

codecrow-local bot commented Mar 6, 2026

⚠️ Code Analysis Results

Quality Gate Default Quality Gate: ✅ PASSED

Summary

Pull Request Review: feat: Improve New Relic ASGI instrumentation handling with enhanced e…

Status PASS
Risk Level LOW
Review Coverage 1 file analyzed in depth
Confidence HIGH

Executive Summary

This PR refines the New Relic ASGI instrumentation logic within the inference-orchestrator. The primary change shifts the instrumentation gating from internal agent settings to an environment-based check (NEW_RELIC_CONFIG_FILE). While this ensures the wrapper is applied early in the application lifecycle, it introduces a dependency on specific environment variables rather than the agent's initialized state.

Recommendation

Decision: PASS

The changes are low-risk and improve the predictability of instrumentation application. It is recommended to verify that the NEW_RELIC_ENABLED flag is respected alongside the config file check to ensure standard agent behavior is maintained.

Issues Overview

Severity Count
🔵 Low 1 Minor issues and improvements

Analysis completed on 2026-03-06 15:45:24 | View Full Report | Pull Request


📋 Detailed Issues (1)

🔵 Low Severity Issues

Id on Platform: 3797

Category: 🏗️ Architecture

File: .../api/app.py:87

Environment-based Instrumentation Gating

Environment-based Instrumentation Gating
The PR shifts the New Relic ASGI instrumentation logic from checking the agent's internal settings to checking for the presence of an environment variable ('NEW_RELIC_CONFIG_FILE'). While this ensures the wrapper is applied early, it creates a dependency on specific environment configuration rather than the library's own state.
Evidence: The change in app.py replaces 'if settings:' with 'if os.environ.get('NEW_RELIC_CONFIG_FILE'):'. This assumes that the presence of the config file path always implies the agent should be active and initialized.
Business impact: Low risk of instrumentation not being applied if the agent fails to initialize despite the config file being present, or conversely, applying a wrapper that might fail if the agent is disabled via other means (e.g., NEW_RELIC_ENABLED=false).

💡 Suggested Fix

Verify if 'newrelic.agent.settings()' is available at this point in the lifecycle. If not, consider checking both the environment variable and the 'NEW_RELIC_ENABLED' flag to ensure consistency with New Relic's standard configuration priority.

View Issue Details


Files Affected

  • .../api/app.py: 1 issue

@rostilos rostilos merged commit 5165967 into main Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant