@@ -240,12 +240,21 @@ elasticapm.set_transaction_result('SUCCESS')
240
240
241
241
Sets the outcome of the transaction. The value can either be `"success"`, `"failure"` or `"unknown"`.
242
242
This should only be called at the end of a transaction after the outcome is determined.
243
- For supported frameworks, the transaction outcome is set automatically if it has not been set yet.
243
+
244
+ The `outcome` is used for error rate calculations.
245
+ `success` denotes that a transaction has concluded successful, while `failure` indicates that the transaction failed
246
+ to finish successfully.
247
+ If the `outcome` is set to `unknown`, the transaction will not be included in error rate calculations.
248
+
249
+ For supported web frameworks, the transaction outcome is set automatically if it has not been set yet, based on the
250
+ HTTP status code.
251
+ A status code below `500` is considered a `success`, while any value of `500` or higher is counted as a `failure`.
244
252
245
253
If your transaction results in an HTTP response, you can alternatively provide the HTTP status code.
246
254
247
255
NOTE: While the `outcome` and `result` field look very similar, they serve different purposes.
248
- While the `result` field can hold an arbitrary string value, `outcome` is limited to three different values,
256
+ Other than the `result` field, which canhold an arbitrary string value,
257
+ `outcome` is limited to three different values,
249
258
`"success"`, `"failure"` and `"unknown"`.
250
259
This allows the APM app to perform error rate calculations on these values.
251
260
@@ -269,6 +278,12 @@ elasticapm.set_transaction_outcome(OUTCOME.FAILURE)
269
278
elasticapm.set_transaction_outcome(OUTCOME.UNKNOWN)
270
279
----
271
280
281
+ * `outcome`: One of `"success"`, `"failure"` or `"unknown"`. Can be omitted if `http_status_code` is provided.
282
+ * `http_status_code`: if the transaction represents an HTTP response, its status code can be provided to determine the `outcome` automatically.
283
+ * `override`: if `True` (the default), any previously set `outcome` will be overriden.
284
+ If `False`, the outcome will only be set if it was not set before.
285
+
286
+
272
287
[float]
273
288
[[api-get-transaction-id]]
274
289
==== `elasticapm.get_transaction_id()`
0 commit comments