Skip to content

Commit 17cd48d

Browse files
umaannamalaihmstepanekTimPansinolrafeeimergify[bot]
authored
Add sklearn instrumentation and ML model feature support (#921)
* Add tree model function traces (#691) * Add sklearn to tox * Add function traces around model methods * Support Python 2.7 & 3.7 sklearn * Add test for multiple calls to model method * Fixup: add comments & organize * Refactor * Follow two digit convention * Make if-else a one-liner * Abstract to re-usable instrumentation function * Use wrap_method_trace & change to Function group Co-authored-by: Timothy Pansino <[email protected]> Co-authored-by: Lalleh Rafeei <[email protected]> Co-authored-by: Uma Annamalai <[email protected]> * Fixup: use if-else one-liner * Use hasattr instead of model name check * Change component_sklearn to mlmodel_sklearn * Fixup: replace in model names with hasattr Co-authored-by: Timothy Pansino <[email protected]> Co-authored-by: Lalleh Rafeei <[email protected]> Co-authored-by: Uma Annamalai <[email protected]> * Add config setting for sklearn inference event capture. (#706) * Add sklearn to tox * Add function traces around model methods * Support Python 2.7 & 3.7 sklearn * Add test for multiple calls to model method * Fixup: add comments & organize * Refactor * Follow two digit convention * Make if-else a one-liner * Abstract to re-usable instrumentation function * Add ML inference event capture config setting. * [Mega-Linter] Apply linters fixes * Fixup: remove component_sklearn files * Add high security mode testing for ML events setting. * [Mega-Linter] Apply linters fixes Co-authored-by: Hannah Stepanek <[email protected]> Co-authored-by: umaannamalai <[email protected]> * Capture scorer results (#694) * Add score results attributes to metric scorers * Test un-subclassable types * [Mega-Linter] Apply linters fixes * [Mega-Linter] Apply linters fixes * Trigger tests * Remove custom subclassing code. * [Mega-Linter] Apply linters fixes * Remove unused function * Add test for iterable score results * Change name of object proxy * Fixup: rename proxy in tests too Co-authored-by: hmstepanek <[email protected]> Co-authored-by: Tim Pansino <[email protected]> Co-authored-by: TimPansino <[email protected]> * Add ensemble model function traces (#697) * Add sklearn to tox * Add function traces around model methods * Support Python 2.7 & 3.7 sklearn * Add test for multiple calls to model method * Fixup: add comments & organize * Add ensemble models * Add ensemble model tests * Edit tests * Add ensemble library models from sklearn * Start tests with empty commit * Clean up tests * Fix tests for various versions of sklearn * Fix ensemble tests with changes from tree PR * [Mega-Linter] Apply linters fixes * Remove breakpoints * Remove commited config files * Group tests into more readable format * Pin startlette latest < 0.23.1 * Convert PY3 checks to one-liners * Use tuple checks for sklearn version Use tuple checks for sklearn version, string checks can result in unexpected out of order comparisons. Also use direct comparisons for easier readability. * Fix VotingRegressor test Co-authored-by: Hannah Stepanek <[email protected]> Co-authored-by: lrafeei <[email protected]> * Include training step in metric scorer name (#712) * Include training step in scorer name * Add fit_predict data proxying * Remove name comments * Fix predict being called before fit * Re-use existing fixture * Add cluster model function traces (#700) * Add sklearn to tox * Add function traces around model methods * Support Python 2.7 & 3.7 sklearn * Add test for multiple calls to model method * Fixup: add comments & organize * Add ensemble models * Add ensemble model tests * Edit tests * Add ensemble library models from sklearn * Start tests with empty commit * Clean up tests * Add cluster model instrumentaton * Fix tests for various versions of sklearn * Fix ensemble tests with changes from tree PR * [Mega-Linter] Apply linters fixes * Fix some cluster model tests * Fix tests after ensemble PR merge * Add transform to tests * Remove accidental commits * Modify cluster tests to be more readable * Break up instrumentation models * Remove duplicate ensemble module defs * Modify VotingRegressor test Co-authored-by: Hannah Stepanek <[email protected]> Co-authored-by: lrafeei <[email protected]> * Add calibration model function traces (#709) * Add sklearn to tox * Add function traces around model methods * Support Python 2.7 & 3.7 sklearn * Add test for multiple calls to model method * Fixup: add comments & organize * Add ensemble models * Add ensemble model tests * Edit tests * Add ensemble library models from sklearn * Start tests with empty commit * Clean up tests * Fix tests for various versions of sklearn * Fix ensemble tests with changes from tree PR * [Mega-Linter] Apply linters fixes * Remove breakpoints * Create tests/instrumentation for calibration models * Fix calibration tests * Remove commented out code * Remove yaml file in commit * Remove duplicate ensemble module defs Co-authored-by: Hannah Stepanek <[email protected]> Co-authored-by: lrafeei <[email protected]> * Add svm model function traces (#733) * Add svm models * Remove extra conditionals from testing * Add semi supervised models (#732) * Add pipeline model function traces (#730) * Add pipeline models * Remove commented code * Add neural network model function traces (#729) * Add neural network models * Fixup: merge conflict Co-authored-by: Hannah Stepanek <[email protected]> * Add neighbors models (#728) * Add mixture models (#725) * Add model selection model function traces (#726) * Add outline for model selection tests * Add some testing to model selection * Add hooks * Add estimator * Finish testing for model selection * Add naive bayes models (#724) * Add multioutput models (#723) * Add multiclass models (#722) * Add kernel ridge model function traces (#721) * Add kernel ridge models * Modify VotingRegressor test * Add custom feature events for sklearn (#727) * Add function traces around model methods * Add test for multiple calls to model method * Fixup: add comments & organize * Refactor * Instrument predict function. * Add data trains fixture. * Add testing and cleanup for custom feature events. * Update test_tree_models. * Add back training step logic to predict proxy. * Remove unused files. * Add tree model function traces (#691) * Add sklearn to tox * Add function traces around model methods * Support Python 2.7 & 3.7 sklearn * Add test for multiple calls to model method * Fixup: add comments & organize * Refactor * Follow two digit convention * Make if-else a one-liner * Abstract to re-usable instrumentation function * Use wrap_method_trace & change to Function group Co-authored-by: Timothy Pansino <[email protected]> Co-authored-by: Lalleh Rafeei <[email protected]> Co-authored-by: Uma Annamalai <[email protected]> * Fixup: use if-else one-liner * Use hasattr instead of model name check * Change component_sklearn to mlmodel_sklearn * Fixup: replace in model names with hasattr Co-authored-by: Timothy Pansino <[email protected]> Co-authored-by: Lalleh Rafeei <[email protected]> Co-authored-by: Uma Annamalai <[email protected]> * Add config setting for sklearn inference event capture. (#706) * Add sklearn to tox * Add function traces around model methods * Support Python 2.7 & 3.7 sklearn * Add test for multiple calls to model method * Fixup: add comments & organize * Refactor * Follow two digit convention * Make if-else a one-liner * Abstract to re-usable instrumentation function * Add ML inference event capture config setting. * [Mega-Linter] Apply linters fixes * Fixup: remove component_sklearn files * Add high security mode testing for ML events setting. * [Mega-Linter] Apply linters fixes Co-authored-by: Hannah Stepanek <[email protected]> Co-authored-by: umaannamalai <[email protected]> * Capture scorer results (#694) * Add score results attributes to metric scorers * Test un-subclassable types * [Mega-Linter] Apply linters fixes * [Mega-Linter] Apply linters fixes * Trigger tests * Remove custom subclassing code. * [Mega-Linter] Apply linters fixes * Remove unused function * Add test for iterable score results * Change name of object proxy * Fixup: rename proxy in tests too Co-authored-by: hmstepanek <[email protected]> Co-authored-by: Tim Pansino <[email protected]> Co-authored-by: TimPansino <[email protected]> * Add ensemble model function traces (#697) * Add sklearn to tox * Add function traces around model methods * Support Python 2.7 & 3.7 sklearn * Add test for multiple calls to model method * Fixup: add comments & organize * Add ensemble models * Add ensemble model tests * Edit tests * Add ensemble library models from sklearn * Start tests with empty commit * Clean up tests * Fix tests for various versions of sklearn * Fix ensemble tests with changes from tree PR * [Mega-Linter] Apply linters fixes * Remove breakpoints * Remove commited config files * Group tests into more readable format * Pin startlette latest < 0.23.1 * Convert PY3 checks to one-liners * Use tuple checks for sklearn version Use tuple checks for sklearn version, string checks can result in unexpected out of order comparisons. Also use direct comparisons for easier readability. * Fix VotingRegressor test Co-authored-by: Hannah Stepanek <[email protected]> Co-authored-by: lrafeei <[email protected]> * Add function traces around model methods * Add test for multiple calls to model method * Fixup: add comments & organize * Refactor * Instrument predict function. * Add data trains fixture. * Add testing and cleanup for custom feature events. * Update test_tree_models. * Include training step in metric scorer name (#712) * Include training step in scorer name * Add fit_predict data proxying * Remove name comments * Fix predict being called before fit * Re-use existing fixture * Add cluster model function traces (#700) * Add sklearn to tox * Add function traces around model methods * Support Python 2.7 & 3.7 sklearn * Add test for multiple calls to model method * Fixup: add comments & organize * Add ensemble models * Add ensemble model tests * Edit tests * Add ensemble library models from sklearn * Start tests with empty commit * Clean up tests * Add cluster model instrumentaton * Fix tests for various versions of sklearn * Fix ensemble tests with changes from tree PR * [Mega-Linter] Apply linters fixes * Fix some cluster model tests * Fix tests after ensemble PR merge * Add transform to tests * Remove accidental commits * Modify cluster tests to be more readable * Break up instrumentation models * Remove duplicate ensemble module defs * Modify VotingRegressor test Co-authored-by: Hannah Stepanek <[email protected]> Co-authored-by: lrafeei <[email protected]> * Add calibration model function traces (#709) * Add sklearn to tox * Add function traces around model methods * Support Python 2.7 & 3.7 sklearn * Add test for multiple calls to model method * Fixup: add comments & organize * Add ensemble models * Add ensemble model tests * Edit tests * Add ensemble library models from sklearn * Start tests with empty commit * Clean up tests * Fix tests for various versions of sklearn * Fix ensemble tests with changes from tree PR * [Mega-Linter] Apply linters fixes * Remove breakpoints * Create tests/instrumentation for calibration models * Fix calibration tests * Remove commented out code * Remove yaml file in commit * Remove duplicate ensemble module defs Co-authored-by: Hannah Stepanek <[email protected]> Co-authored-by: lrafeei <[email protected]> * Add back training step logic to predict proxy. * Remove unused files. * Address py27 test failures and review comments. * Fix py 3.7 failures. * Remove old component_sklearn.py file * Fix lint errors * [Mega-Linter] Apply linters fixes * Merge redis fix. Co-authored-by: Hannah Stepanek <[email protected]> Co-authored-by: Timothy Pansino <[email protected]> Co-authored-by: Lalleh Rafeei <[email protected]> Co-authored-by: Uma Annamalai <[email protected]> Co-authored-by: hmstepanek <[email protected]> Co-authored-by: Tim Pansino <[email protected]> Co-authored-by: lrafeei <[email protected]> * Add feature selection model function traces (#719) * Add feature selection models * Modify VotingRegressor test * Add dummy model function traces (#718) * Add gaussian process model function traces (#720) * Add gaussian process models * Modify VotingRegressor test * Modify Gaussian Process models tests * Add discriminant analysis model (#717) * Add cross decomposition models (#716) * Add covariance model (#714) * Add compose models (#713) * Add linear model function traces (#703) * Add sklearn to tox * Add function traces around model methods * Support Python 2.7 & 3.7 sklearn * Add test for multiple calls to model method * Fixup: add comments & organize * Add ensemble models * Add ensemble model tests * Edit tests * Add ensemble library models from sklearn * Start tests with empty commit * Clean up tests * Initial linear model commit * Clean up tests for linear models * Fix tests for various versions of sklearn * Fix ensemble tests with changes from tree PR * [Mega-Linter] Apply linters fixes * Remove breakpoints * Merge changes from ensemble PR * Fix tests for v0.20.0 * Rewrite linear tests to be more readable * Break up instrumentation in config * Remove commented code * Remove yaml file in commit * Remove duplicate ensemble module defs * Remove old no longer used file * Remove commented out code. * Change test name and modify VotingRegressor test * Push empty commit * Modify VotingRegression test * Add estimator to VotingRegressor * Revert VotingRegressor test * Fix ensemble tests * Add different models for VotingRegressor test Co-authored-by: Hannah Stepanek <[email protected]> Co-authored-by: lrafeei <[email protected]> * Add ml_model function wrapper API (#739) * Add function traces around model methods * Add test for multiple calls to model method * Fixup: add comments & organize * Refactor * Instrument predict function. * Add data trains fixture. * Add testing and cleanup for custom feature events. * Update test_tree_models. * Add back training step logic to predict proxy. * Remove unused files. * Add ml_model wrapper and tests. * Add column name logic. * Update branch. * Update column name mapping logic. * Fix py2 failures. * Fix pypy37 failure. * Revise feature_names logic. * Add more ml_model wrapper testing. * Fix linter unused import * [Mega-Linter] Apply linters fixes * Bump tests. * Bump tests. Co-authored-by: Hannah Stepanek <[email protected]> Co-authored-by: umaannamalai <[email protected]> * Report feature event w/o value (#754) Report the feature event w/o the raw value if `machine_learning.inference_event_value.enabled` is False. * Prediction metric stats (#715) * Add function traces around model methods * Add test for multiple calls to model method * Fixup: add comments & organize * Refactor * Instrument predict function. * Add data trains fixture. * Add testing and cleanup for custom feature events. * Update test_tree_models. * Add back training step logic to predict proxy. * Remove unused files. * Update branch. * Add impl and testing for label events. * [Mega-Linter] Apply linters fixes * Add feature_name to expected events for int test. * Fix py37 test. * Add function traces around model methods * Add test for multiple calls to model method * Fixup: add comments & organize * Refactor * Instrument predict function. * Add data trains fixture. * Add testing and cleanup for custom feature events. * Update test_tree_models. * Add back training step logic to predict proxy. * Remove unused files. * Update branch. * Add impl and testing for label events. * Add feature_name to expected events for int test. * [Mega-Linter] Apply linters fixes * Fix py37 test. * Update logic to not report value when setting is disabled. * Fixup flake8 unused import * Touch up label event logic and rename test_feature_events to test_inference_events. * Add test case for multilabel output. * Fix 2D np array test. * Add metrics about prediction data * Fixup * Fix user provided label names * Fixup label related column name tests * [Mega-Linter] Apply linters fixes * Assert label events in multilabel output test * Remove return of stats * Remove spaces from version specification * Fix py2.7 output difference in pandas test --------- Co-authored-by: Uma Annamalai <[email protected]> Co-authored-by: umaannamalai <[email protected]> Co-authored-by: hmstepanek <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Add new ML event type (#802) * Add new machine learning event data type Co-authored-by: Tim Pansino <[email protected]> Co-authored-by: Lalleh Rafeei <[email protected]> Co-authored-by: Uma Annamalai <[email protected]> * Validate new machine learning event data type Co-authored-by: Tim Pansino <[email protected]> Co-authored-by: Lalleh Rafeei <[email protected]> Co-authored-by: Uma Annamalai <[email protected]> * Fixup: minor inconsistencies * Fixup * Remove code coverage fixture * Fix lint errors * Increase timeout for python tests --------- Co-authored-by: Tim Pansino <[email protected]> Co-authored-by: Lalleh Rafeei <[email protected]> Co-authored-by: Uma Annamalai <[email protected]> * Add machine learning and ml_event config options (#811) * Add machine learning config options * machine_learning.enabled * machine_learning.inference_events.enable * machine_learning.inference_events.value.enabled * event_harvest_config.harvest_limits.ml_event_data Co-authored-by: Lalleh Rafeei <[email protected]> Co-authored-by: Uma Annamalai <[email protected]> * Replace all TODOs w/ new config settings * [Mega-Linter] Apply linters fixes * Trigger tests * Add insights settings & tests * Remove collect_custom_events & inference_events.enabled * Revert inference_events_value=>.value * Remove TODO * Fixup: format docstring * Remove file * Add tests for machine_learning.enabled --------- Co-authored-by: Lalleh Rafeei <[email protected]> Co-authored-by: Uma Annamalai <[email protected]> Co-authored-by: hmstepanek <[email protected]> * Dimensional Metrics (#815) * Wiring dimensional metrics * Squashed commit of the following: commit c2d4629dfd7787354b6607160bb952913975d5f7 Author: Timothy Pansino <[email protected]> Date: Wed May 10 15:59:13 2023 -0700 Add required option for tox v4 (#795) * Add required option for tox v4 * Update tox in GHA * Remove py27 no-cache-dir commit a9636498ab5c20c266fb044a08359c0c9bbcf826 Author: Hannah Stepanek <[email protected]> Date: Tue May 9 10:46:39 2023 -0700 Run coverage around pytest (#813) * Run coverage around pytest * Trigger tests * Fixup * Add redis client_no_touch to ignore list * Temporarily remove kafka from coverage * Remove coverage for old libs commit 3d8284540e0acd867c2cf680f43449bc128c0779 Author: Lalleh Rafeei <[email protected]> Date: Wed May 3 14:50:30 2023 -0700 Omit some frameworks from coverage analysis (#810) * Omit some frameworks from coverage analysis * Remove commas * Change format of omit * Add relative_files option to coverage * Add absolute directory * Add envsitepackagedir * Add coveragerc file * Add codecov.yml * [Mega-Linter] Apply linters fixes * Revert coveragerc file settings * Add files in packages and more frameworks * Remove commented line --------- Co-authored-by: lrafeei <[email protected]> Co-authored-by: Hannah Stepanek <[email protected]> commit fd0fa35466b630e34e8476cc53ad0e163564e2de Author: Uma Annamalai <[email protected]> Date: Tue May 2 10:55:36 2023 -0700 Add testing for genshi and mako. (#799) * Add testing for genshi and mako. * [Mega-Linter] Apply linters fixes --------- Co-authored-by: umaannamalai <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> commit be4fb3dda0e734889acd6bc53cf91f26c18c2118 Author: Lalleh Rafeei <[email protected]> Date: Mon May 1 16:01:09 2023 -0700 Add tests for Waitress (#797) * Change import format * Initial commit * Add more tests to adapter_waitress * Remove commented out code * [Mega-Linter] Apply linters fixes * Add assertions to all tests * Add more NR testing to waitress --------- Co-authored-by: lrafeei <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> commit 7103506ca5639d339e3e47dfb9e4affb546c839b Author: Hannah Stepanek <[email protected]> Date: Mon May 1 14:12:31 2023 -0700 Add tests for pyodbc (#796) * Add tests for pyodbc * Move imports into tests to get import coverage * Fixup: remove time import * Trigger tests --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> commit 363122a0efe0ad9f4784fc1f67fda046cb9bb7e8 Author: Hannah Stepanek <[email protected]> Date: Mon May 1 13:34:35 2023 -0700 Pin virtualenv, fix pip arg deprecation & disable kafka tests (#803) * Pin virtualenv * Fixup: use 20.21.1 instead * Replace install-options with config-settings See https://github.com/pypa/pip/issues/11358. * Temporarily disable kafka tests * Add dimensional stats table to stats engine * Add attribute processing to metric identity * Add testing for dimensional metrics * Cover tags as list not dict * Commit suggestions from code review * Add OTLP protocol class & protos (#821) * Add protos under packages for otlp * Add common otlp proto payload methods * Add new oltp protocol class * Remove ML event from log message * Remove params, add api-key header & expose path The params are not relevant to OTLP so remove these. The api-key header is how we provide the license key to OTLP so add this. The path to upload dimensional metrics and events are different in OTLP so expose the path so it can be overriden inside the coresponding data_collector methods. * Add otlp_port and otlp_host settings * Default to JSON if protobuf not available & warn * Move otlp_utils to core * Call encode in protocol class * Patch issues with data collector * Move resource to utils & add log proto imports --------- Co-authored-by: Tim Pansino <[email protected]> * Fix Testing Failures (#828) * Fix tastypie tests * Adjust asgiref pinned version * Make aioredis key PID unique * Pin more asgiref versions * Fix pytest test filtering when running tox (#823) Co-authored-by: Uma Annamalai <[email protected]> * OTLP Serialization for Dimensional Metrics (#826) * Add protos under packages for otlp * Add common otlp proto payload methods * Add new oltp protocol class * Remove ML event from log message * Remove params, add api-key header & expose path The params are not relevant to OTLP so remove these. The api-key header is how we provide the license key to OTLP so add this. The path to upload dimensional metrics and events are different in OTLP so expose the path so it can be overriden inside the coresponding data_collector methods. * Add metric protos * Use protos to create payload * Squashed commit of the following: commit 6f15520cea6a1098915c9ca340dbe42de6a5de1d Author: Tim Pansino <[email protected]> Date: Mon May 15 14:28:50 2023 -0700 TEMP commit 1a28d36f86dd3f1fa5ca7a8f56357d168aac69db Author: Tim Pansino <[email protected]> Date: Thu May 11 17:28:27 2023 -0700 Cover tags as list not dict commit 71261e3d468320569742a72c690f6ff4e9b3e621 Merge: 459e08567 c2d4629df Author: Timothy Pansino <[email protected]> Date: Thu May 11 16:59:11 2023 -0700 Merge branch 'main' into feature-dimensional-metrics commit 459e08567102cfadce398b57d245ecf99408400d Author: Tim Pansino <[email protected]> Date: Thu May 11 16:57:16 2023 -0700 Add testing for dimensional metrics commit ed33957cd2b20bc1f6e9759a0bad5e4f4a86a38c Author: Tim Pansino <[email protected]> Date: Thu May 11 16:56:31 2023 -0700 Add attribute processing to metric identity commit 6caf71ef4386395d950060e0e996f80dbcbfbc32 Author: Tim Pansino <[email protected]> Date: Thu May 11 16:56:16 2023 -0700 Add dimensional stats table to stats engine commit 5e1cc9dea6d0d9623130dedd0f787408a8439388 Author: Tim Pansino <[email protected]> Date: Wed May 10 16:00:42 2023 -0700 Squashed commit of the following: commit c2d4629dfd7787354b6607160bb952913975d5f7 Author: Timothy Pansino <[email protected]> Date: Wed May 10 15:59:13 2023 -0700 Add required option for tox v4 (#795) * Add required option for tox v4 * Update tox in GHA * Remove py27 no-cache-dir commit a9636498ab5c20c266fb044a08359c0c9bbcf826 Author: Hannah Stepanek <[email protected]> Date: Tue May 9 10:46:39 2023 -0700 Run coverage around pytest (#813) * Run coverage around pytest * Trigger tests * Fixup * Add redis client_no_touch to ignore list * Temporarily remove kafka from coverage * Remove coverage for old libs commit 3d8284540e0acd867c2cf680f43449bc128c0779 Author: Lalleh Rafeei <[email protected]> Date: Wed May 3 14:50:30 2023 -0700 Omit some frameworks from coverage analysis (#810) * Omit some frameworks from coverage analysis * Remove commas * Change format of omit * Add relative_files option to coverage * Add absolute directory * Add envsitepackagedir * Add coveragerc file * Add codecov.yml * [Mega-Linter] Apply linters fixes * Revert coveragerc file settings * Add files in packages and more frameworks * Remove commented line --------- Co-authored-by: lrafeei <[email protected]> Co-authored-by: Hannah Stepanek <[email protected]> commit fd0fa35466b630e34e8476cc53ad0e163564e2de Author: Uma Annamalai <[email protected]> Date: Tue May 2 10:55:36 2023 -0700 Add testing for genshi and mako. (#799) * Add testing for genshi and mako. * [Mega-Linter] Apply linters fixes --------- Co-authored-by: umaannamalai <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> commit be4fb3dda0e734889acd6bc53cf91f26c18c2118 Author: Lalleh Rafeei <[email protected]> Date: Mon May 1 16:01:09 2023 -0700 Add tests for Waitress (#797) * Change import format * Initial commit * Add more tests to adapter_waitress * Remove commented out code * [Mega-Linter] Apply linters fixes * Add assertions to all tests * Add more NR testing to waitress --------- Co-authored-by: lrafeei <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> commit 7103506ca5639d339e3e47dfb9e4affb546c839b Author: Hannah Stepanek <[email protected]> Date: Mon May 1 14:12:31 2023 -0700 Add tests for pyodbc (#796) * Add tests for pyodbc * Move imports into tests to get import coverage * Fixup: remove time import * Trigger tests --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> commit 363122a0efe0ad9f4784fc1f67fda046cb9bb7e8 Author: Hannah Stepanek <[email protected]> Date: Mon May 1 13:34:35 2023 -0700 Pin virtualenv, fix pip arg deprecation & disable kafka tests (#803) * Pin virtualenv * Fixup: use 20.21.1 instead * Replace install-options with config-settings See https://github.com/pypa/pip/issues/11358. * Temporarily disable kafka tests commit c2d4629dfd7787354b6607160bb952913975d5f7 Author: Timothy Pansino <[email protected]> Date: Wed May 10 15:59:13 2023 -0700 Add required option for tox v4 (#795) * Add required option for tox v4 * Update tox in GHA * Remove py27 no-cache-dir commit a9636498ab5c20c266fb044a08359c0c9bbcf826 Author: Hannah Stepanek <[email protected]> Date: Tue May 9 10:46:39 2023 -0700 Run coverage around pytest (#813) * Run coverage around pytest * Trigger tests * Fixup * Add redis client_no_touch to ignore list * Temporarily remove kafka from coverage * Remove coverage for old libs commit dc81a50a9fc5f2a5ce6978aa064fdfab1618328b Author: Tim Pansino <[email protected]> Date: Sat May 6 14:16:14 2023 -0700 Wiring dimensional metrics commit 3d8284540e0acd867c2cf680f43449bc128c0779 Author: Lalleh Rafeei <[email protected]> Date: Wed May 3 14:50:30 2023 -0700 Omit some frameworks from coverage analysis (#810) * Omit some frameworks from coverage analysis * Remove commas * Change format of omit * Add relative_files option to coverage * Add absolute directory * Add envsitepackagedir * Add coveragerc file * Add codecov.yml * [Mega-Linter] Apply linters fixes * Revert coveragerc file settings * Add files in packages and more frameworks * Remove commented line --------- Co-authored-by: lrafeei <[email protected]> Co-authored-by: Hannah Stepanek <[email protected]> commit fd0fa35466b630e34e8476cc53ad0e163564e2de Author: Uma Annamalai <[email protected]> Date: Tue May 2 10:55:36 2023 -0700 Add testing for genshi and mako. (#799) * Add testing for genshi and mako. * [Mega-Linter] Apply linters fixes --------- Co-authored-by: umaannamalai <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> commit be4fb3dda0e734889acd6bc53cf91f26c18c2118 Author: Lalleh Rafeei <[email protected]> Date: Mon May 1 16:01:09 2023 -0700 Add tests for Waitress (#797) * Change import format * Initial commit * Add more tests to adapter_waitress * Remove commented out code * [Mega-Linter] Apply linters fixes * Add assertions to all tests * Add more NR testing to waitress --------- Co-authored-by: lrafeei <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> commit 7103506ca5639d339e3e47dfb9e4affb546c839b Author: Hannah Stepanek <[email protected]> Date: Mon May 1 14:12:31 2023 -0700 Add tests for pyodbc (#796) * Add tests for pyodbc * Move imports into tests to get import coverage * Fixup: remove time import * Trigger tests --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Squashed commit of the following: commit 7a384c5935f8d6d24db9b488a7e48a6854efedd6 Author: Tim Pansino <[email protected]> Date: Thu Jun 1 12:10:59 2023 -0700 Cleaning out agent protocol commit c87d31d5d3a91eb7c584f32f9831fbebc1ffe378 Author: Tim Pansino <[email protected]> Date: Thu Jun 1 12:10:46 2023 -0700 Change content-type header commit 5750e546797b16f96e71161f794cb34a253418a6 Author: Tim Pansino <[email protected]> Date: Thu Jun 1 12:05:52 2023 -0700 Add common utilities for OTLP * Remove testing logic * Adding metric serialization helpers * Squashed commit of the following: commit a47e209925a210e85bb6c57f0a2efa9e99630b7f Author: Tim Pansino <[email protected]> Date: Tue Jun 6 11:11:30 2023 -0700 Commit suggestions from code review commit 1a28d36f86dd3f1fa5ca7a8f56357d168aac69db Author: Tim Pansino <[email protected]> Date: Thu May 11 17:28:27 2023 -0700 Cover tags as list not dict commit 71261e3d468320569742a72c690f6ff4e9b3e621 Merge: 459e08567 c2d4629df Author: Timothy Pansino <[email protected]> Date: Thu May 11 16:59:11 2023 -0700 Merge branch 'main' into feature-dimensional-metrics commit 459e08567102cfadce398b57d245ecf99408400d Author: Tim Pansino <[email protected]> Date: Thu May 11 16:57:16 2023 -0700 Add testing for dimensional metrics commit ed33957cd2b20bc1f6e9759a0bad5e4f4a86a38c Author: Tim Pansino <[email protected]> Date: Thu May 11 16:56:31 2023 -0700 Add attribute processing to metric identity commit 6caf71ef4386395d950060e0e996f80dbcbfbc32 Author: Tim Pansino <[email protected]> Date: Thu May 11 16:56:16 2023 -0700 Add dimensional stats table to stats engine commit 5e1cc9dea6d0d9623130dedd0f787408a8439388 Author: Tim Pansino <[email protected]> Date: Wed May 10 16:00:42 2023 -0700 Squashed commit of the following: commit c2d4629dfd7787354b6607160bb952913975d5f7 Author: Timothy Pansino <[email protected]> Date: Wed May 10 15:59:13 2023 -0700 Add required option for tox v4 (#795) * Add required option for tox v4 * Update tox in GHA * Remove py27 no-cache-dir commit a9636498ab5c20c266fb044a08359c0c9bbcf826 Author: Hannah Stepanek <[email protected]> Date: Tue May 9 10:46:39 2023 -0700 Run coverage around pytest (#813) * Run coverage around pytest * Trigger tests * Fixup * Add redis client_no_touch to ignore list * Temporarily remove kafka from coverage * Remove coverage for old libs commit 3d8284540e0acd867c2cf680f43449bc128c0779 Author: Lalleh Rafeei <[email protected]> Date: Wed May 3 14:50:30 2023 -0700 Omit some frameworks from coverage analysis (#810) * Omit some frameworks from coverage analysis * Remove commas * Change format of omit * Add relative_files option to coverage * Add absolute directory * Add envsitepackagedir * Add coveragerc file * Add codecov.yml * [Mega-Linter] Apply linters fixes * Revert coveragerc file settings * Add files in packages and more frameworks * Remove commented line --------- Co-authored-by: lrafeei <[email protected]> Co-authored-by: Hannah Stepanek <[email protected]> commit fd0fa35466b630e34e8476cc53ad0e163564e2de Author: Uma Annamalai <[email protected]> Date: Tue May 2 10:55:36 2023 -0700 Add testing for genshi and mako. (#799) * Add testing for genshi and mako. * [Mega-Linter] Apply linters fixes --------- Co-authored-by: umaannamalai <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> commit be4fb3dda0e734889acd6bc53cf91f26c18c2118 Author: Lalleh Rafeei <[email protected]> Date: Mon May 1 16:01:09 2023 -0700 Add tests for Waitress (#797) * Change import format * Initial commit * Add more tests to adapter_waitress * Remove commented out code * [Mega-Linter] Apply linters fixes * Add assertions to all tests * Add more NR testing to waitress --------- Co-authored-by: lrafeei <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> commit 7103506ca5639d339e3e47dfb9e4affb546c839b Author: Hannah Stepanek <[email protected]> Date: Mon May 1 14:12:31 2023 -0700 Add tests for pyodbc (#796) * Add tests for pyodbc * Move imports into tests to get import coverage * Fixup: remove time import * Trigger tests --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> commit 363122a0efe0ad9f4784fc1f67fda046cb9bb7e8 Author: Hannah Stepanek <[email protected]> Date: Mon May 1 13:34:35 2023 -0700 Pin virtualenv, fix pip arg deprecation & disable kafka tests (#803) * Pin virtualenv * Fixup: use 20.21.1 instead * Replace install-options with config-settings See https://github.com/pypa/pip/issues/11358. * Temporarily disable kafka tests commit c2d4629dfd7787354b6607160bb952913975d5f7 Author: Timothy Pansino <[email protected]> Date: Wed May 10 15:59:13 2023 -0700 Add required option for tox v4 (#795) * Add required option for tox v4 * Update tox in GHA * Remove py27 no-cache-dir commit a9636498ab5c20c266fb044a08359c0c9bbcf826 Author: Hannah Stepanek <[email protected]> Date: Tue May 9 10:46:39 2023 -0700 Run coverage around pytest (#813) * Run coverage around pytest * Trigger tests * Fixup * Add redis client_no_touch to ignore list * Temporarily remove kafka from coverage * Remove coverage for old libs commit dc81a50a9fc5f2a5ce6978aa064fdfab1618328b Author: Tim Pansino <[email protected]> Date: Sat May 6 14:16:14 2023 -0700 Wiring dimensional metrics commit 3d8284540e0acd867c2cf680f43449bc128c0779 Author: Lalleh Rafeei <[email protected]> Date: Wed May 3 14:50:30 2023 -0700 Omit some frameworks from coverage analysis (#810) * Omit some frameworks from coverage analysis * Remove commas * Change format of omit * Add relative_files option to coverage * Add absolute directory * Add envsitepackagedir * Add coveragerc file * Add codecov.yml * [Mega-Linter] Apply linters fixes * Revert coveragerc file settings * Add files in packages and more frameworks * Remove commented line --------- Co-authored-by: lrafeei <[email protected]> Co-authored-by: Hannah Stepanek <[email protected]> commit fd0fa35466b630e34e8476cc53ad0e163564e2de Author: Uma Annamalai <[email protected]> Date: Tue May 2 10:55:36 2023 -0700 Add testing for genshi and mako. (#799) * Add testing for genshi and mako. * [Mega-Linter] Apply linters fixes --------- Co-authored-by: umaannamalai <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> commit be4fb3dda0e734889acd6bc53cf91f26c18c2118 Author: Lalleh Rafeei <[email protected]> Date: Mon May 1 16:01:09 2023 -0700 Add tests for Waitress (#797) * Change import format * Initial commit * Add more tests to adapter_waitress * Remove commented out code * [Mega-Linter] Apply linters fixes * Add assertions to all tests * Add more NR testing to waitress --------- Co-authored-by: lrafeei <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> commit 7103506ca5639d339e3e47dfb9e4affb546c839b Author: Hannah Stepanek <[email protected]> Date: Mon May 1 14:12:31 2023 -0700 Add tests for pyodbc (#796) * Add tests for pyodbc * Move imports into tests to get import coverage * Fixup: remove time import * Trigger tests --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Add protobuf to agent features tests * Proper bucket dimensional metric serialization * Wiring up OTLP protocol for metrics * Correct metrics payloads * Make default content-encoding header configurable * Clean up otlp encoding * Expand OTLP metrics testing * Squashed commit of the following: commit 30f0bf5ce27f239f70b236c639a49715f33ce948 Author: Hannah Stepanek <[email protected]> Date: Fri Jun 9 16:12:09 2023 -0700 Add OTLP protocol class & protos (#821) * Add protos under packages for otlp * Add common otlp proto payload methods * Add new oltp protocol class * Remove ML event from log message * Remove params, add api-key header & expose path The params are not relevant to OTLP so remove these. The api-key header is how we provide the license key to OTLP so add this. The path to upload dimensional metrics and events are different in OTLP so expose the path so it can be overriden inside the coresponding data_collector methods. * Add otlp_port and otlp_host settings * Default to JSON if protobuf not available & warn * Move otlp_utils to core * Call encode in protocol class * Patch issues with data collector * Move resource to utils & add log proto imports --------- Co-authored-by: Tim Pansino <[email protected]> commit e970884dac0e1f9c703c6fdbff408fb923502f51 Author: Timothy Pansino <[email protected]> Date: Thu Jun 8 13:17:28 2023 -0700 Dimensional Metrics (#815) * Wiring dimensional metrics * Squashed commit of the following: commit c2d4629dfd7787354b6607160bb952913975d5f7 Author: Timothy Pansino <[email protected]> Date: Wed May 10 15:59:13 2023 -0700 Add required option for tox v4 (#795) * Add required option for tox v4 * Update tox in GHA * Remove py27 no-cache-dir commit a9636498ab5c20c266fb044a08359c0c9bbcf826 Author: Hannah Stepanek <[email protected]> Date: Tue May 9 10:46:39 2023 -0700 Run coverage around pytest (#813) * Run coverage around pytest * Trigger tests * Fixup * Add redis client_no_touch to ignore list * Temporarily remove kafka from coverage * Remove coverage for old libs commit 3d8284540e0acd867c2cf680f43449bc128c0779 Author: Lalleh Rafeei <[email protected]> Date: Wed May 3 14:50:30 2023 -0700 Omit some frameworks from coverage analysis (#810) * Omit some frameworks from coverage analysis * Remove commas * Change format of omit * Add relative_files option to coverage * Add absolute directory * Add envsitepackagedir * Add coveragerc file * Add codecov.yml * [Mega-Linter] Apply linters fixes * Revert coveragerc file settings * Add files in packages and more frameworks * Remove commented line --------- Co-authored-by: lrafeei <[email protected]> Co-authored-by: Hannah Stepanek <[email protected]> commit fd0fa35466b630e34e8476cc53ad0e163564e2de Author: Uma Annamalai <[email protected]> Date: Tue May 2 10:55:36 2023 -0700 Add testing for genshi and mako. (#799) * Add testing for genshi and mako. * [Mega-Linter] Apply linters fixes --------- Co-authored-by: umaannamalai <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> commit be4fb3dda0e734889acd6bc53cf91f26c18c2118 Author: Lalleh Rafeei <[email protected]> Date: Mon May 1 16:01:09 2023 -0700 Add tests for Waitress (#797) * Change import format * Initial commit * Add more tests to adapter_waitress * Remove commented out code * [Mega-Linter] Apply linters fixes * Add assertions to all tests * Add more NR testing to waitress --------- Co-authored-by: lrafeei <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> commit 7103506ca5639d339e3e47dfb9e4affb546c839b Author: Hannah Stepanek <[email protected]> Date: Mon May 1 14:12:31 2023 -0700 Add tests for pyodbc (#796) * Add tests for pyodbc * Move imports into tests to get import coverage * Fixup: remove time import * Trigger tests --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> commit 363122a0efe0ad9f4784fc1f67fda046cb9bb7e8 Author: Hannah Stepanek <[email protected]> Date: Mon May 1 13:34:35 2023 -0700 Pin virtualenv, fix pip arg deprecation & disable kafka tests (#803) * Pin virtualenv * Fixup: use 20.21.1 instead * Replace install-options with config-settings See https://github.com/pypa/pip/issues/11358. * Temporarily disable kafka tests * Add dimensional stats table to stats engine * Add attribute processing to metric identity * Add testing for dimensional metrics * Cover tags as list not dict * Commit suggestions from code review * Fix missing resource error * Add global settings override for otlp_host test * Fix unbound local variable * Remove redundant and miscategorized tests * Migrate and merge otlp utils to core. * Fix virtualenv for newer tox versions and Py27 * Fix validator for Py27 * Fix dimensional metric normalization * Fix lint errors * Fix pypy 27 naming * Add debug override for metric serialization * Fix exit code passthrough in tox script * Make otlp_encode more robust * Add json vs protobuf testing fixture * Remove sklearn py27 testing * Validate resource in OTLP * Revert unrelated changes from code review * Fixup: service.provider assertion --------- Co-authored-by: Hannah Stepanek <[email protected]> * Fix attribute name mismatches from mlops sdk (#845) * Convert numerical -> numeric * Adjust attr names to match mlops sdk * Add feature_/label_ prefix to type & name attrs * model_name -> modelName * Set event type to inferenceData * Backport main into develop-scikitlearn (#847) * Containerized CI Pipeline (#836) * Revert "Remove Python 2.7 and pypy2 testing (#835)" This reverts commit abb6405d2bfd629ed83f48e8a17b4a28e3a3c352. * Containerize CI process * Publish new docker container for CI images * Rename github actions job * Copyright tag scripts * Drop debug line * Swap to new CI image * Move pip install to just main python * Remove libcurl special case from tox * Install special case packages into main image * Remove unused packages * Remove all other triggers besides manual * Add make run command * Cleanup small bugs * Fix CI Image Tagging (#838) * Correct templated CI image name * Pin pypy2.7 in image * Fix up scripting * Temporarily Restore Old CI Pipeline (#841) * Restore old pipelines * Remove python 2 from setup-python * Rework CI Pipeline (#839) Change pypy to pypy27 in tox. Fix checkout logic Pin tox requires * Fix Tests on New CI (#843) * Remove non-root user * Test new CI image * Change pypy to pypy27 in tox. * Fix checkout logic * Fetch git tags properly * Pin tox requires * Adjust default db settings for github actions * Rename elasticsearch services * Reset to new pipelines * [Mega-Linter] Apply linters fixes * Fix timezone * Fix docker networking * Pin dev image to new sha * Standardize gearman DB settings * Fix elasticsearch settings bug * Fix gearman bug * Add missing odbc headers * Add more debug messages * Swap out dev ci image * Fix required virtualenv version * Swap out dev ci image * Swap out dev ci image * Remove aioredis v1 for EOL * Add coverage paths for docker container * Unpin ci container --------- Co-authored-by: TimPansino <[email protected]> * Fix pypy27 dependency * Add skip for OTLP on py27 --------- Co-authored-by: TimPansino <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Use Dimensional Metrics in SKLearn (#850) * Convert ML custom metrics to dimensional with tags * Rename _class to class_ * Remove typo * Adjust ML metric tests for dimensional metrics * Pin sklearn to <1.11.0 for testing * [Mega-Linter] Apply linters fixes --------- Co-authored-by: TimPansino <[email protected]> * Fixup dependency pinning * Hook up ml event to OTLP (#822) * Use protos and otlp protocol class for ml_events * inferenceData -> InferenceData * Add LogsData import * Add utf-8 encoding for json otlp payload * Cast timestamp to int * Use ml_event validator in tests * Fixup payload tests * Change str_value -> string_value * Move event payload gen into otlp_utils * Fixup: put back print * Fixup: cast as str for py27 * Fixup lint errors * Skip py2 protobuf --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Fix OTLP Count Metric Serialization (#856) * Fix metric filtering in OTLP encoding * Add regression test for duplicate metrics * Make error message more clear * Add pylint ignore C0123 * Add explanation comment * Linting fixups * Merge main (#874) * Exclude command line functionality from test coverage (#855) * FIX: resilient environment settings (#825) if the application uses generalimport to manage optional depedencies, it's possible that generalimport.MissingOptionalDependency is raised. In this case, we should not report the module as it is not actually loaded and is not a runtime dependency of the application. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Hannah Stepanek <[email protected]> * Replace drop_transaction logic by using transaction context manager (#832) * Replace drop_transaction call * [Mega-Linter] Apply linters fixes * Empty commit to start tests * Change logic in BG Wrappers --------- Co-authored-by: lrafeei <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Upgrade to Pypy38 for TypedDict (#861) * Fix base branch * Revert tox dependencies * Replace all pypy37 with pypy38 * Remove action.yml file * Push Empty Commit * Fix skip_missing_interpreters behavior * Fix skip_missing_interpreters behavior * Pin dev CI image sha * Remove unsupported Tornado tests * Add latest tests to Tornado * Remove pypy38 (for now) --------- Co-authored-by: Tim Pansino <[email protected]> * Add profile_trace testing (#858) * Include isort stdlibs for determining stdlib modules * Use isort & sys to eliminate std & builtin modules Previously, the logic would fail to identify third party modules installed within the local user socpe. This fixes that issue by skipping builtin and stdlib modules by name, instead of attempting to identify third party modules based on file paths. * Handle importlib_metadata.version being a callable * Add isort into third party notices * [Mega-Linter] Apply linters fixes * Remove Python 2.7 and pypy2 testing (#835) * Change setup-python to @v2 for py2.7 * Remove py27 and pypy testing * Fix syntax errors * Fix comma related syntax errors * Fix more issues in tox * Remove gearman test * Containerized CI Pipeline (#836) * Revert "Remove Python 2.7 and pypy2 testing (#835)" This reverts commit abb6405d2bfd629ed83f48e8a17b4a28e3a3c352. * Containerize CI process * Publish new docker container for CI images * Rename github actions job * Copyright tag scripts * Drop debug line * Swap to new CI image * Move pip install to just main python * Remove libcurl special case from tox * Install special case packages into main image * Remove unused packages * Remove all other triggers besides manual * Add make run command * Cleanup small bugs * Fix CI Image Tagging (#838) * Correct templated CI image name * Pin pypy2.7 in image * Fix up scripting * Temporarily Restore Old CI Pipeline (#841) * Restore old pipelines * Remove python 2 from setup-python * Rework CI Pipeline (#839) Change pypy to pypy27 in tox. Fix checkout logic Pin tox requires * Fix Tests on New CI (#843) * Remove non-root user * Test new CI image * Change pypy to pypy27 in tox. * Fix checkout logic * Fetch git tags properly * Pin tox requires * Adjust default db settings for github actions * Rename elasticsearch services * Reset to new pipelines * [Mega-Linter] Apply linters fixes * Fix timezone * Fix docker networking * Pin dev image to new sha * Standardize gearman DB settings * Fix elasticsearch settings bug * Fix gearman bug * Add missing odbc headers * Add more debug messages * Swap out dev ci image * Fix required virtualenv version * Swap out dev ci image * Swap out dev ci image * Remove aioredis v1 for EOL * Add coverage paths for docker container * Unpin ci container --------- Co-authored-by: TimPansino <[email protected]> * Trigger tests * Add testing for profile trace. * [Mega-Linter] Apply linters fixes * Ignore __call__ from coverage on profile_trace. * [Mega-Linter] Apply linters fixes --------- Co-authored-by: Hannah Stepanek <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: hmstepanek <[email protected]> Co-authored-by: Lalleh Rafeei <[email protected]> Co-authored-by: Timothy Pansino <[email protected]> Co-authored-by: TimPansino <[email protected]> Co-authored-by: umaannamalai <[email protected]> * Add Transaction API Tests (#857) * Test for suppress_apdex_metric * Add custom_metrics tests * Add distributed_trace_headers testing in existing tests * [Mega-Linter] Apply linters fixes * Remove redundant if-statement * Ignore deprecated transaction function from coverage * [Mega-Linter] Apply linters fixes * Push empty commit * Update newrelic/api/transaction.py --------- Co-authored-by: lrafeei <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Timothy Pansino <[email protected]> Co-authored-by: Uma Annamalai <[email protected]> * Add tests for jinja2. (#842) * Add tests for jinja2. * [Mega-Linter] Apply linters fixes * Update tox.ini Co-authored-by: Timothy Pansino <[email protected]> --------- Co-authored-by: umaannamalai <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Timothy Pansino <[email protected]> * Add tests for newrelic/config.py (#860) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Fix starlette testing matrix for updated behavior. (#869) Co-authored-by: Lalleh Rafeei <[email protected]> Co-authored-by: Hannah Stepanek <[email protected]> Co-authored-by: Uma Annamalai <[email protected]> * Correct Serverless Distributed Tracing Logic (#870) * Fix serverless logic for distributed tracing * Test stubs * Collapse testing changes * Add negative testing to regular DT test suite * Apply linter fixes * [Mega-Linter] Apply linters fixes --------- Co-authored-by: TimPansino <[email protected]> * Fix Kafka CI (#863) * Reenable kafka testing * Add kafka dev lib * Sync install python with devcontainer * Fix kafka local host setting * Drop set -u flag * Pin CI image dev sha * Add parallel flag to kafka * Fix proper exit status * Build librdkafka from source * Updated dev image sha * Remove coverage exclusions * Add new options to better emulate GHA * Reconfigure kafka networking Co-authored-by: Hannah Stepanek <[email protected]> * Fix kafka ports on GHA * Run kafka tests serially * Separate kafka consumer groups * Put CI container makefile back * Remove confluent kafka Py27 for latest * Roll back ubuntu version update * Update dev ci sha --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Hannah Stepanek <[email protected]> * Change image tag to latest (#871) * Change image tag to latest * Use built sha * Fixup * Replace w/ latest * Add full version for pypy3.8 to tox (#872) * Add full version for pypy3.8 * Remove solrpy from tests * Fix merge conflict * Fix tests for scikit-learn >= 1.3.0 In 1.3.0 sklearn renamed fit to _fit in BaseDecisionTree. * Add gfortran to container * Use ci image sha * Add pkg-config * New CI build --------- Co-authored-by: Lalleh Rafeei <[email protected]> Co-authored-by: Ahmed Helil <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: lrafeei <[email protected]> Co-authored-by: Tim Pansino <[email protected]> Co-authored-by: Uma Annamalai <[email protected]> Co-authored-by: hmstepanek <[email protected]> Co-authored-by: Timothy Pansino <[email protected]> Co-authored-by: TimPansino <[email protected]> Co-authored-by: umaannamalai <[email protected]> * Only send 1 event per prediction & fix tests (#867) * Only send 1 event per prediction This changes from sending 1 event per feature/label value to 1 event per prediction. This change is referred to as a change in "schema". * Replace feature_name & feature_value and label_name & label_value to feature.<name> = <value> and label.<name> = <value>. * Remove feature_type and label_type. * Add new_relic_data_schema_version * Remove pypy3.8-scipy will not compile * Remove scipy compile deps * Set ci build back to latest * Merge redis changes mlops (#914) * Exclude command line functionality from test coverage (#855) * FIX: resilient environment settings (#825) if the application uses generalimport to manage optional depedencies, it's possible that generalimport.MissingOptionalDependency is raised. In this case, we should not report the module as it is not actually loaded and is not a runtime dependency of the application. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Hannah Stepanek <[email protected]> * Replace drop_transaction logic by using transaction context manager (#832) * Replace drop_transaction call * [Mega-Linter] Apply linters fixes * Empty commit to start tests * Change logic in BG Wrappers --------- Co-authored-by: lrafeei <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Upgrade to Pypy38 for TypedDict (#861) * Fix base branch * Revert tox dependencies * Replace all pypy37 with pypy38 * Remove action.yml file * Push Empty Commit * Fix skip_missing_interpreters behavior * Fix skip_missing_interpreters behavior * Pin dev CI image sha * Remove unsupported Tornado tests * Add latest tests to Tornado * Remove pypy38 (for now) --------- Co-authored-by: Tim Pansino <[email protected]> * Add profile_trace testing (#858) * Include isort stdlibs for determining stdlib modules * Use isort & sys to eliminate std & builtin modules Previously, the logic would fail to identify third party modules installed within the local user socpe. This fixes that issue by skipping builtin and stdlib modules by name, instead of attempting to identify third party modules based on file paths. * Handle importlib_metadata.version being a callable * Add isort into third party notices * [Mega-Linter] Apply linters fixes * Remove Python 2.7 and pypy2 testing (#835) * Change setup-python to @v2 for py2.7 * Remove py27 and pypy testing * Fix syntax errors * Fix comma related syntax errors * Fix more issues in tox * Remove gearman test * Containerized CI Pipeline (#836) * Revert "Remove Python 2.7 and pypy2 testing (#835)" This reverts commit abb6405d2bfd629ed83f48e8a17b4a28e3a3c352. * Containerize CI process * Publish new docker container for CI images * Rename github actions job * Copyright tag scripts * Drop debug line * Swap to new CI image * Move pip install to just main python * Remove libcurl special case from tox * Install special case packages into main image * Remove unused packages * Remove all other triggers besides manual * Add make run command * Cleanup small bugs * Fix CI Image Tagging (#838) * Correct templated CI image name * Pin pypy2.7 in image * Fix up scripting * Temporarily Restore Old CI Pipeline (#841) * Restore old pipelines * Remove python 2 from setup-python * Rework CI Pipeline (#839) Change pypy to pypy27 in tox. Fix checkout logic Pin tox requires * Fix Tests on New CI (#843) * Remove non-root user * Test new CI image * Change pypy to pypy27 in tox. * Fix checkout logic * Fetch git tags properly * Pin tox requires * Adjust default db settings for github actions * Rename elasticsearch services * Reset to new pipelines * [Mega-Linter] Apply linters fixes * Fix timezone * Fix docker networking * Pin dev image to new sha * Standardize gearman DB settings * Fix elasticsearch settings bug * Fix gearman bug * Add missing odbc headers * Add m…
1 parent eff66b5 commit 17cd48d

File tree

73 files changed

+9085
-149
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+9085
-149
lines changed

MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ include newrelic/packages/wrapt/LICENSE
99
include newrelic/packages/wrapt/README
1010
include newrelic/packages/urllib3/LICENSE.txt
1111
include newrelic/packages/isort/LICENSE
12+
include newrelic/packages/opentelemetry_proto/LICENSE.txt

THIRD_PARTY_NOTICES.md

+9
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ Distributed under the following license(s):
2626
* [The MIT License](http://opensource.org/licenses/MIT)
2727

2828

29+
## [opentelemetry-proto](https://pypi.org/project/opentelemetry-proto)
30+
31+
Copyright (c) The OpenTelemetry Authors
32+
33+
Distributed under the following license(s):
34+
35+
* [The Apache License, Version 2.0 License](https://opensource.org/license/apache-2-0/)
36+
37+
2938
## [six](https://pypi.org/project/six)
3039

3140
Copyright (c) 2010-2013 Benjamin Peterson

newrelic/agent.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
from newrelic.api.transaction import record_custom_metric as __record_custom_metric
6060
from newrelic.api.transaction import record_custom_metrics as __record_custom_metrics
6161
from newrelic.api.transaction import record_log_event as __record_log_event
62+
from newrelic.api.transaction import record_ml_event as __record_ml_event
6263
from newrelic.api.transaction import set_background_task as __set_background_task
6364
from newrelic.api.transaction import set_transaction_name as __set_transaction_name
6465
from newrelic.api.transaction import suppress_apdex_metric as __suppress_apdex_metric
@@ -152,6 +153,7 @@ def __asgi_application(*args, **kwargs):
152153
from newrelic.api.message_transaction import (
153154
wrap_message_transaction as __wrap_message_transaction,
154155
)
156+
from newrelic.api.ml_model import wrap_mlmodel as __wrap_mlmodel
155157
from newrelic.api.profile_trace import ProfileTraceWrapper as __ProfileTraceWrapper
156158
from newrelic.api.profile_trace import profile_trace as __profile_trace
157159
from newrelic.api.profile_trace import wrap_profile_trace as __wrap_profile_trace
@@ -206,11 +208,6 @@ def __asgi_application(*args, **kwargs):
206208
# EXPERIMENTAL - Generator traces are currently experimental and may not
207209
# exist in this form in future versions of the agent.
208210

209-
210-
# EXPERIMENTAL - Profile traces are currently experimental and may not
211-
# exist in this form in future versions of the agent.
212-
213-
214211
initialize = __initialize
215212
extra_settings = __wrap_api_call(__extra_settings, "extra_settings")
216213
global_settings = __wrap_api_call(__global_settings, "global_settings")
@@ -248,6 +245,7 @@ def __asgi_application(*args, **kwargs):
248245
record_custom_metrics = __wrap_api_call(__record_custom_metrics, "record_custom_metrics")
249246
record_custom_event = __wrap_api_call(__record_custom_event, "record_custom_event")
250247
record_log_event = __wrap_api_call(__record_log_event, "record_log_event")
248+
record_ml_event = __wrap_api_call(__record_ml_event, "record_ml_event")
251249
accept_distributed_trace_payload = __wrap_api_call(
252250
__accept_distributed_trace_payload, "accept_distributed_trace_payload"
253251
)
@@ -341,3 +339,4 @@ def __asgi_application(*args, **kwargs):
341339
wrap_out_function = __wrap_api_call(__wrap_out_function, "wrap_out_function")
342340
insert_html_snippet = __wrap_api_call(__insert_html_snippet, "insert_html_snippet")
343341
verify_body_exists = __wrap_api_call(__verify_body_exists, "verify_body_exists")
342+
wrap_mlmodel = __wrap_api_call(__wrap_mlmodel, "wrap_mlmodel")

newrelic/api/application.py

+12
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,22 @@ def record_custom_metrics(self, metrics):
142142
if self.active and metrics:
143143
self._agent.record_custom_metrics(self._name, metrics)
144144

145+
def record_dimensional_metric(self, name, value, tags=None):
146+
if self.active:
147+
self._agent.record_dimensional_metric(self._name, name, value, tags)
148+
149+
def record_dimensional_metrics(self, metrics):
150+
if self.active and metrics:
151+
self._agent.record_dimensional_metrics(self._name, metrics)
152+
145153
def record_custom_event(self, event_type, params):
146154
if self.active:
147155
self._agent.record_custom_event(self._name, event_type, params)
148156

157+
def record_ml_event(self, event_type, params):
158+
if self.active:
159+
self._agent.record_ml_event(self._name, event_type, params)
160+
149161
def record_transaction(self, data):
150162
if self.active:
151163
self._agent.record_transaction(self._name, data)

newrelic/api/ml_model.py

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright 2010 New Relic, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import sys
16+
17+
from newrelic.common.object_names import callable_name
18+
from newrelic.hooks.mlmodel_sklearn import _nr_instrument_model
19+
20+
21+
def wrap_mlmodel(model, name=None, version=None, feature_names=None, label_names=None, metadata=None):
22+
model_callable_name = callable_name(model)
23+
_class = model.__class__.__name__
24+
module = sys.modules[model_callable_name.split(":")[0]]
25+
_nr_instrument_model(module, _class)
26+
if name:
27+
model._nr_wrapped_name = name
28+
if version:
29+
model._nr_wrapped_version = version
30+
if feature_names:
31+
model._nr_wrapped_feature_names = feature_names
32+
if label_names:
33+
model._nr_wrapped_label_names = label_names
34+
if metadata:
35+
model._nr_wrapped_metadata = metadata

newrelic/api/transaction.py

+100-2
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,15 @@
6060
DST_NONE,
6161
DST_TRANSACTION_TRACER,
6262
)
63-
from newrelic.core.config import CUSTOM_EVENT_RESERVOIR_SIZE, LOG_EVENT_RESERVOIR_SIZE
63+
from newrelic.core.config import (
64+
CUSTOM_EVENT_RESERVOIR_SIZE,
65+
LOG_EVENT_RESERVOIR_SIZE,
66+
ML_EVENT_RESERVOIR_SIZE,
67+
)
6468
from newrelic.core.custom_event import create_custom_event
6569
from newrelic.core.log_event_node import LogEventNode
6670
from newrelic.core.stack_trace import exception_stack
67-
from newrelic.core.stats_engine import CustomMetrics, SampledDataSet
71+
from newrelic.core.stats_engine import CustomMetrics, DimensionalMetrics, SampledDataSet
6872
from newrelic.core.thread_utilization import utilization_tracker
6973
from newrelic.core.trace_cache import (
7074
TraceCacheActiveTraceError,
@@ -305,6 +309,7 @@ def __init__(self, application, enabled=None, source=None):
305309
self.synthetics_header = None
306310

307311
self._custom_metrics = CustomMetrics()
312+
self._dimensional_metrics = DimensionalMetrics()
308313

309314
global_settings = application.global_settings
310315

@@ -328,12 +333,14 @@ def __init__(self, application, enabled=None, source=None):
328333
self._custom_events = SampledDataSet(
329334
capacity=self._settings.event_harvest_config.harvest_limits.custom_event_data
330335
)
336+
self._ml_events = SampledDataSet(capacity=self._settings.event_harvest_config.harvest_limits.ml_event_data)
331337
self._log_events = SampledDataSet(
332338
capacity=self._settings.event_harvest_config.harvest_limits.log_event_data
333339
)
334340
else:
335341
self._custom_events = SampledDataSet(capacity=CUSTOM_EVENT_RESERVOIR_SIZE)
336342
self._log_events = SampledDataSet(capacity=LOG_EVENT_RESERVOIR_SIZE)
343+
self._ml_events = SampledDataSet(capacity=ML_EVENT_RESERVOIR_SIZE)
337344

338345
def __del__(self):
339346
self._dead = True
@@ -580,10 +587,12 @@ def __exit__(self, exc, value, tb):
580587
errors=tuple(self._errors),
581588
slow_sql=tuple(self._slow_sql),
582589
custom_events=self._custom_events,
590+
ml_events=self._ml_events,
583591
log_events=self._log_events,
584592
apdex_t=self.apdex,
585593
suppress_apdex=self.suppress_apdex,
586594
custom_metrics=self._custom_metrics,
595+
dimensional_metrics=self._dimensional_metrics,
587596
guid=self.guid,
588597
cpu_time=self._cpu_user_time_value,
589598
suppress_transaction_trace=self.suppress_transaction_trace,
@@ -1607,6 +1616,16 @@ def record_custom_metrics(self, metrics):
16071616
for name, value in metrics:
16081617
self._custom_metrics.record_custom_metric(name, value)
16091618

1619+
def record_dimensional_metric(self, name, value, tags=None):
1620+
self._dimensional_metrics.record_dimensional_metric(name, value, tags)
1621+
1622+
def record_dimensional_metrics(self, metrics):
1623+
for metric in metrics:
1624+
name, value = metric[:2]
1625+
tags = metric[2] if len(metric) >= 3 else None
1626+
1627+
self._dimensional_metrics.record_dimensional_metric(name, value, tags)
1628+
16101629
def record_custom_event(self, event_type, params):
16111630
settings = self._settings
16121631

@@ -1620,6 +1639,19 @@ def record_custom_event(self, event_type, params):
16201639
if event:
16211640
self._custom_events.add(event, priority=self.priority)
16221641

1642+
def record_ml_event(self, event_type, params):
1643+
settings = self._settings
1644+
1645+
if not settings:
1646+
return
1647+
1648+
if not settings.ml_insights_events.enabled:
1649+
return
1650+
1651+
event = create_custom_event(event_type, params)
1652+
if event:
1653+
self._ml_events.add(event, priority=self.priority)
1654+
16231655
def _intern_string(self, value):
16241656
return self._string_cache.setdefault(value, value)
16251657

@@ -1913,6 +1945,44 @@ def record_custom_metrics(metrics, application=None):
19131945
application.record_custom_metrics(metrics)
19141946

19151947

1948+
def record_dimensional_metric(name, value, tags=None, application=None):
1949+
if application is None:
1950+
transaction = current_transaction()
1951+
if transaction:
1952+
transaction.record_dimensional_metric(name, value, tags)
1953+
else:
1954+
_logger.debug(
1955+
"record_dimensional_metric has been called but no "
1956+
"transaction was running. As a result, the following metric "
1957+
"has not been recorded. Name: %r Value: %r Tags: %r. To correct this "
1958+
"problem, supply an application object as a parameter to this "
1959+
"record_dimensional_metrics call.",
1960+
name,
1961+
value,
1962+
tags,
1963+
)
1964+
elif application.enabled:
1965+
application.record_dimensional_metric(name, value, tags)
1966+
1967+
1968+
def record_dimensional_metrics(metrics, application=None):
1969+
if application is None:
1970+
transaction = current_transaction()
1971+
if transaction:
1972+
transaction.record_dimensional_metrics(metrics)
1973+
else:
1974+
_logger.debug(
1975+
"record_dimensional_metrics has been called but no "
1976+
"transaction was running. As a result, the following metrics "
1977+
"have not been recorded: %r. To correct this problem, "
1978+
"supply an application object as a parameter to this "
1979+
"record_dimensional_metric call.",
1980+
list(metrics),
1981+
)
1982+
elif application.enabled:
1983+
application.record_dimensional_metrics(metrics)
1984+
1985+
19161986
def record_custom_event(event_type, params, application=None):
19171987
"""Record a custom event.
19181988
@@ -1941,6 +2011,34 @@ def record_custom_event(event_type, params, application=None):
19412011
application.record_custom_event(event_type, params)
19422012

19432013

2014+
def record_ml_event(event_type, params, application=None):
2015+
"""Record a machine learning custom event.
2016+
2017+
Args:
2018+
event_type (str): The type (name) of the ml event.
2019+
params (dict): Attributes to add to the event.
2020+
application (newrelic.api.Application): Application instance.
2021+
2022+
"""
2023+
2024+
if application is None:
2025+
transaction = current_transaction()
2026+
if transaction:
2027+
transaction.record_ml_event(event_type, params)
2028+
else:
2029+
_logger.debug(
2030+
"record_ml_event has been called but no "
2031+
"transaction was running. As a result, the following event "
2032+
"has not been recorded. event_type: %r params: %r. To correct "
2033+
"this problem, supply an application object as a parameter to "
2034+
"this record_ml_event call.",
2035+
event_type,
2036+
params,
2037+
)
2038+
elif application.enabled:
2039+
application.record_ml_event(event_type, params)
2040+
2041+
19442042
def record_log_event(message, level=None, timestamp=None, application=None, priority=None):
19452043
"""Record a log event.
19462044

0 commit comments

Comments
 (0)