-
Notifications
You must be signed in to change notification settings - Fork 82
Open
Description
First of all thanks for this awesome library 💯 .
Cloudflare recently introduced Workflows, a new way to compose and orchestrate Workers efficiently. Currently, otel-cf-workers provides instrumentation for Durable Objects, but Workflows are not yet supported.
Since Workflows play a crucial role in structuring complex Worker applications, having built-in OpenTelemetry support would be highly beneficial for observability and tracing across workflow executions.
A possible implementation could follow a similar pattern to the existing Durable Object instrumentation. For example:
import { WorkflowEntrypoint, WorkflowEvent, WorkflowStep } from 'cloudflare:workers';
import { instrumentWorkflow, PartialTraceConfig } from '@microlabs/otel-cf-workers'
const config: ResolveConfigFn = (env: Env, _trigger) => {
return {
exporter: {
url: 'https://api.honeycomb.io/v1/traces',
headers: { 'x-honeycomb-team': env.HONEYCOMB_API_KEY },
},
service: { name: 'greetings-do' },
}
}
type TestWorkflowTypes = {
data: string,
}
class TestWorkflow extends WorkflowEntrypoint<Env, TestWorkflowTypes> {
async run({ payload }: WorkflowEvent<TestWorkflowTypes>, step: WorkflowStep) {
await step.do('step1', async () => {
await sleep(2000);
});
await step.do('step2', async () => {
await sleep(3000);
});
span.end();
}
}
const TestOtelWorkflow = instrumentWorkflow(TestWorkflow, doConfig)
export { TestOtelWorkflow }Thanks.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels