Repository navigation
Description
What would you like?
Add a single public OtelPlugin entry point for selecting the OTel view, with execution mode as the default and invocation mode as an explicit choice. Users should be able to import one name and register a factory, while existing registration APIs continue to work.
Illustrative API, using factory to make the return value explicit:
from aws_durable_execution_sdk_python import durable_execution
from aws_durable_execution_sdk_python_otel import OtelPlugin
execution = OtelPlugin.factory()
invocation = OtelPlugin.factory(mode="invocation")
# Register one selected factory with the handler:
@durable_execution(plugins=[execution])
def handler(event, context):
return eventSupport mode="execution" explicitly and an optional existing OtelPluginConfig, for example OtelPlugin.factory(config, mode="invocation").
Also add DURABLE_EXECUTION_PLUGINS=otel as the default execution entry point. Keep otel-execution and otel-invocation working with their existing meanings.
Possible Implementation
Implement the selector in the OTel package and re-export OtelPlugin from its public package root. Return an ExecutionOtelPluginFactory or InvocationOtelPluginFactory, passing through configuration. Use precise mode typing and reject unsupported values at runtime.
The current SDK's plugins argument accepts factories. Preserve create_plugin(info) and create a fresh plugin for each invocation, with the existing provider resolution and initialization behavior. Return the selected factory directly where possible so __durable_registration_api__, exclusive_group, configuration inspection, and diagnostic identity are retained.
Add an otel entry in the existing aws_durable_execution.plugins entry-point group, pointing to the default execution factory. Keep both existing entries intact. Default configuration continues to use the global provider, while explicit OtelPluginConfig.tracer_provider remains supported.
Is this a breaking change?
No. Preserve all public APIs supported by the target release, including ExecutionOtelPluginFactory, InvocationOtelPluginFactory, existing plugin class exports, configuration types, module paths, and entry points. The new entry point must not change existing trace hierarchy, span identities, sampling, logging, or replay behavior.
Does this require an RFC?
No. This is an additive API over existing implementations; final method naming can be settled during API review.
Additional Context
Acceptance criteria:
- Default and explicit execution selection match
ExecutionOtelPluginFactory; invocation selection matchesInvocationOtelPluginFactory. Reject invalid explicit modes. - Configuration reaches the selected factory unchanged, including global-provider and application-owned provider paths.
- Existing factory registration and installed-package entry points continue to work;
otelloads execution mode without handler-side OTel imports or registration. - Preserve exclusive-view validation when combining new and existing entry points, including explicit/environment combinations. Related wrapper metadata issue: [Tests]: Preserve OTel registration metadata in factory wrappers #891.
- Exercise the public API through an initial invocation and suspension/resume, and reuse one factory across concurrent invocations to verify isolation and equivalent telemetry. Include package export/type checks and entry-point discovery from a built package.
- Update Python examples and documentation for both views and environment loading. Explain that no handler-side setup still requires the plugin package and configured ADOT/provider/exporter; installing the package alone does not enable instrumentation.
Coordinate the API semantics and cross-language documentation with the Java and JS implementations.
Activity
feat(sdk): add unified OTel plugin factory (#1171)