Skip to content

Commit cc24b98

Browse files
Add Extensibility section to encyclopedia (#4314)
* Improve legibility of Golang context propagation docs * Links to context propagation docs from outside * Extensibility section of Encyclopedia --------- Co-authored-by: Lenny Chen <55669665+lennessyy@users.noreply.github.com>
1 parent 4696ab5 commit cc24b98

7 files changed

Lines changed: 157 additions & 13 deletions

File tree

docs/develop/plugins-guide.mdx

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ Here are some common use cases for plugins:
3636
The recommended way to start building plugins is with a `SimplePlugin`. This abstraction will tackle the vast majority
3737
of plugins people want to write.
3838

39-
For advanced use cases, you can extend the methods in lower-level classes that Simple Plugin is based on without
40-
re-implementing what you’ve done. See the [Advanced Topics section](#advanced-topics-for-plugins) for more information.
41-
4239
### Example Plugins
4340

4441
If you prefer to learn by getting hands-on with code, check out some existing plugins.
@@ -60,6 +57,7 @@ do.
6057
- [Built-in Nexus Operations](#built-in-nexus-operations)
6158
- [Custom Data Converters](#custom-data-converters)
6259
- [Interceptors](#interceptors)
60+
- [Context Propagators](#context-propagators)
6361

6462
### Built-in Activity
6563

@@ -784,6 +782,27 @@ plugin = Temporalio::SimplePlugin.new(
784782
</SdkTabs.Ruby>
785783
</SdkTabs>
786784

785+
### Context Propagators {#context-propagators}
786+
787+
Context propagators pass custom key-value data (such as tracing IDs, tenant IDs, or auth tokens) across Workflow, Activity, and Child Workflow boundaries via Temporal headers. See [Context Propagation](/encyclopedia/context-propagation) for details on how they work.
788+
789+
Propagators registered via a Plugin are appended to any propagators already set by the user or by previous plugins.
790+
791+
<SdkTabs hideUnsupportedLanguages>
792+
<SdkTabs.Go>
793+
794+
```go
795+
func createContextPropagatorPlugin() (*temporal.SimplePlugin, error) {
796+
return temporal.NewSimplePlugin(temporal.SimplePluginOptions{
797+
Name: "organization.PluginName",
798+
ContextPropagators: []workflow.ContextPropagator{NewMyPropagator()},
799+
})
800+
}
801+
```
802+
803+
</SdkTabs.Go>
804+
</SdkTabs>
805+
787806
### Special considerations for different languages
788807

789808
Each of the SDKs has nuances you should be aware of so you can account for it in your code.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
id: context-propagation
3+
title: Context Propagation
4+
sidebar_label: Context Propagation
5+
description: Pass custom key-value data across Workflow, Activity, and Child Workflow boundaries using Temporal headers.
6+
toc_max_heading_level: 4
7+
keywords:
8+
- context propagation
9+
- context propagators
10+
- headers
11+
- tracing
12+
- observability
13+
tags:
14+
- Concepts
15+
- Observability
16+
---
17+
18+
Context propagation lets you pass custom key-value data from a Client to Workflows, and from Workflows to Activities and Child Workflows, without threading values through every function signature.
19+
20+
Common use cases:
21+
22+
- Propagating distributed tracing IDs (e.g., OpenTelemetry trace context)
23+
- Passing tenant IDs for multi-tenant applications
24+
- Forwarding auth tokens or request-scoped metadata
25+
26+
Each SDK provides a **context propagator** interface you implement to control which values are injected and extracted. You register propagators on the Client, and the SDK calls them automatically at every boundary.
27+
28+
## Implementing Context Propagation
29+
30+
Here are SDK-specific guides:
31+
32+
- [Go](/develop/go/observability#context-propagation)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
id: extensibility
3+
title: Extensibility
4+
sidebar_label: Extensibility
5+
description: Temporal offers mechanisms to augment the functionality of Workflows and Activities, including data conversion, context propagation, interceptors, and plugins.
6+
toc_max_heading_level: 4
7+
keywords:
8+
- extensibility
9+
- interceptors
10+
- context propagation
11+
- data conversion
12+
- plugins
13+
tags:
14+
- Concepts
15+
---
16+
17+
Temporal offers many mechanisms to augment the functionality of Workflows and Activities.
18+
These allow you to customize how data is serialized, propagate metadata across execution boundaries, and inject cross-cutting behavior like tracing and logging.
19+
20+
- [Data Conversion](/dataconversion) - Customize how arguments and return values are serialized, compressed, or encrypted
21+
- [Context Propagation](/encyclopedia/context-propagation) - Pass custom metadata (tracing IDs, tenant IDs, auth tokens) across Workflow, Activity, and Child Workflow boundaries
22+
- [Interceptors](/encyclopedia/interceptors) - Add cross-cutting behavior (observability, authorization, header manipulation) before and after SDK operations
23+
- [Plugins](/encyclopedia/plugins) - Bundle interceptors, context propagators, data converters, and built-in definitions into reusable packages

docs/encyclopedia/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The following Encyclopedia pages describe the concepts, components, and features
2424
- [Temporal Service](/temporal-service)
2525
- [Namespaces](/namespaces)
2626
- [Temporal Nexus](/nexus)
27-
- [Data conversion](/dataconversion)
27+
- [Extensibility](/encyclopedia/extensibility)
2828

2929
For a complete list of Temporal terms, see the [Glossary](/glossary).
3030

docs/encyclopedia/interceptors.mdx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
id: interceptors
3+
title: Interceptors
4+
sidebar_label: Interceptors
5+
description: Add cross-cutting behavior like observability, authorization, and header manipulation before and after SDK operations.
6+
toc_max_heading_level: 4
7+
keywords:
8+
- interceptors
9+
- middleware
10+
- observability
11+
- tracing
12+
tags:
13+
- Concepts
14+
---
15+
16+
Interceptors let you add cross-cutting behavior before and after SDK operations such as starting a Workflow, executing an Activity, or handling a Signal. They work like middleware: each interceptor wraps the next, forming a chain that executes around the underlying operation.
17+
18+
Common use cases:
19+
20+
- Observability (logging, metrics, tracing)
21+
- Authorization and authentication checks
22+
- Header manipulation (propagating metadata)
23+
- Input/output validation
24+
25+
## Implementing Interceptors
26+
27+
Here are SDK-specific guides:
28+
29+
- [Python](/develop/python/interceptors)
30+
- [TypeScript](/develop/typescript/interceptors)

docs/encyclopedia/plugins.mdx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
id: plugins
3+
title: Plugins
4+
sidebar_label: Plugins
5+
description: Bundle interceptors, context propagators, data converters, and built-in definitions into reusable packages.
6+
toc_max_heading_level: 4
7+
keywords:
8+
- plugins
9+
- simple plugin
10+
- extensibility
11+
tags:
12+
- Concepts
13+
---
14+
15+
A Plugin bundles multiple extensibility primitives - interceptors, context propagators, data converters, and built-in Workflow/Activity/Nexus definitions - into a single reusable package. Plugins let platform teams and library authors ship ready-made functionality that application developers can adopt with a single registration call.
16+
17+
Common use cases:
18+
19+
- AI Agent SDKs (e.g., OpenAI Agents, Pydantic AI)
20+
- Observability packages (tracing, logging, metrics)
21+
- Encryption or compliance middleware
22+
- Shared infrastructure integrations (messaging, payments, LLM calls)
23+
24+
## Implementing Plugins
25+
26+
See the [Plugins guide](/develop/plugins-guide) for how to build and use plugins across all supported SDKs.

sidebars.js

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -855,20 +855,34 @@ module.exports = {
855855
},
856856
{
857857
type: 'category',
858-
label: 'Data Conversion',
858+
label: 'Extensibility',
859859
collapsed: true,
860860
link: {
861861
type: 'doc',
862-
id: 'encyclopedia/data-conversion/dataconversion',
862+
id: 'encyclopedia/extensibility',
863863
},
864864
items: [
865-
'encyclopedia/data-conversion/default-custom-data-converters',
866-
'encyclopedia/data-conversion/payload-converter',
867-
'encyclopedia/data-conversion/payload-codec',
868-
'encyclopedia/data-conversion/failure-converter',
869-
'encyclopedia/data-conversion/remote-data-encoding',
870-
'encyclopedia/data-conversion/codec-server',
871-
'encyclopedia/data-conversion/key-management',
865+
{
866+
type: 'category',
867+
label: 'Data Conversion',
868+
collapsed: true,
869+
link: {
870+
type: 'doc',
871+
id: 'encyclopedia/data-conversion/dataconversion',
872+
},
873+
items: [
874+
'encyclopedia/data-conversion/default-custom-data-converters',
875+
'encyclopedia/data-conversion/payload-converter',
876+
'encyclopedia/data-conversion/payload-codec',
877+
'encyclopedia/data-conversion/failure-converter',
878+
'encyclopedia/data-conversion/remote-data-encoding',
879+
'encyclopedia/data-conversion/codec-server',
880+
'encyclopedia/data-conversion/key-management',
881+
],
882+
},
883+
'encyclopedia/context-propagation',
884+
'encyclopedia/interceptors',
885+
'encyclopedia/plugins',
872886
],
873887
},
874888
'web-ui',

0 commit comments

Comments
 (0)