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

Add ignore_urls to central config #872

Merged
merged 9 commits into from Jan 27, 2021

Conversation

jalvz
Copy link
Contributor

@jalvz jalvz commented Jan 19, 2021

Closes #814

@apmmachine
Copy link
Collaborator

apmmachine commented Jan 19, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Pull request #872 updated

    • Start Time: 2021-01-25T09:46:14.092+0000
  • Duration: 24 min 14 sec

  • Commit: 1047074

Test stats 🧪

Test Results
Failed 0
Passed 7672
Skipped 188
Total 7860

Copy link
Member

@axw axw 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!

A couple of additional bits are needed:

  • In newTracer, another call to t.setLocalInstrumentationConfig is needed to set the initial local config. This is required so if remote config is set, and then later unset, the tracer will revert to the local config.
  • In config_test.go, add a subtest to TestTracerCentralConfigUpdate for "transaction_ignore_urls"

config.go Outdated Show resolved Hide resolved
module/apmhttp/ignorer.go Outdated Show resolved Hide resolved
module/apmhttp/ignorer.go Outdated Show resolved Hide resolved
module/apmhttp/handler.go Outdated Show resolved Hide resolved
@jalvz jalvz marked this pull request as ready for review January 21, 2021 09:18
config.go Outdated Show resolved Hide resolved
config.go Outdated Show resolved Hide resolved
@@ -53,6 +56,15 @@ func DefaultServerRequestIgnorer() RequestIgnorerFunc {
return defaultServerRequestIgnorer
}

// DynamicServerRequestIgnorer returns the RequestIgnorer to use in
// handlers. The list of wildcard patterns comes from central config
func DynamicServerRequestIgnorer(t *apm.Tracer) RequestIgnorerFunc {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
func DynamicServerRequestIgnorer(t *apm.Tracer) RequestIgnorerFunc {
func NewDynamicServerRequestIgnorer(t *apm.Tracer) RequestIgnorerFunc {

Let's align the naming with the other functions below, since DefaultServerRequestIgnorer will be going away eventually.

Copy link
Member

Choose a reason for hiding this comment

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

In fact, if you implement the suggestion above about changing Tracer.IgnoredTransactionURLMatchers to IgnoredTransactionURL, then we can just pass tracer.IgnoredTransactionURL directly in as it will satisfy the function signature -- no need for (New)DynamicServerRequestIgnorer then.

Copy link
Member

Choose a reason for hiding this comment

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

I realise now that RequestIgnorerFunc takes an *http.Request, whereas IgnoredTransactionURL takes a URL, so my second comment doesn't work. But let's please align the naming, and add New to the front.

@AlexanderWert AlexanderWert added this to Planned in APM-Agents (OLD) via automation Jan 21, 2021
@AlexanderWert AlexanderWert moved this from Planned to In Progress in APM-Agents (OLD) Jan 21, 2021
CHANGELOG.asciidoc Outdated Show resolved Hide resolved
@@ -53,6 +56,15 @@ func DefaultServerRequestIgnorer() RequestIgnorerFunc {
return defaultServerRequestIgnorer
}

// DynamicServerRequestIgnorer returns the RequestIgnorer to use in
// handlers. The list of wildcard patterns comes from central config
func DynamicServerRequestIgnorer(t *apm.Tracer) RequestIgnorerFunc {
Copy link
Member

Choose a reason for hiding this comment

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

I realise now that RequestIgnorerFunc takes an *http.Request, whereas IgnoredTransactionURL takes a URL, so my second comment doesn't work. But let's please align the naming, and add New to the front.

module/apmhttp/ignorer_test.go Outdated Show resolved Hide resolved
Copy link
Member

@axw axw left a comment

Choose a reason for hiding this comment

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

LGTM once the extraneous test is removed. Thank you!

module/apmhttp/ignorer_test.go Outdated Show resolved Hide resolved
jalvz and others added 2 commits January 25, 2021 08:20
Co-authored-by: Andrew Wilkins <axwalk@gmail.com>
@codecov-io
Copy link

Codecov Report

Merging #872 (1047074) into master (ba58cd6) will increase coverage by 0.00%.
The diff coverage is 90.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #872   +/-   ##
=======================================
  Coverage   83.70%   83.70%           
=======================================
  Files         142      142           
  Lines        7934     7959   +25     
=======================================
+ Hits         6641     6662   +21     
- Misses        885      889    +4     
  Partials      408      408           
Impacted Files Coverage Δ
tracer.go 88.58% <50.00%> (-0.49%) ⬇️
config.go 72.29% <100.00%> (+1.12%) ⬆️
module/apmecho/middleware.go 88.76% <100.00%> (+0.12%) ⬆️
module/apmgin/middleware.go 86.76% <100.00%> (+0.19%) ⬆️
module/apmgorilla/middleware.go 83.78% <100.00%> (+0.45%) ⬆️
module/apmhttp/handler.go 78.90% <100.00%> (+0.16%) ⬆️
module/apmhttp/ignorer.go 55.55% <100.00%> (+5.55%) ⬆️
module/apmhttprouter/handler.go 76.36% <100.00%> (+0.43%) ⬆️
module/apmrestful/filter.go 89.36% <100.00%> (+0.23%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba58cd6...1047074. Read the comment docs.

@jalvz jalvz merged commit 697d794 into elastic:master Jan 27, 2021
APM-Agents (OLD) automation moved this from In Progress to Done Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging this pull request may close these issues.

TRANSACTION_IGNORE_URLS should be dynamically configurable
4 participants