---
title: Propagation
seo:
  title: Propagation — Python SDK
---

## get\_global\_textmap()

Return the active composite propagator (W3C TraceContext + Judgment Baggage).

```python
def get_global_textmap() -> TextMapPropagator:
```

### Returns

`TextMapPropagator`

***

## set\_global\_textmap()

Replace the global text-map propagator.

```python
def set_global_textmap(propagator) -> None:
```

### Parameters

| Prop | Type | Default | Description |
| - | - | - | - |
| `propagator` | `TextMapPropagator` | - | |

### Returns

`None`

***

## inject()

Inject trace context and baggage into an outgoing carrier (e.g. HTTP headers).

Call this before making an outbound HTTP request to propagate the
current trace across service boundaries.

```python
headers = {}
propagation.inject(headers)
response = requests.get("https://api.example.com", headers=headers)
```

```python
def inject(carrier, context=None, setter=default_setter) -> None:
```

### Parameters

| Prop | Type | Default | Description |
| - | - | - | - |
| `carrier` | `object` | - | A mutable mapping (typically a dict) to write propagation headers into. |
| `context?` | `Optional[Context]` | `None` | The OTel context to inject. Defaults to the current Judgment context. |
| `setter?` | `Setter` | `default_setter` | Strategy for writing values into the carrier. |

### Returns

`None`

***

## extract()

Extract trace context and baggage from an incoming carrier.

Call this when handling an inbound request to continue an existing
trace started by an upstream service.

```python
ctx = propagation.extract(request.headers)
with Tracer.start_as_current_span("handle-request", context=ctx):
    ...
```

```python
def extract(carrier, context=None, getter=default_getter) -> opentelemetry.context.Context:
```

### Parameters

| Prop | Type | Default | Description |
| - | - | - | - |
| `carrier` | `object` | - | A mapping containing propagation headers (e.g. request.headers). |
| `context?` | `Optional[Context]` | `None` | Base context to merge into. Defaults to the current Judgment context. |
| `getter?` | `Getter` | `default_getter` | Strategy for reading values from the carrier. |

### Returns

`opentelemetry.context.Context` - A new `Context` with the extracted trace and baggage data.
