feat(opentelemetry): expose functionality as plugin#1884
feat(opentelemetry): expose functionality as plugin#1884chris-olszewski merged 16 commits intomainfrom
Conversation
packages/plugin/src/plugin.ts
Outdated
| * | ||
| * When a value is provided, modules will be appended to existing modules. | ||
| */ | ||
| readonly workflowInterceptorModules?: PluginParameter<string[]>; |
There was a problem hiding this comment.
Necessary for the OTEL plugin to function properly when used when prebundling
There was a problem hiding this comment.
Looks reasonable to me, not sure if there are greater implications here @mjameswh
There was a problem hiding this comment.
Oh, yeah. I thought we had covered that case when in the initial Plugin PR, but looks like that got lost at some point.
However, I think we should avoid duplicating "workflow interceptor modules", i.e. once here and once in WorkerInterceptors.workflowModules. There's absolutely no use case that would justify registering wf interceptors only in bundleWorkflowCode or only in Worker.create(), and it is almost certain that some plugins developers will eventually fail to configure that properties in both places.
There was a problem hiding this comment.
I suggest we don't add this property here; instead, let's make configureBundler add interceptors from workerInterceptors.workflowModules.
Or, we could do the opposite (only have it SimplePluginOptions.workflowInterceptorModules, and use that from both configureBundler and configureWorker).
No strong opinion on either of these two. I feel the former is a bit more coherent with the rest of SimplePlugin's API. The latter is more explicit, but breaks the option's structure (I wouldn't mind that being a breaking change, as Plugin API is still experimental).
In both cases, some typedocs should be added here and there to clarify the behavior.
There was a problem hiding this comment.
Just realizing now that we have a similar issue with clientInterceptors vs workerInterceptors.client. With that in mind, it would probably make more sense to instead group all interceptors under a single interceptors property (i.e. not workerInterceptor), like SimplePluginOptions.interceptors: { client, workflowModules, activity, nexus }.
There was a problem hiding this comment.
But I don't want to hold this PR on that decision.
So, let's do this: for this PR, let's not introduce this extra property here; just make configureBundler use interceptors from workerInterceptors.workflowModules. That will make this PR work fine immediately, and we can then refine the Plugin API independently, without impact on users of the OTel plugin.
packages/plugin/src/plugin.ts
Outdated
| * | ||
| * When a value is provided, modules will be appended to existing modules. | ||
| */ | ||
| readonly workflowInterceptorModules?: PluginParameter<string[]>; |
There was a problem hiding this comment.
Looks reasonable to me, not sure if there are greater implications here @mjameswh
b0ea3e0 to
86d97f2
Compare
86d97f2 to
5ec2a84
Compare
mjameswh
left a comment
There was a problem hiding this comment.
I left two minor comments, good to merge after that.
This reverts commit e4cacf3.
Co-authored-by: James Watkins-Harvey <mjameswh@users.noreply.github.com>
351f94b to
d15d2e5
Compare
What was changed
Expose the OpenTelemetry interceptors as 2 plugins to reduce possible misuse of them.
Why?
Correctly setting up OTEL interceptors requires correctly setting multiple configuration options in order for it to work correctly.
Checklist
Closes [Feature Request] Implement OTel interceptors v1 as Plugin #1850
How was this tested:
OTEL sample updated to use plugin. Applicable OTEL tests updated to use plugin instead of setting up interceptors directly. Not all tests applicable as some tests don't require fully configured OTEL setups.
Any docs updates needed?
No. We could advertise the plugin variant in the top level docs, but unsure if we want to wait until plugins are stable.