Closed
Description
Hey guys,
I am having an issue with the Python agent not being able to send tracing data to my cloud.elastic.co
setup. It seems that it has something to do with the username being an Int
in the payload sent to the APM Server and not String
or null
NOTE: I have anonymized some of the data for security reasons.
Traceback (most recent call last):
File "/home/django/env/lib/python2.7/site-packages/elasticapm/transport/base.py", line 184, in send_sync
File "/home/django/env/lib/python2.7/site-packages/elasticapm/transport/http.py", line 63, in send
else:
TransportException: HTTP 400: Problem validating JSON document against schema: I[#] S[#] doesn't validate with "transaction#"
I[#] S[#/allOf/0] allOf failed
I[#/context/user/username] S[#/allOf/0/properties/context/properties/user/properties/username/type] expected string or null, but got number [{"transaction": {"result": "HTTP 2xx", "sampled": true, "name": "GET core.views.private.UserProfileDetail", "context": {"tags": {}, "request": {"cookies": {"csrftoken": "********", "sessionid": "********"}, "socket": {"encrypted": true, "remote_address": "123.456.789.123"}, "url": {"pathname": "/api/v1/me/", "full": "https://dev.example.com/api/v1/me/", "protocol": "https:", "hostname": "dev.example.com"}, "headers": {"x-csrftoken": "********", "content-length": "", "accept-language": "en-GB,en-US;q=0.9,en;q=0.8,sv;q=0.7", "accept-encoding": "gzip, deflate, br", "connection": "keep-alive", "accept": "application/json, text/plain, */*", "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36", "dnt": "1", "host": "dev.example.com", "referer": "https://dev.example.com/", "cookie": "csrftoken=********; sessionid=********", "content-type": ""}, "env": {"SERVER_NAME": "dev.example.com", "SERVER_PORT": "443", "REMOTE_ADDR": "123.456.789.123"}, "method": "GET"}, "response": {"status_code": 200, "headers": {"Vary": "Cookie", "X-Frame-Options": "SAMEORIGIN", "Content-Type": "application/json", "Content-Length": "1899", "Allow": "GET, PUT, PATCH, HEAD, OPTIONS"}}, "user": {"is_authenticated": true, "username": 1, "id": 1, "email": "xxx.yyy@gmail.com"}}, "duration": 83.71400833129883, "timestamp": 1549104987294339, "type": "request", "id": "55f26d7194d0405f", "span_count": {"started": 6, "dropped": 0}, "trace_id": "a46f69e2713d15d84d9e51e2325ca1c7"}}], Problem validating JSON document against schema: I[#] S[#] doesn't validate with "transaction#"
I[#] S[#/allOf/0] allOf failed
I[#/context/user/username] S[#/allOf/0/properties/context/properties/user/properties/username/type] expected string or null, but got number [{"transaction": {"result": "HTTP 2xx", "sampled": true, "name": "GET core.views.users.OrganizationEmployeePermissionGroupList", "context": {"tags": {}, "request": {"cookies": {"csrftoken": "********", "sessionid": "********"}, "socket": {"encrypted": true, "remote_address": "123.456.789.123"}, "url": {"pathname": "/api/v1/users/organizations/permission-group/employee/4ad9e5bc-2b8d-49fc-b8fb-4b2355d545bb/", "full": "https://dev.example.com/api/v1/users/organizations/permission-group/employee/4ad9e5bc-2b8d-49fc-b8fb-4b2355d545bb/", "protocol": "https:", "hostname": "dev.example.com"}, "headers": {"x-csrftoken": "********", "content-length": "", "accept-language": "en-GB,en-US;q=0.9,en;q=0.8,sv;q=0.7", "accept-encoding": "gzip, deflate, br", "connection": "keep-alive", "accept": "application/json, text/plain, */*", "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36", "dnt": "1", "host": "dev.example.com", "referer": "https://dev.example.com/", "cookie": "csrftoken=********; sessionid=********", "content-type": ""}, "env": {"SERVER_NAME": "dev.example.com", "SERVER_PORT": "443", "REMOTE_ADDR": "123.456.789.123"}, "method": "GET"}, "response": {"status_code": 200, "headers": {"Vary": "Cookie", "X-Frame-Options": "SAMEORIGIN", "Content-Type": "application/json", "Content-Length": "52", "Allow": "GET, HEAD, OPTIONS"}}, "user": {"is_authenticated": true, "username": 1, "id": 1, "email": "xxx.yyy@gmail.com"}}, "duration": 41.748046875, "timestamp": 1549104987677123, "type": "request", "id": "9a33768d53d7f382", "span_count": {"started": 4, "dropped": 0}, "trace_id": "ce0233a5c63d02f834ccb2ed64ef72cb"}}], Problem validating JSON document against schema: I[#] S[#] doesn't validate with "transaction#"
I[#] S[#/allOf/0] allOf failed
I[#/context/user/username] S[#/allOf/0/properties/context/properties/user/properties/username/type] expected string or null, but got number [{"transaction": {"result": "HTTP 2xx", "sampled": true, "name": "GET core.views.users.PersonOrganizationDiscountList", "context": {"tags": {}, "request": {"cookies": {"csrftoken": "********", "sessionid": "********"}, "socket": {"encrypted": true, "remote_address": "123.456.789.123"}, "url": {"pathname": "/api/v1/users/person-organization/discount/", "search": "?page=1", "full": "https://dev.example.com/api/v1/users/person-organization/discount/?page=1", "protocol": "https:", "hostname": "dev.example.com"}, "headers": {"x-csrftoken": "********", "content-length": "", "accept-language": "en-GB,en-US;q=0.9,en;q=0.8,sv;q=0.7", "accept-encoding": "gzip, deflate, br", "connection": "keep-alive", "accept": "application/json, text/plain, */*", "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36", "dnt": "1", "host": "dev.example.com", "referer": "https://dev.example.com/", "cookie": "csrftoken=********; sessionid=********", "content-type": ""}, "env": {"SERVER_NAME": "dev.example.com", "SERVER_PORT": "443", "REMOTE_ADDR": "123.456.789.123"}, "method": "GET"}, "response": {"status_code": 200, "headers": {"Vary": "Cookie", "X-Frame-Options": "SAMEORIGIN", "Content-Type": "application/json", "Content-Length": "52", "Allow": "GET, POST, HEAD, OPTIONS"}}, "user": {"is_authenticated": true, "username": 1, "id": 1, "email": "xxx.yyy@gmail.com"}}, "duration": 37.70589828491211, "timestamp": 1549104988069878, "type": "request", "id": "436f60d005b78acc", "span_count": {"started": 4, "dropped": 0}, "trace_id": "b7e1d37f7c7b329b855252a09141e430"}}]
My settings.py
INSTALLED_APPS = ('elasticapm.contrib.django',) + INSTALLED_APPS
ELASTIC_APM = {
# Set required service name. Allowed characters:
# a-z, A-Z, 0-9, -, _, and space
'SERVICE_NAME': 'elasticapm-test',
# Use if APM Server requires a token
'SECRET_TOKEN': 'abcxyz123456',
# Set custom APM Server URL (default: http://localhost:8200)
'SERVER_URL': 'https://abcxyz123456.apm.ap-southeast-1.aws.cloud.es.io:443',
}
# To send performance metrics, add our tracing middleware:
MIDDLEWARE = ('elasticapm.contrib.django.middleware.TracingMiddleware',) + MIDDLEWARE
Environment (please complete the following information)
- OS: Ubuntu 16.04
- Python version: 2.7.15
- Framework and version: Django 1.11.18
- APM Server version: 6.6.0
- Agent version: 4.1.0
Metadata
Metadata
Assignees
Labels
No labels