#
Getting started
To monitor application performance, Workleap has adopted Honeycomb, a tool that helps teams manage and analyze telemetry data from distributed systems. Built on OpenTelemetry, Honeycomb provides a robust API for tracking frontend telemetry.
Honeycomb's in-house HoneycombWebSDK includes great default instrumentation. This package provides a slightly altered default instrumentation which is adapted for Workleap's web application observability requirements.
#
Install the packages
First, open a terminal at the root of the application and install the following packages:
pnpm add @workleap/honeycomb @honeycombio/opentelemetry-web @opentelemetry/api @opentelemetry/auto-instrumentations-web
yarn add @workleap/honeycomb @honeycombio/opentelemetry-web @opentelemetry/api @opentelemetry/auto-instrumentations-web
npm install @workleap/honeycomb @honeycombio/opentelemetry-web @opentelemetry/api @opentelemetry/auto-instrumentations-web
While you can use any package manager to develop an application with Squide, it is highly recommended that you use PNPM as the guides has been developed and tested with PNPM.
#
Register instrumentation
Then, update the application bootstrapping code to register Honeycomb instrumentation using the registerHoneycombInstrumentation function:
import { registerHoneycombInstrumentation } from "@workleap/honeycomb";
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { App } from "./App.tsx";
registerHoneycombInstrumentation(runtime, "sample", [/.+/g,], {
endpoint: "https://sample-collector"
});
const root = createRoot(document.getElementById("root")!);
root.render(
<StrictMode>
<App />
</StrictMode>
);
Avoid using /.+/g,
in production, as it could expose customer data to third parties. Instead, ensure you specify values that accurately matches your application's backend URLs.
We recommend using an OpenTelemetry collector over an ingestion API key, as API keys can expose Workleap to potential attacks.
With instrumentation in place, a few traces are now available 👇
#
Fetch requests
Individual fetch request performance can be monitored from end to end:
#
Document load
The loading performance of the DOM can be monitored:
#
Unmanaged error
When an unmanaged error occurs, it's automatically recorded:
#
Real User Monitoring (RUM)
The default instrumentation will automatically track the appropriate metrics to display RUM information:
#
Set custom user attributes
Most application needs to set custom attributes on traces about the current user environment. To help with that, @workleap/honeycomb
expose the setGlobalSpanAttribute function.
Update your application bootstrapping code to include the setGlobalSpanAttribute
function:
import { registerHoneycombInstrumentation, setGlobalSpanAttributes } from "@workleap/honeycomb";
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { App } from "./App.tsx";
registerHoneycombInstrumentation(runtime, "sample", [/.+/g,], {
endpoint: "https://sample-collector"
});
setGlobalSpanAttribute("app.user_id", "123");
const root = createRoot(document.getElementById("root")!);
root.render(
<StrictMode>
<App />
</StrictMode>
);
Now, every trace recorded after the execution of setGlobalSpanAttributes
will include the custom attributes app.user_id
:
#
Custrom traces
Have a look at the custom traces page.
#
Try it 🚀
Start the application in a development environment using the dev script. Render a page, then navigate to your Honeycomb instance. Go to the "Query" page and type name = HTTP GET
into the "Where" input. Run the query, select the "Traces" tab at the bottom of the page and view the detail of a trace. You should view information about the request.
#
Troubleshoot issues
If you are experiencing issues with this guide:
- Set the debug predefined option to
true
. - Open the DevTools console. You'll see a log entry for every Honeycomb traces.
- @
honeycombio/opentelemetry-web: Honeycomb link: https://ui.honeycomb.io/...
- @
- Refer to the sample on GitHub.