-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨⚗️ [RUM-4469] introduce a plugin system #2809
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2809 +/- ##
==========================================
- Coverage 93.66% 93.66% -0.01%
==========================================
Files 244 245 +1
Lines 7168 7181 +13
Branches 1605 1611 +6
==========================================
+ Hits 6714 6726 +12
- Misses 454 455 +1 ☔ View full report in Codecov by Sentry. |
d61e27d
to
08465c3
Compare
Bundles Sizes Evolution
🚀 CPU Performance
🧠 Memory Performance
|
if (!plugins) { | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💭 thought: What about also checking for a new experimental feature like plugins
? That would be a clear sign for customers that this is not stable, especially in the case a 3rd party releases a plugin, they would have to instruct people to add enableExperimentalFeatures: ['plugins']
to their init config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, let's do it for now.
@@ -296,6 +305,7 @@ export function serializeRumConfiguration(configuration: RumInitConfiguration) { | |||
track_user_interactions: configuration.trackUserInteractions, | |||
track_resources: configuration.trackResources, | |||
track_long_task: configuration.trackLongTasks, | |||
plugins: configuration.plugins?.map((plugin) => assign({ name: plugin.name }, plugin.serializeConfiguration?.())), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💭 thought: What about doing the serialization within rum instead of the plugin? This way we can control how the serialization is done and might avoid duplicating serialization logic across multiple plugins
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum, 'serialization' might not be the best term for it. We don't serialize anything per-se, we transform the configuration before sending it as telemetry event. We need to ensure that we don't leak PII (ex: we avoid sending URLs specified in the configuration, ex: configuration.proxy = 'https://...'
becomes use_proxy: true
). It's not possible to define a generic way to do it.
Maybe we could rename serializeConfiguration()
to something like getConfigurationTelemetry()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, I didn't understood it was for telemetry. getConfigurationTelemetry
sounds good, even though it's a bit weird to expose this to public plugins, but I guess that's fine for now and we can revisit if needed when we go GA with plugins
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's a bit weird to expose this to public plugins
There is no plan to support public plugins any time soon though. We'll go GA with the react plugin, but this doesn't imply supporting third-party plugins.
|
||
export interface RumPlugin { | ||
name: string | ||
serializeConfiguration?(): Record<string, unknown> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ question: What is the serializeConfiguration meant for? Is it only to be passed in the telemetry config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but I agree the name isn't great, see #2809 (comment)
@@ -140,6 +141,8 @@ export function createPreStartStrategy( | |||
return | |||
} | |||
|
|||
callHook(initConfiguration.plugins, 'onInit', { initConfiguration, publicApi }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💬 suggestion: To anticipate a bit future hooks, it could be nice to have
callHook(initConfiguration.plugins, 'onInit', { initConfiguration, publicApi }) | |
registerPlugins(initConfiguration.plugins) // At some point we could have some checks like ensuring no duplicated plugins | |
callHook('onInit', { initConfiguration, publicApi }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What registerPlugins
would do? I don't want to anticipate too much, because we don't know what we'll need in future plugins :) even callHook
is a bit too much. Maybe I could remove this 'hook' concept and just move the code here:
initConfiguration.plugins?.forEach(plugin => plugin?.onInit({ initConfiguration, publicApi }))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense, let's keep it like this for now :)
so we don't need to introduce a new concept
3b14f17
to
5c5e461
Compare
import type { RumInitConfiguration } from './configuration' | ||
|
||
export interface RumPlugin { | ||
name: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💭 thought: Maybe adding the plugin version, for telemetry and maybe checking compatibility with the SDK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now installing a plugin with a different version than the SDK won't be supported. Plugins and SDK need to be updated at the same time.
) into staging-25 pm_trace_id: 37003110 feature_branch_pipeline_id: 37003110 source: to-staging * commit '50503639a46a42efa486a4f72a30b9fc76e12ab5': fix type Add files parameter in karma local Fix event format 👷Skip safari and ie for extension unit tests ✨⚗️ [RUM-4469] introduce a plugin system (#2809)
Motivation
Experiment with a plugin system to provide custom integrations.
This is experimental: the plugin interface might change in any version, be warned!
Changes
Testing
I have gone over the contributing documentation.