@@ -17,6 +17,8 @@ as well as to mark the beginning and end of transactions.
17
17
[[client-api-init]]
18
18
==== Instantiation
19
19
20
+ [small]#Added in v1.0.0.#
21
+
20
22
To create a `Client` instance, import it and call its constructor:
21
23
22
24
[source,python]
@@ -40,6 +42,8 @@ instantiate the client automatically.
40
42
[[client-api-capture-exception]]
41
43
===== `Client.capture_exception()`
42
44
45
+ [small]#Added in v1.0.0. `handled` added in v2.0.0.#
46
+
43
47
Captures an exception object:
44
48
45
49
[source,python]
@@ -63,6 +67,8 @@ Returns the id of the error as a string.
63
67
[[client-api-capture-message]]
64
68
===== `Client.capture_message()`
65
69
70
+ [small]#Added in v1.0.0.#
71
+
66
72
Captures a message with optional added contextual data. Example:
67
73
68
74
[source,python]
@@ -105,6 +111,9 @@ NOTE: Either the `message` or the `param_message` argument is required.
105
111
[float]
106
112
[[client-api-begin-transaction]]
107
113
===== `Client.begin_transaction()`
114
+
115
+ [small]#Added in v1.0.0. `trace_parent` support added in v5.6.0.#
116
+
108
117
Begin tracking a transaction.
109
118
Should be called e.g. at the beginning of a request or when starting a background task. Example:
110
119
@@ -119,6 +128,9 @@ client.begin_transaction('processors')
119
128
[float]
120
129
[[client-api-end-transaction]]
121
130
===== `Client.end_transaction()`
131
+
132
+ [small]#Added in v1.0.0.#
133
+
122
134
End tracking the transaction.
123
135
Should be called e.g. at the end of a request or when ending a background task. Example:
124
136
@@ -147,6 +159,8 @@ distributed tracing.
147
159
[[api-traceparent-from-string]]
148
160
===== `elasticapm.trace_parent_from_string()`
149
161
162
+ [small]#Added in v5.6.0.#
163
+
150
164
Create a TraceParent object from the string representation generated by
151
165
`TraceParent.to_string()`:
152
166
@@ -163,6 +177,8 @@ client.begin_transaction('processors', trace_parent=parent)
163
177
[[api-traceparent-from-headers]]
164
178
===== `elasticapm.trace_parent_from_headers()`
165
179
180
+ [small]#Added in v5.6.0.#
181
+
166
182
Create a TraceParent object from HTTP headers (usually generated by another
167
183
Elastic APM agent):
168
184
@@ -178,6 +194,8 @@ client.begin_transaction('processors', trace_parent=parent)
178
194
[[api-traceparent-get-header]]
179
195
===== `elasticapm.get_trace_parent_header()`
180
196
197
+ [small]#Added in v5.10.0.#
198
+
181
199
Return the string representation of the current transaction TraceParent object:
182
200
183
201
[source,python]
@@ -193,6 +211,8 @@ elasticapm.get_trace_parent_header()
193
211
[[api-elasticapm-instrument]]
194
212
==== `elasticapm.instrument()`
195
213
214
+ [small]#Added in v1.0.0.#
215
+
196
216
Instruments libraries automatically.
197
217
This includes a wide range of standard library and 3rd party modules.
198
218
A list of instrumented modules can be found in `elasticapm.instrumentation.register`.
@@ -210,6 +230,8 @@ elasticapm.instrument()
210
230
[[api-set-transaction-name]]
211
231
==== `elasticapm.set_transaction_name()`
212
232
233
+ [small]#Added in v1.0.0.#
234
+
213
235
Set the name of the current transaction.
214
236
For supported frameworks, the transaction name is determined automatically,
215
237
and can be overridden using this function. Example:
@@ -229,6 +251,8 @@ elasticapm.set_transaction_name('myapp.billing_process')
229
251
[[api-set-transaction-result]]
230
252
==== `elasticapm.set_transaction_result()`
231
253
254
+ [small]#Added in v2.2.0.#
255
+
232
256
Set the result of the current transaction.
233
257
For supported frameworks, the transaction result is determined automatically,
234
258
and can be overridden using this function. Example:
@@ -248,6 +272,8 @@ elasticapm.set_transaction_result('SUCCESS')
248
272
[[api-set-transaction-outcome]]
249
273
==== `elasticapm.set_transaction_outcome()`
250
274
275
+ [small]#Added in v5.9.0.#
276
+
251
277
Sets the outcome of the transaction. The value can either be `"success"`, `"failure"` or `"unknown"`.
252
278
This should only be called at the end of a transaction after the outcome is determined.
253
279
@@ -298,6 +324,8 @@ elasticapm.set_transaction_outcome(OUTCOME.UNKNOWN)
298
324
[[api-get-transaction-id]]
299
325
==== `elasticapm.get_transaction_id()`
300
326
327
+ [small]#Added in v5.2.0.#
328
+
301
329
Get the id of the current transaction. Example:
302
330
303
331
[source,python]
@@ -312,6 +340,8 @@ transaction_id = elasticapm.get_transaction_id()
312
340
[[api-get-trace-id]]
313
341
==== `elasticapm.get_trace_id()`
314
342
343
+ [small]#Added in v5.2.0.#
344
+
315
345
Get the `trace_id` of the current transaction's trace. Example:
316
346
317
347
[source,python]
@@ -326,6 +356,8 @@ trace_id = elasticapm.get_trace_id()
326
356
[[api-get-span-id]]
327
357
==== `elasticapm.get_span_id()`
328
358
359
+ [small]#Added in v5.2.0.#
360
+
329
361
Get the id of the current span. Example:
330
362
331
363
[source,python]
@@ -340,6 +372,8 @@ span_id = elasticapm.get_span_id()
340
372
[[api-set-custom-context]]
341
373
==== `elasticapm.set_custom_context()`
342
374
375
+ [small]#Added in v2.0.0.#
376
+
343
377
Attach custom contextual data to the current transaction and errors.
344
378
Supported frameworks will automatically attach information about the HTTP request and the logged in user.
345
379
You can attach further data using this function.
@@ -369,6 +403,8 @@ following the `update()` semantics of Python dictionaries.
369
403
[[api-set-user-context]]
370
404
==== `elasticapm.set_user_context()`
371
405
406
+ [small]#Added in v2.0.0.#
407
+
372
408
Attach information about the currently logged in user to the current transaction and errors.
373
409
Example:
374
410
@@ -392,6 +428,8 @@ following the `update()` semantics of Python dictionaries.
392
428
[[api-capture-span]]
393
429
==== `elasticapm.capture_span`
394
430
431
+ [small]#Added in v4.1.0.#
432
+
395
433
Capture a custom span.
396
434
This can be used either as a function decorator or as a context manager (in a `with` statement).
397
435
When used as a decorator, the name of the span will be set to the name of the function.
@@ -427,6 +465,8 @@ def coffee_maker(strength):
427
465
[[api-async-capture-span]]
428
466
==== `elasticapm.async_capture_span`
429
467
468
+ [small]#Added in v5.4.0.#
469
+
430
470
Capture a custom async-aware span.
431
471
This can be used either as a function decorator or as a context manager (in an `async with` statement).
432
472
When used as a decorator, the name of the span will be set to the name of the function.
@@ -464,6 +504,8 @@ NOTE: `asyncio` is only supported for Python 3.7+.
464
504
[[api-label]]
465
505
==== `elasticapm.label()`
466
506
507
+ [small]#Added in v5.0.0.#
508
+
467
509
Attach labels to the the current transaction and errors.
468
510
469
511
TIP: Before using custom labels, ensure you understand the different types of
0 commit comments