opentelemetry-python-contrib icon indicating copy to clipboard operation
opentelemetry-python-contrib copied to clipboard

Add an exclude_paths config like exclude_urls, …

Open bsmedberg-xometry opened this issue 2 years ago • 7 comments
trafficstars

…but avoiding the problem of having to match full URLs using regular expressions.

Description

exclude_urls, because it matches the full URL including protocol/domain at the beginning and query at the end, is very difficult to reliably match on with a regular expression. This leaves the common pattern to just use bare/unanchored configurations such as exclude_urls="ping" which could easily match other URLs like "/housekeeping". This PR allows matching just against the path portion of a URL, so that you can anchor the regex more reliably, e.g. "^/ping$" or "^/ping".

I have currently implemented this only for the Flask integration, because that's my use-case, but I think this could be valuable for all of the inbound server integrations.

Type of change

Please delete options that are not relevant.

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • [x] added automated tests to the flask integration, and existing tests continue to run correctly.

Does This PR Require a Core Repo Change?

  • [ ] Yes. - Link to PR:
  • [ ] No.

I don't think so, but I'm not sure what "core repo" means. This does affect the opentelemetry-util-http repository.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • [ ] Followed the style guidelines of this project
  • [ ] Changelogs have been updated
  • [x] Unit tests have been added
  • [x] Documentation has been updated

I think I've followed the style guide, but I'm not sure if there's a checker I can use to validate that. I haven't yet modified the changelog, because I wanted to get feedback on the PR first and my experience is that changelog updates tend to bitrot quickly.

bsmedberg-xometry avatar Jun 20 '23 19:06 bsmedberg-xometry

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: bsmedberg-xometry (a831bd7c86218cc14fc1b8cdc801917d833ec179, 0a2d798d0602dd3c573d0e44f3b4afb6fe565629, 3ba9528fabb0e814449ebbd302f58fbdb97f6453, f9a8b22edbc8e7c82bd698ee05bccfbc7b59120a, 6e54a483809adf0112c9908dd31992ed79c406d2, f72a80000ed43efef6ae9f30ebc6d5a1be9f2f6d)

Please fix the lint errors

shalevr avatar Jun 26 '23 09:06 shalevr

@shalevr is there a doc about how to run all the lint/checks locally? I saw the previous black failure, fixed that, and now I see another and so I'd like to fix them all before I push again.

I'm still working with my legal team on the CLA.

bsmedberg-xometry avatar Jun 27 '23 14:06 bsmedberg-xometry

@shalevr is there a doc about how to run all the lint/checks locally? I saw the previous black failure, fixed that, and now I see another and so I'd like to fix them all before I push again.

I'm still working with my legal team on the CLA.

You need to run "tox -e lint" or just the Python code formatter "black --config pyproject.toml ."

shalevr avatar Jun 27 '23 15:06 shalevr

ok, CLA is set up and I've attempted to set up the changelog.

bsmedberg-xometry avatar Jun 30 '23 20:06 bsmedberg-xometry

Please fix the conflicts

shalevr avatar Jul 02 '23 09:07 shalevr

The failure in pypy3, instrumentation, ubuntu-20.04 appears to be a random timing error in the test. Can somebody verify for me or if I caused this, help me identify what I'd do to debug?

bsmedberg-xometry avatar Jul 03 '23 17:07 bsmedberg-xometry