Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/reference/advanced-topics.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
mapped_pages:
- https://www.elastic.co/guide/en/apm/agent/python/current/advanced-topics.html
applies_to:
stack:
serverless:
observability:
product:
apm_agent_python: ga
---

# Advanced topics [advanced-topics]
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/aiohttp-server-support.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
mapped_pages:
- https://www.elastic.co/guide/en/apm/agent/python/current/aiohttp-server-support.html
applies_to:
stack:
serverless:
observability:
product:
apm_agent_python: ga
---

# Aiohttp Server support [aiohttp-server-support]
Expand Down
94 changes: 73 additions & 21 deletions docs/reference/api-reference.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
mapped_pages:
- https://www.elastic.co/guide/en/apm/agent/python/current/api.html
applies_to:
stack:
serverless:
observability:
product:
apm_agent_python: ga
---

# API reference [api]
Expand All @@ -15,7 +21,9 @@ The public Client API consists of several methods on the `Client` class. This AP

### Instantiation [client-api-init]

Added in v1.0.0.
```{applies_to}
apm_agent_python: ga 1.0.0
```

To create a `Client` instance, import it and call its constructor:

Expand All @@ -36,7 +44,9 @@ framework integrations like [Django](/reference/django-support.md) and [Flask](/

#### `elasticapm.get_client()` [api-get-client]

[small]#Added in v6.1.0.
```{applies_to}
apm_agent_python: ga 6.1.0
```

Retrieves the `Client` singleton. This is useful for many framework integrations, where the client is instantiated automatically.

Expand All @@ -51,7 +61,11 @@ client.capture_message('foo')

#### `Client.capture_exception()` [client-api-capture-exception]

Added in v1.0.0. `handled` added in v2.0.0.
```{applies_to}
apm_agent_python: ga 1.0.0
```

`handled` added in v2.0.0.

Captures an exception object:

Expand All @@ -73,7 +87,9 @@ Returns the id of the error as a string.

#### `Client.capture_message()` [client-api-capture-message]

Added in v1.0.0.
```{applies_to}
apm_agent_python: ga 1.0.0
```

Captures a message with optional added contextual data. Example:

Expand Down Expand Up @@ -110,7 +126,11 @@ Either the `message` or the `param_message` argument is required.

#### `Client.begin_transaction()` [client-api-begin-transaction]

Added in v1.0.0. `trace_parent` support added in v5.6.0.
```{applies_to}
apm_agent_python: ga 1.0.0
```

`trace_parent` support added in v5.6.0.

Begin tracking a transaction. Should be called e.g. at the beginning of a request or when starting a background task. Example:

Expand All @@ -125,7 +145,9 @@ client.begin_transaction('processors')

#### `Client.end_transaction()` [client-api-end-transaction]

Added in v1.0.0.
```{applies_to}
apm_agent_python: ga 1.0.0
```

End tracking the transaction. Should be called e.g. at the end of a request or when ending a background task. Example:

Expand All @@ -149,7 +171,9 @@ Transactions can be started with a `TraceParent` object. This creates a transact

#### `elasticapm.trace_parent_from_string()` [api-traceparent-from-string]

Added in v5.6.0.
```{applies_to}
apm_agent_python: ga 5.6.0
```

Create a `TraceParent` object from the string representation generated by `TraceParent.to_string()`:

Expand All @@ -163,7 +187,9 @@ client.begin_transaction('processors', trace_parent=parent)

#### `elasticapm.trace_parent_from_headers()` [api-traceparent-from-headers]

Added in v5.6.0.
```{applies_to}
apm_agent_python: ga 5.6.0
```

Create a `TraceParent` object from HTTP headers (usually generated by another Elastic APM agent):

Expand All @@ -177,7 +203,9 @@ client.begin_transaction('processors', trace_parent=parent)

#### `elasticapm.get_trace_parent_header()` [api-traceparent-get-header]

Added in v5.10.0.
```{applies_to}
apm_agent_python: ga 5.10.0
```

Return the string representation of the current transaction `TraceParent` object:

Expand All @@ -191,7 +219,9 @@ elasticapm.get_trace_parent_header()

### `elasticapm.instrument()` [api-elasticapm-instrument]

Added in v1.0.0.
```{applies_to}
apm_agent_python: ga 1.0.0
```

Instruments libraries automatically. This includes a wide range of standard library and 3rd party modules. A list of instrumented modules can be found in `elasticapm.instrumentation.register`. This function should be called as early as possibly in the startup of your application. For [supported frameworks](/reference/supported-technologies.md#framework-support), this is called automatically. Example:

Expand All @@ -204,7 +234,9 @@ elasticapm.instrument()

### `elasticapm.set_transaction_name()` [api-set-transaction-name]

Added in v1.0.0.
```{applies_to}
apm_agent_python: ga 1.0.0
```

Set the name of the current transaction. For supported frameworks, the transaction name is determined automatically, and can be overridden using this function. Example:

Expand All @@ -220,7 +252,9 @@ elasticapm.set_transaction_name('myapp.billing_process')

### `elasticapm.set_transaction_result()` [api-set-transaction-result]

Added in v2.2.0.
```{applies_to}
apm_agent_python: ga 2.2.0
```

Set the result of the current transaction. For supported frameworks, the transaction result is determined automatically, and can be overridden using this function. Example:

Expand All @@ -236,7 +270,9 @@ elasticapm.set_transaction_result('SUCCESS')

### `elasticapm.set_transaction_outcome()` [api-set-transaction-outcome]

Added in v5.9.0.
```{applies_to}
apm_agent_python: ga 5.9.0
```

Sets the outcome of the transaction. The value can either be `"success"`, `"failure"` or `"unknown"`. This should only be called at the end of a transaction after the outcome is determined.

Expand Down Expand Up @@ -277,7 +313,9 @@ elasticapm.set_transaction_outcome(OUTCOME.UNKNOWN)

### `elasticapm.get_transaction_id()` [api-get-transaction-id]

Added in v5.2.0.
```{applies_to}
apm_agent_python: ga 5.2.0
```

Get the id of the current transaction. Example:

Expand All @@ -290,7 +328,9 @@ transaction_id = elasticapm.get_transaction_id()

### `elasticapm.get_trace_id()` [api-get-trace-id]

Added in v5.2.0.
```{applies_to}
apm_agent_python: ga 5.2.0
```

Get the `trace_id` of the current transaction’s trace. Example:

Expand All @@ -303,7 +343,9 @@ trace_id = elasticapm.get_trace_id()

### `elasticapm.get_span_id()` [api-get-span-id]

Added in v5.2.0.
```{applies_to}
apm_agent_python: ga 5.2.0
```

Get the id of the current span. Example:

Expand All @@ -316,7 +358,9 @@ span_id = elasticapm.get_span_id()

### `elasticapm.set_custom_context()` [api-set-custom-context]

Added in v2.0.0.
```{applies_to}
apm_agent_python: ga 2.0.0
```

Attach custom contextual data to the current transaction and errors. Supported frameworks will automatically attach information about the HTTP request and the logged in user. You can attach further data using this function.

Expand Down Expand Up @@ -345,7 +389,9 @@ Errors that happen after this call will also have the custom context attached to

### `elasticapm.set_user_context()` [api-set-user-context]

Added in v2.0.0.
```{applies_to}
apm_agent_python: ga 2.0.0
```

Attach information about the currently logged in user to the current transaction and errors. Example:

Expand All @@ -364,7 +410,9 @@ Errors that happen after this call will also have the user context attached to t

### `elasticapm.capture_span` [api-capture-span]

Added in v4.1.0.
```{applies_to}
apm_agent_python: ga 4.1.0
```

Capture a custom span. This can be used either as a function decorator or as a context manager (in a `with` statement). When used as a decorator, the name of the span will be set to the name of the function. When used as a context manager, a name has to be provided.

Expand Down Expand Up @@ -397,7 +445,9 @@ def coffee_maker(strength):

### `elasticapm.async_capture_span` [api-async-capture-span]

Added in v5.4.0.
```{applies_to}
apm_agent_python: ga 5.4.0
```

Capture a custom async-aware span. This can be used either as a function decorator or as a context manager (in an `async with` statement). When used as a decorator, the name of the span will be set to the name of the function. When used as a context manager, a name has to be provided.

Expand Down Expand Up @@ -435,7 +485,9 @@ async def coffee_maker(strength):

### `elasticapm.label()` [api-label]

Added in v5.0.0.
```{applies_to}
apm_agent_python: ga 5.0.0
```

Attach labels to the the current transaction and errors.

Expand Down
6 changes: 6 additions & 0 deletions docs/reference/asgi-middleware.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
mapped_pages:
- https://www.elastic.co/guide/en/apm/agent/python/current/asgi-middleware.html
applies_to:
stack:
serverless:
observability:
product:
apm_agent_python: preview
---

# ASGI Middleware [asgi-middleware]
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/azure-functions-support.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
mapped_pages:
- https://www.elastic.co/guide/en/apm/agent/python/current/azure-functions-support.html
applies_to:
stack:
serverless:
observability:
product:
apm_agent_python: ga
---

# Monitoring Azure Functions [azure-functions-support]
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/configuration.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
mapped_pages:
- https://www.elastic.co/guide/en/apm/agent/python/current/configuration.html
applies_to:
stack:
serverless:
observability:
product:
apm_agent_python: ga
---

# Configuration [configuration]
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/django-support.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
mapped_pages:
- https://www.elastic.co/guide/en/apm/agent/python/current/django-support.html
applies_to:
stack:
serverless:
observability:
product:
apm_agent_python: ga
---

# Django support [django-support]
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/flask-support.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
mapped_pages:
- https://www.elastic.co/guide/en/apm/agent/python/current/flask-support.html
applies_to:
stack:
serverless:
observability:
product:
apm_agent_python: ga
---

# Flask support [flask-support]
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/how-agent-works.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
mapped_pages:
- https://www.elastic.co/guide/en/apm/agent/python/current/how-the-agent-works.html
applies_to:
stack:
serverless:
observability:
product:
apm_agent_python: ga
---

# How the Agent works [how-the-agent-works]
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
mapped_pages:
- https://www.elastic.co/guide/en/apm/agent/python/current/getting-started.html
- https://www.elastic.co/guide/en/apm/agent/python/current/index.html
applies_to:
stack:
serverless:
observability:
product:
apm_agent_python: ga
---

# APM Python agent [getting-started]
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/instrumenting-custom-code.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
mapped_pages:
- https://www.elastic.co/guide/en/apm/agent/python/current/instrumenting-custom-code.html
applies_to:
stack:
serverless:
observability:
product:
apm_agent_python: ga
---

# Instrumenting custom code [instrumenting-custom-code]
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/lambda-support.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
mapped_pages:
- https://www.elastic.co/guide/en/apm/agent/python/current/lambda-support.html
applies_to:
stack:
serverless:
observability:
product:
apm_agent_python: ga
sub:
apm-lambda-ext-v: ver-1-5-7
apm-python-v: ver-6-23-0
Expand Down
Loading