newrelic / newrelic-python-agent

New Relic Python Agent
https://docs.newrelic.com/docs/agents/python-agent
Apache License 2.0
176 stars 99 forks source link

Add try-excepts around fragile openai code #1101

Closed hmstepanek closed 6 months ago

hmstepanek commented 6 months ago

Overview

In order to provide a safety-net for our us and our customers, add try-except around fragile parsing code that could cause a crash.

Note this is based on https://github.com/newrelic/newrelic-python-agent/pull/1096 which should be reviewed and merged first.

github-actions[bot] commented 6 months ago

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ PYTHON bandit 1 0 4.89s
✅ PYTHON black 1 0 0 0.9s
✅ PYTHON flake8 1 0 0.56s
✅ PYTHON isort 1 0 0 0.18s
✅ PYTHON pylint 1 0 3.68s

See detailed report in MegaLinter reports _Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff_

_MegaLinter is graciously provided by OX Security_

codecov-commenter commented 6 months ago

Codecov Report

Attention: Patch coverage is 80.12821% with 31 lines in your changes are missing coverage. Please review.

Project coverage is 81.80%. Comparing base (b950070) to head (df73941). Report is 20 commits behind head on develop-ai-limited-preview-3.

Files Patch % Lines
newrelic/hooks/mlmodel_openai.py 80.12% 22 Missing and 9 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop-ai-limited-preview-3 #1101 +/- ## ================================================================ - Coverage 81.86% 81.80% -0.06% ================================================================ Files 192 192 Lines 21253 21294 +41 Branches 3711 3711 ================================================================ + Hits 17398 17419 +21 - Misses 2783 2798 +15 - Partials 1072 1077 +5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

umaannamalai commented 6 months ago

Pre-approving this PR!