Frontend instrumentation is in its early stages. If you encounter any issues contact support.
Configuration is required.
Sprkl frontend instrumentation provides function-level instrumentation to every code change. The frontend trace will show you every click and HTTP request made, connecting it to the related source code, and propagating the context to your backend.
Sprkl and OpenTelemetry instrumentation can be enabled on the frontend by doing the following:
exporttypeOptions= {/** When enabled, the modes in which sprkl operates. Mode is either 'development' or 'production'. In rollup mode is 'development' when using watch mode, otherwise 'production'.@default [development] */ modes?:Mode[];/** The target determines the type of transformation.@default'web' */ target?:Target;/** Sprkl configuration path.@default ${homedir()}/.sprkl/cli.json */ config?:string;/** Enables running a command each time the server restarts, useful in 'development' mode. The main purpose is the use `sprkl apply` each restart so the code will be instrumented automatically. */ exec?: {/**@default false */ enabled?:boolean;/** Determines which mode to execute the given script.@default development */ mode?:Mode;/** Execution script to run every time server is loaded.@default sprkl apply */ script?:string;/**@default The current root directory */ workingDirectory?:string; };};
Other
For any other tooling or servers (like Remix), we provide Web server instrumentation, although this method is less preferred and is unstable.
This instrumentation tries to transform the javascript/ HTML files that are being served from that server. Since there are many implementations of frontend web servers, the code-level Sprkl instrumentation may not work, but OpenTelemetry instrumentation should work in any case.
Note that enabling the web server instrumentation with the webpack loader or rollup plugin can cause issues due to collision, so to be on the safe side prefer the Webpack loader or Rollup plugin.
Enable Sprkl web server instrumentation with the flag:
# Short formsprkl--web-server=true--<YOURCOMMAND># Long formsprkl--opentelemetry.instrumentations.web-server.enabled=true--<YOURCOMMAND># Disable withsprkl--opentelemetry.instrumentations.web-server.enabled=false--<YOURCOMMAND># Kubernetes# To enable web server instrumentation in Kubernetes deploy the operator with the flag enabled.sprkl--web-server=truek8sapply
Or add in the configuration file at ~/.sprkl/cli.json: