Skip to content

Commit 6fd530d

Browse files
committed
Document and support protocol version 4
1 parent 5aa9f70 commit 6fd530d

2 files changed

Lines changed: 14 additions & 11 deletions

File tree

docs/developer/client/index.rst

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Writing a Client
22
================
33

4+
.. note:: This document describes protocol version 4.
5+
46
A client at its core is simply a set of utilities for capturing various
57
logging parameters. Given these parameters, it then builds a JSON payload
68
which it will send to a Sentry server using some sort of authentication
@@ -157,11 +159,11 @@ For example, with an included Exception event, a basic JSON body might resemble
157159
"tags": {
158160
"ios_version": "4.0"
159161
},
160-
"sentry.interfaces.Exception": {
162+
"exception": [{
161163
"type": "SyntaxError":
162164
"value": "Wattttt!",
163165
"module": "__builtins__"
164-
}
166+
}]
165167
}
166168

167169
The following attributes are required for all events:
@@ -351,19 +353,19 @@ An authentication header is expected to be sent along with the message body, whi
351353

352354
.. data:: sentry_version
353355

354-
The protocol version. This should be sent as the value '2.0'.
356+
The protocol version. This should be sent as the value '4'.
355357

356358
.. data:: sentry_client
357359

358360
An arbitrary string which identifies your client, including its version.
359361

360-
For example, the Python client might send this as 'raven-python/1.0'
362+
The typical pattern for this is '**client_name**/**client_version**'.
361363

362-
This should be included in your User-Agent header rather than here if you're using the HTTP protocol.
364+
For example, the Python client might send this as 'raven-python/1.0'.
363365

364366
.. data:: sentry_timestamp
365367

366-
The unix timestamp representing the time at which this POST request was generated.
368+
The unix timestamp representing the time at which this event was generated.
367369

368370
.. data:: sentry_key
369371

@@ -373,8 +375,9 @@ An authentication header is expected to be sent along with the message body, whi
373375

374376
The secret key which should be provided as part of the client configuration.
375377

376-
.. note:: You should only pass the secret key if you're communicating via the server. Client-side behavior (such
377-
as JavaScript) should use CORS.
378+
.. note:: You should only pass the secret key if you're communicating via
379+
secure communication to the server. Client-side behavior (such
380+
as JavaScript) should use CORS, and only pass the public key.
378381

379382
crossdomain.xml
380383
~~~~~~~~~~~~~~~
@@ -406,11 +409,11 @@ The request body should then somewhat resemble the following::
406409
"culprit": "my.module.function_name",
407410
"timestamp": "2011-05-02T17:41:36",
408411
"message": "SyntaxError: Wattttt!",
409-
"sentry.interfaces.Exception": {
412+
"exception": [{
410413
"type": "SyntaxError",
411414
"value": "Wattttt!",
412415
"module": "__builtins__"
413-
}
416+
}]
414417
}
415418

416419
Handling Failures

src/sentry/web/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def _parse_header(self, request, project):
8989
server_version = auth_vars.get('sentry_version', '1.0')
9090
client = auth_vars.get('sentry_client', request.META.get('HTTP_USER_AGENT'))
9191

92-
if server_version not in ('2.0', '3'):
92+
if server_version not in ('2.0', '3', '4'):
9393
raise APIError('Client/server version mismatch: Unsupported protocol version (%s)' % server_version)
9494

9595
if not client:

0 commit comments

Comments
 (0)