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

Ensure transaction_ignore_urls is centrally configurable #988

Closed
AlexanderWert opened this issue Dec 14, 2020 · 1 comment
Closed

Ensure transaction_ignore_urls is centrally configurable #988

AlexanderWert opened this issue Dec 14, 2020 · 1 comment
Milestone

Comments

@AlexanderWert
Copy link
Member

Meta issue elastic/apm#144 has been implemented in #772.

Configuration option has been added in Kibana for the Python agent: elastic/kibana#85734

The purpose of this issue is to make sure that agent supports central configuration for this option.

@AlexanderWert AlexanderWert added this to the 7.11 milestone Dec 14, 2020
@AlexanderWert AlexanderWert changed the title Ensure transaction_ignoe_urls is centrally configurable Ensure transaction_ignore_urls is centrally configurable Dec 14, 2020
@beniwohli
Copy link
Contributor

Hey @AlexanderWert

this is already implemented and tested. We ensure that configuration updates by central config are respected by calling config.update() in the test and then asserting that the new configuration has the expected effect, e.g.

@pytest.mark.parametrize(
"setting,url,result",
[
("", "/foo/bar", False),
("*", "/foo/bar", True),
("/foo/bar,/baz", "/foo/bar", True),
("/foo/bar,/baz", "/baz", True),
("/foo/bar,/bazz", "/baz", False),
("/foo/*/bar,/bazz", "/foo/bar", False),
("/foo/*/bar,/bazz", "/foo/ooo/bar", True),
("*/foo/*/bar,/bazz", "/foo/ooo/bar", True),
("*/foo/*/bar,/bazz", "/baz/foo/ooo/bar", True),
],
)
def test_should_ignore_url(elasticapm_client, setting, url, result):
elasticapm_client.config.update(1, transaction_ignore_urls=setting)
assert elasticapm_client.should_ignore_url(url) is result

def test_django_ignore_transaction_urls(client, django_elasticapm_client):
with override_settings(
**middleware_setting(django.VERSION, ["elasticapm.contrib.django.middleware.TracingMiddleware"])
):
client.get("/no-error")
assert len(django_elasticapm_client.events[TRANSACTION]) == 1
django_elasticapm_client.config.update(1, transaction_ignore_urls="/no*")
client.get("/no-error")
assert len(django_elasticapm_client.events[TRANSACTION]) == 1

def test_flask_transaction_ignore_urls(flask_apm_client):
resp = flask_apm_client.app.test_client().get("/users/")
resp.close()
assert len(flask_apm_client.client.events[TRANSACTION]) == 1
flask_apm_client.client.config.update(version=1, transaction_ignore_urls="/user*")
resp = flask_apm_client.app.test_client().get("/users/")
resp.close()
assert len(flask_apm_client.client.events[TRANSACTION]) == 1

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

No branches or pull requests

2 participants