def test_transaction_metrics(django_elasticapm_client, client):
django_elasticapm_client.instrumentation_store.get_all() # clear the store
with override_settings(**middleware_setting(
django.VERSION, ['elasticapm.contrib.django.middleware.TracingMiddleware']
)):
assert len(django_elasticapm_client.instrumentation_store) == 0
client.get(reverse('elasticapm-no-error'))
assert len(django_elasticapm_client.instrumentation_store) == 1
transactions = django_elasticapm_client.instrumentation_store.get_all()
assert len(transactions) == 1
transaction = transactions[0]
assert transaction['duration'] > 0
assert transaction['result'] == 'HTTP 2xx'
assert transaction['name'] == 'GET tests.contrib.django.testapp.views.no_error'
评论列表
文章目录