diff --git a/docs/reference/instrumenting-custom-code.md b/docs/reference/instrumenting-custom-code.md index ad6afc8fb..851dee965 100644 --- a/docs/reference/instrumenting-custom-code.md +++ b/docs/reference/instrumenting-custom-code.md @@ -62,7 +62,7 @@ See [the API docs](/reference/api-reference.md#api-capture-span) for more inform It’s important to note that `elasticapm.capture_span` only works if there is an existing transaction. If you’re not using one of our [supported frameworks](/reference/set-up-apm-python-agent.md), you need to create a `Client` object and begin and end the transactions yourself. You can even utilize the agent’s [automatic instrumentation](/reference/supported-technologies.md#automatic-instrumentation)! -To collect the spans generated by the supported libraries, you need to invoke `elasticapm.instrument()` (just once, at the initialization stage of your application) and create at least one transaction. It is up to you to determine what you consider a transaction within your application — it can be the whole execution of the script or a part of it. +To collect the spans generated by the supported libraries, you need to invoke `elasticapm.instrument()` (just once, at the initialization stage of your application) and create at least one transaction. It is up to you to determine what you consider a transaction within your application — it can be the whole execution of the script or a part of it. The example below will consider the whole execution as a single transaction with two HTTP request spans in it. The config for `elasticapm.Client` can be passed in programmatically, and it will also utilize any config environment variables available to it automatically. @@ -85,7 +85,7 @@ if __name__ == '__main__': client.end_transaction(name=__name__, result="success") ``` -Note that you don’t need to do anything to send the data — the `Client` object will handle that before the script exits. Additionally, the `Client` object should be treated as a singleton — you should only create one instance and store/pass around that instance for all transaction handling. +Note that you don’t need to do anything to send the data — the `Client` object will handle that before the script exits. Additionally, the `Client` object should be treated as a singleton — you should only create one instance and store/pass around that instance for all transaction handling. ## Distributed Tracing [instrumenting-custom-code-distributed-tracing]