Skip to content

Commit 0124d68

Browse files
committed
expand docs a bit
1 parent f7c29a0 commit 0124d68

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

docs/api.asciidoc

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,21 @@ elasticapm.set_transaction_result('SUCCESS')
240240

241241
Sets the outcome of the transaction. The value can either be `"success"`, `"failure"` or `"unknown"`.
242242
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`.
244252

245253
If your transaction results in an HTTP response, you can alternatively provide the HTTP status code.
246254

247255
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,
249258
`"success"`, `"failure"` and `"unknown"`.
250259
This allows the APM app to perform error rate calculations on these values.
251260

@@ -269,6 +278,12 @@ elasticapm.set_transaction_outcome(OUTCOME.FAILURE)
269278
elasticapm.set_transaction_outcome(OUTCOME.UNKNOWN)
270279
----
271280

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+
272287
[float]
273288
[[api-get-transaction-id]]
274289
==== `elasticapm.get_transaction_id()`

0 commit comments

Comments
 (0)