Skip to content

DEBUG: Azure function instrumentation testing #1344

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

Draft
wants to merge 98 commits into
base: feature-azure-functions
Choose a base branch
from

Conversation

lrafeei
Copy link
Contributor

@lrafeei lrafeei commented Apr 1, 2025

WIP

Create integration tests in CI/CD for azure-functions.

Notes to consider:

  • The application that gets published to the portal must have the following files with the exact names:
  1. function_app.py
  2. requirements.txt
  3. host.json
  • These files get uploaded to the /home/site/wwwroot/ directory. The packages in the requirements.txt then get installed in the /home/site/wwwroot/.python_packages/lib/site-packages directory.
  • Local testing can be done through installing azure-functions-core-tools-4 (homebrew on mac) and then azure-functions (pip)
  • Azure core tools install will be found in this area: /usr/local/Cellar/azure-functions-core-tools@4/{specific_version}/workers/python/{python_version}/{operating_system}/{architecture}/azure_functions_worker/
  • Local install entrypoint exists here: /usr/local/Cellar/azure-functions-core-tools@4/{specific_version}/workers/python/{python_version}/{operating_system}/{architecture}/worker.py
  • Note that installing core tools locally will show files that have been "translated" into Python. This is not the behavior when using Azure Function Apps itself. The dispatcher.py file in the portal is split into a pre-compiled file and Python (connect and dispatch_forever do not run in Python for example). The point where the Python implementation begins is the _handle__invocation_request function.
  • The docker image, found here, https://github.com/Azure/azure-functions-docker, handles this in the same manner that the portal handles this.
  • The assumption is that the app, which must be named function_app.py, is in the /home/site/wwwroot/ directory.

Copy link

github-actions bot commented Apr 1, 2025

🦙 MegaLinter status: ❌ ERROR

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ ACTION actionlint 4 0 0 0.51s
✅ MARKDOWN markdownlint 7 0 0 0 0.97s
✅ MARKDOWN markdown-link-check 7 0 0 9.63s
❌ PYTHON ruff 897 2 1 0 0.57s
✅ PYTHON ruff-format 897 3 0 0 0.3s
✅ YAML prettier 10 1 0 0 1.2s
✅ YAML v8r 10 0 0 6.52s
✅ YAML yamllint 10 0 0 0.59s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

@mergify mergify bot added the tests-failing label Apr 1, 2025
@codecov-commenter
Copy link

codecov-commenter commented Apr 1, 2025

Codecov Report

Attention: Patch coverage is 12.04188% with 168 lines in your changes missing coverage. Please review.

Project coverage is 80.62%. Comparing base (9223f7a) to head (ab715dd).

Files with missing lines Patch % Lines
newrelic/hooks/serverless_azure.py 0.00% 152 Missing ⚠️
newrelic/common/utilization.py 53.33% 12 Missing and 2 partials ⚠️
newrelic/api/transaction.py 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@                     Coverage Diff                     @@
##           feature-azure-functions    #1344      +/-   ##
===========================================================
- Coverage                    81.48%   80.62%   -0.86%     
===========================================================
  Files                          204      205       +1     
  Lines                        22821    23010     +189     
  Branches                      3617     3659      +42     
===========================================================
- Hits                         18595    18552      -43     
- Misses                        3013     3246     +233     
+ Partials                      1213     1212       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants