#
Getting started
To monitor application performance, Workleap has adopted Honeycomb, a tool that helps teams capture and analyze distributed traces and metrics to understand and monitor complex systems, application behaviors, and performance. Built on OpenTelemetry, Honeycomb provides a robust API for frontend telemetry.
While Honeycomb's in-house HoneycombWebSDK includes great default instrumentation, this package provides a slightly altered default instrumentation which is adapted for Workleap's applications' requirements.
#
Install the packages
First, open a terminal at the root of the application and install the following packages:
pnpm add @workleap/telemetry @workleap/honeycomb @opentelemetry/api
#
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("sample", "my-app", [/.+/g,], {
proxy: "https://sample-proxy",
verbose: true
});
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 with an authenticated proxy over an ingestion API key, as API keys can expose Workleap to potential attacks.
It's recommended to log as much relevant information as possible to the console, as LogRocket includes console output in its session replays.
This applies not only to Honeycomb instrumentation, but also to any frontend code or libraries in use. However, make sure not to log any Personally Identifiable Information (PII).
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:
#
LogRocket session URL
If LogRocket instrumentation is registered, Honeycomb traces are enriched with the LogRocket session URL as soon as it becomes available:
#
Correlation ids
The registerLogRocketInstrumentation
function automatically adds two attributes to every trace:
app.telemetry_id
: Identifies a single application load. It's primarily used to correlate Honeycomb traces with the other telemetry platforms.app.device_id
: Identifies the user's device across sessions. This value is extracted from the sharedwl-identity
cookie, which is used across Workleap's marketing sites and web applications.
#
Set custom user attributes
Most applications need to set custom attributes on traces about the current user environment. To help with that, @workleap/honeycomb
expose the setGlobalSpanAttributes function.
Update your application code to include the setGlobalSpanAttribute
function:
import { setGlobalSpanAttributes } from "@workleap/honeycomb";
setGlobalSpanAttribute("app.user_id", "123");
Now, every trace recorded after the execution of setGlobalSpanAttribute
will include the custom attribute 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 verbose predefined option to
true
. - Open the DevTools console. Look for logs starting with
[honeycomb]
. - You should also see a log entry for every Honeycomb traces.
honeycombio/opentelemetry-web: Honeycomb link: https://ui.honeycomb.io/...
- Refer to the sample on GitHub.
#
Filter by correlation ids
The registerLogRocketInstrumentation
function automatically adds two user traits to every session replay to unify LogRocket with the other telemetry platforms:
app.telemetry_id
: Identifies a single application load. It's primarily used to correlate Honeycomb traces with the other telemetry platforms.app.device_id
: Identifies the user's device across sessions. This value is extracted from the sharedwl-identity
cookie, which is used across Workleap's marketing sites and web applications.
To correlate a session with other telemetry platforms, filter the query with the app.telemetry_id
or app.device_id
fields into the "Where" input.
#
Migrate
To benefit from the new integrated experience, follow the migration guide for v6.0
.