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

feat(azure_functions): add azure functions integration #11474

Merged
merged 20 commits into from
Dec 18, 2024

Conversation

duncanpharvey
Copy link
Contributor

@duncanpharvey duncanpharvey commented Nov 20, 2024

This PR adds an integration for tracing the azure-functions package.

Additional Notes:

Checklist

  • PR author has checked that all the criteria below are met
  • The PR description includes an overview of the change
  • The PR description articulates the motivation for the change
  • The change includes tests OR the PR description describes a testing strategy
  • The PR description notes risks associated with the change, if any
  • Newly-added code is easy to change
  • The change follows the library release note guidelines
  • The change includes or references documentation updates if necessary
  • Backport labels are set (if applicable)

Reviewer Checklist

  • Reviewer has checked that all the criteria below are met
  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Newly-added code is easy to change
  • Release note makes sense to a user of the library
  • If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
  • Backport labels are set in a manner that is consistent with the release branch maintenance policy

Copy link
Contributor

github-actions bot commented Nov 20, 2024

CODEOWNERS have been resolved as:

.riot/requirements/1337ee3.txt                                          @DataDog/apm-python
.riot/requirements/14b54db.txt                                          @DataDog/apm-python
.riot/requirements/1e62aea.txt                                          @DataDog/apm-python
.riot/requirements/73109d5.txt                                          @DataDog/apm-python
.riot/requirements/c2420c2.txt                                          @DataDog/apm-python
ddtrace/contrib/azure_functions/__init__.py                             @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/azure_functions/patch.py                                @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/azure_functions/patch.py                       @DataDog/apm-core-python @DataDog/apm-idm-python
releasenotes/notes/feat-add-azure-functions-integration-108911bfe1e5f081.yaml  @DataDog/apm-python
tests/contrib/azure_functions/__init__.py                               @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/azure_functions/azure_function_app/function_app.py        @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/azure_functions/azure_function_app/host.json              @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/azure_functions/azure_function_app/local.settings.json    @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/azure_functions/test_azure_functions_patch.py             @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/azure_functions/test_azure_functions_snapshot.py          @DataDog/apm-core-python @DataDog/apm-idm-python
tests/snapshots/tests.contrib.azure_functions.test_azure_functions_snapshot.test_http_get_error.json  @DataDog/apm-python
tests/snapshots/tests.contrib.azure_functions.test_azure_functions_snapshot.test_http_get_ok.json  @DataDog/apm-python
tests/snapshots/tests.contrib.azure_functions.test_azure_functions_snapshot.test_http_post_ok.json  @DataDog/apm-python
ddtrace/_monkey.py                                                      @DataDog/apm-core-python
ddtrace/_trace/trace_handlers.py                                        @DataDog/apm-sdk-api-python
ddtrace/ext/__init__.py                                                 @DataDog/apm-core-python @DataDog/apm-idm-python
riotfile.py                                                             @DataDog/apm-python
tests/contrib/suitespec.yml                                             @DataDog/apm-core-python @DataDog/apm-idm-python

@duncanpharvey duncanpharvey changed the title Add Azure Functions Integration feat: add azure functions integration Nov 20, 2024
@duncanpharvey duncanpharvey force-pushed the duncan-harvey/azure-functions-integration branch from 7c49099 to b9e3a70 Compare November 25, 2024 20:39
@duncanpharvey duncanpharvey force-pushed the duncan-harvey/azure-functions-integration branch from b9e3a70 to 10a50a1 Compare November 25, 2024 20:40
@pr-commenter
Copy link

pr-commenter bot commented Nov 25, 2024

Benchmarks

Benchmark execution time: 2024-12-18 02:05:36

Comparing candidate commit bf3baa9 in PR branch duncan-harvey/azure-functions-integration with baseline commit de9bc48 in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 378 metrics, 2 unstable metrics.

@duncanpharvey duncanpharvey force-pushed the duncan-harvey/azure-functions-integration branch 3 times, most recently from 1fc8c18 to 12969c6 Compare November 26, 2024 15:23
@duncanpharvey duncanpharvey force-pushed the duncan-harvey/azure-functions-integration branch from 12969c6 to fb17586 Compare November 26, 2024 15:24
@duncanpharvey duncanpharvey force-pushed the duncan-harvey/azure-functions-integration branch from fb17586 to cdecdaa Compare November 26, 2024 16:20
@duncanpharvey duncanpharvey changed the title feat: add azure functions integration feat(azure_functions): add azure functions integration Nov 26, 2024
@duncanpharvey duncanpharvey marked this pull request as ready for review November 26, 2024 18:29
@duncanpharvey duncanpharvey requested review from a team as code owners November 26, 2024 18:29
@duncanpharvey duncanpharvey force-pushed the duncan-harvey/azure-functions-integration branch from ca0a772 to 547dc32 Compare November 26, 2024 18:51
Copy link
Collaborator

@emmettbutler emmettbutler left a comment

Choose a reason for hiding this comment

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

Looking good! There are a few areas where this change could be more aligned with our common practice in this repo.

.circleci/config.templ.yml Outdated Show resolved Hide resolved
tests/contrib/azure_functions/test_azure_functions.py Outdated Show resolved Hide resolved
ddtrace/contrib/azure_functions/patch.py Show resolved Hide resolved
ddtrace/contrib/internal/azure_functions/patch.py Outdated Show resolved Hide resolved
@datadog-dd-trace-py-rkomorn
Copy link

datadog-dd-trace-py-rkomorn bot commented Dec 4, 2024

Datadog Report

Branch report: duncan-harvey/azure-functions-integration
Commit report: 04c98f4
Test service: dd-trace-py

✅ 0 Failed, 697 Passed, 771 Skipped, 5m 11.71s Total duration (28m 17.54s time saved)

@wconti27
Copy link
Contributor

@duncanpharvey Can you please provide instructions for running these tests locally? When I try running with riot -v run -p 3.11 --pass-env ^azure_functions$ -s -- -vv -k test_http_get_ok, I get failures saying 404 page not found?

@duncanpharvey
Copy link
Contributor Author

duncanpharvey commented Dec 11, 2024

@duncanpharvey Can you please provide instructions for running these tests locally? When I try running with riot -v run -p 3.11 --pass-env ^azure_functions$ -s -- -vv -k test_http_get_ok, I get failures saying 404 page not found?

Sure!

  • Start test agent: docker compose up -d testagent
  • Start testrunner shell (azure-functions-core-tools is only installed on amd64 architecture): DOCKER_DEFAULT_PLATFORM=linux/amd64 scripts/ddtest
  • Run test with traces sent to test agent (in testrunner shell): DD_AGENT_PORT=9126 riot -v run -p 3.11 --pass-env ^azure_functions$ -s -- -vv -k test_http_get_ok

Sometimes on the initial run it times out when starting up the Azure Function. If you add a delay to client.wait(), like delay=0.5 it should work. I don't see this issue when the tests run in CI.

12/13 update: I committed this retry delay so it doesn't trip up someone running these tests locally in the future. It shouldn't affect how long the tests take to run in CI.

Copy link
Contributor

@wconti27 wconti27 left a comment

Choose a reason for hiding this comment

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

If possible, we should try to detect/infer a user's expected service name for the function

@duncanpharvey duncanpharvey merged commit beb87f6 into main Dec 18, 2024
589 checks passed
@duncanpharvey duncanpharvey deleted the duncan-harvey/azure-functions-integration branch December 18, 2024 02:50
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.

8 participants