Skip to content
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

⚗️ Modular SDK - Split by feature using plugins #2987

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

amortemousque
Copy link
Contributor

Motivation

  • Extend the plugin system to be used for internal SDK feature
  • Add lazy loading plugin capability

Changes

Extends the plugin

export interface RumPlugin {
name: string
getApi?(): { [key: string]: any }
getConfigurationTelemetry?(): Record<string, unknown>
getInternalContext?(options: { startTime: RelativeTime }): Context
onInit?(options: { initConfiguration: RumInitConfiguration; publicApi: RumPublicApi }): void
onStart?(...args: any[]): void
onEvent?(options: { startTime: RelativeTime; rumEvent: RumEvent & Context }): void
onTelemetryEvent?(options: { telemetryEvent: TelemetryEvent }): void
}

Ex: action plugin

Wait for the plugins to be loaded before starting (Ìn preStartRum):

const lazyLoadedPlugins = await loadLazyPlugins(['action']) // look at how to pass the required plugins from the init config
if (!lazyLoadedPlugins) {
return
}

Call plugins hooks during the SDK lifecycle

Testing

  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

@amortemousque amortemousque changed the title Aymeric/modular sdk [Experimentation] Modular SDK - Split by feature using plugins Sep 17, 2024
@amortemousque amortemousque changed the title [Experimentation] Modular SDK - Split by feature using plugins ⚗️ Modular SDK - Split by feature using plugins Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant