---
title: JudgmentSpanProcessor
seo:
  title: JudgmentSpanProcessor — TypeScript SDK
  description: >-
    Span processor that manages span lifecycle, state, and batched export to the
    Judgment platform. Supports per-span state (counters, lists), partial-span
    emission for streaming updates, and baggage propagation onto child spans.
    (TypeScript SDK)
description: >-
  Span processor that manages span lifecycle, state, and batched export to the
  Judgment platform. Supports per-span state (counters, lists), partial-span
  emission for streaming updates, and baggage propagation onto child spans.
---

Created automatically by `Tracer.init()`. Use it directly only when
building a custom tracing pipeline.

## Attributes

| Prop | Type | Default | Description |
| - | - | - | - |
| `tracer?` | `BaseTracer \| null` | - | |

***

## stateSet()

Store a value in the mutable state for a span.

```typescript
function stateSet(spanContext: SpanContext, key: string, value: unknown): void
```

### Parameters

| Prop | Type | Default | Description |
| - | - | - | - |
| `spanContext` | `SpanContext` | - | |
| `key` | `string` | - | |
| `value` | `unknown` | - | |

### Returns

`void`

***

## stateGet()

Retrieve a value from the mutable state for a span.

```typescript
function stateGet(spanContext: SpanContext, key: string, defaultValue: T): T
```

### Parameters

| Prop | Type | Default | Description |
| - | - | - | - |
| `spanContext` | `SpanContext` | - | |
| `key` | `string` | - | |
| `defaultValue` | `T` | - | |

### Returns

`T`

***

## stateIncr()

Atomically increment a counter. Returns the value before increment.

```typescript
function stateIncr(spanContext: SpanContext, key: string): number
```

### Parameters

| Prop | Type | Default | Description |
| - | - | - | - |
| `spanContext` | `SpanContext` | - | |
| `key` | `string` | - | |

### Returns

`number`

***

## stateAppend()

Atomically append to a list. Returns the new list.

```typescript
function stateAppend(spanContext: SpanContext, key: string, item: T): T[]
```

### Parameters

| Prop | Type | Default | Description |
| - | - | - | - |
| `spanContext` | `SpanContext` | - | |
| `key` | `string` | - | |
| `item` | `T` | - | |

### Returns

`T[]`

***

## emitPartial()

Export the current span's in-progress state for streaming updates.

```typescript
function emitPartial(): void
```

### Returns

`void`
