Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Type Constructor Classes in Code Level Metrics #708

merged 8 commits into from Dec 7, 2022


Copy link

@TimPansino TimPansino commented Dec 7, 2022


  • Previously either no data was reported or a crash occurred (depending on agent version) when using a class created using the 3 argument type constructor. Fixed and properly returns without line number (which is unavailable).
  • Pin tox major version to v3 until CI can be fixed.

Related Github Issue

Closes #515

@TimPansino TimPansino requested a review from a team as a code owner December 7, 2022 18:56
Copy link
Contributor Author

Problem stemmed from an uncaught OSError, catching all exception types when attempting to find line numbers now.

Copy link

github-actions bot commented Dec 7, 2022

🦙 MegaLinter status: SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
PYTHON bandit 1 0 2.47s
PYTHON black 3 0 0 0.67s
PYTHON flake8 3 0 0.39s
PYTHON isort 3 0 0 0.27s
PYTHON pylint 3 0 3.19s
YAML prettier 1 0 0 0.44s
YAML v8r 1 0 2.12s
YAML yamllint 1 0 0.19s

See errors details in artifact MegaLinter reports on CI Job page
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

Copy link

@hmstepanek hmstepanek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed some lint errors and converted the helper function into a fixture. Otherwise looks good!


def extract(obj):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a fixture.

@hmstepanek hmstepanek merged commit fd0fd01 into main Dec 7, 2022
43 checks passed
@hmstepanek hmstepanek deleted the fix-clm-type-constructor-classes branch December 7, 2022 21:50
@hmstepanek hmstepanek added this to the v8.5.0 milestone Dec 7, 2022
TimPansino added a commit that referenced this pull request Dec 8, 2022
* Fix CLM exception catching

* Reorganize CLM Tests

* Add type constructor tests to CLM

* Fix line number

* Pin tox version

* Fix lambda tests in CLM

* Fix lint issues

* Turn helper func into pytest fixture

Co-authored-by: Hannah Stepanek <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

NewRelic agent: Failed to extract source code context from callable
2 participants