home / skills / workleap / wl-telemetry / workleap-telemetry-v2

workleap-telemetry-v2 skill

/agent-skills/workleap-telemetry-v2

This skill helps frontend developers initialize wl-telemetry, correlate telemetry IDs across Honeycomb LogRocket and Mixpanel, and troubleshoot unified

npx playbooks add skill workleap/wl-telemetry --skill workleap-telemetry-v2

Review the files below or copy the command above to add this skill to your agents.

Files (4)
SKILL.md
3.8 KB
---
name: workleap-telemetry-v2
description: |
  Guide for Workleap's telemetry solution (@workleap/telemetry) that unifies Honeycomb, LogRocket, and Mixpanel with consistent correlation IDs.

  Use this skill when:
  (1) Initializing wl-telemetry in a frontend application
  (2) Working with correlation values (Telemetry Id, Device Id) and their lifecycle
  (3) Using Honeycomb for distributed tracing and performance analysis
  (4) Creating and enriching Honeycomb traces/spans using OpenTelemetry
  (5) Using LogRocket for session replay and frontend debugging
  (6) Using Mixpanel for product analytics and event tracking
  (7) Understanding Honeycomb, LogRocket, and Mixpanel roles in wl-telemetry
  (8) Correlating data across Honeycomb, LogRocket, and Mixpanel
  (9) Configuring loggers for wl-telemetry diagnostics
  (10) Using Noop telemetry clients to disable/mock telemetry
  (11) Reviewing PRs that add or modify telemetry instrumentation
  (12) Troubleshooting missing or inconsistent telemetry across tools
---

# Workleap Telemetry (wl-telemetry)

`@workleap/telemetry` is an umbrella package that integrates Honeycomb, LogRocket, and Mixpanel with consistent correlation IDs for unified debugging and analysis.

## Core Concepts

### Correlation Values

Two automatic correlation IDs unify all telemetry platforms:

| ID | Purpose | Honeycomb | LogRocket/Mixpanel |
|---|---|---|---|
| **Telemetry Id** | Single app load | `app.telemetry_id` | `Telemetry Id` |
| **Device Id** | Device across sessions | `app.device_id` | `Device Id` |

If LogRocket is enabled, Honeycomb and Mixpanel automatically receive `app.logrocket_session_url` / `LogRocket Session URL`.

### Platform Roles

- **Honeycomb**: Distributed traces, performance monitoring, RUM metrics (LCP, CLS, INP)
- **LogRocket**: Session replay, frontend debugging, user experience investigation
- **Mixpanel**: Product analytics, event tracking, user behavior insights

## Quick Start

```typescript
import { initializeTelemetry, TelemetryProvider } from "@workleap/telemetry/react";

const telemetryClient = initializeTelemetry({
  logRocket: { appId: "your-app-id" },
  honeycomb: {
    namespace: "your-namespace",
    serviceName: "your-service",
    apiServiceUrls: [/.+/g],
    options: { proxy: "https://your-otel-proxy" }
  },
  mixpanel: {
    productId: "wlp",
    envOrTrackingApiBaseUrl: "production"
  }
});

// Wrap application
<TelemetryProvider client={telemetryClient}>
  <App />
</TelemetryProvider>
```

## Using Platform Clients

```typescript
// Access via hooks
const telemetryClient = useTelemetryClient();
const honeycombClient = useHoneycombInstrumentationClient();
const logRocketClient = useLogRocketInstrumentationClient();
const mixpanelClient = useMixpanelClient();
const track = useMixpanelTrackingFunction();
```

## Storybook/Testing (Noop Clients)

```typescript
import { NoopTelemetryClient, TelemetryProvider } from "@workleap/telemetry/react";

const telemetryClient = new NoopTelemetryClient();

<TelemetryProvider client={telemetryClient}>
  <Story />
</TelemetryProvider>
```

## Detailed References

- **Full API Reference**: See [references/api.md](references/api.md) for complete APIs
- **Integration Patterns**: See [references/integrations.md](references/integrations.md) for platform-specific patterns
- **Usage Examples**: See [references/examples.md](references/examples.md) for common patterns

## Critical Rules

1. **Use umbrella package** - Always use `@workleap/telemetry`, not standalone packages
2. **Do not invent APIs** - Only use documented APIs from references
3. **Correlation is automatic** - Never manually set Telemetry Id or Device Id
4. **Noop for non-production** - Use `NoopTelemetryClient` in Storybook/tests
5. **Privacy matters** - Never log PII to LogRocket; use `data-public`/`data-private` attributes

Overview

This skill guides use of Workleap's wl-telemetry package (@workleap/telemetry) to unify Honeycomb, LogRocket, and Mixpanel with consistent correlation IDs. It explains initialization, platform roles, correlation lifecycle, and common patterns for instrumentation and testing. The guidance focuses on practical steps to get reliable, correlated telemetry across tracing, session replay, and analytics.

How this skill works

The package initializes clients for Honeycomb (OpenTelemetry tracing and RUM), LogRocket (session replay), and Mixpanel (event analytics) and attaches two automatic correlation values—Telemetry Id (per app load) and Device Id (across sessions). When LogRocket is enabled, session URLs are propagated into Honeycomb and Mixpanel for direct cross-tool navigation. Clients are exposed via React hooks and a TelemetryProvider so instrumentation and enrichment are consistent across the app.

When to use it

  • Initializing wl-telemetry in a frontend React app and wrapping the app with TelemetryProvider.
  • Managing correlation values (Telemetry Id, Device Id) and trusting the automatic lifecycle.
  • Adding distributed traces and spans with Honeycomb/OpenTelemetry for performance and RUM metrics.
  • Enabling LogRocket for session replay and linking sessions to traces and analytics events.
  • Tracking product events and user actions with Mixpanel while preserving correlation IDs.

Best practices

  • Always import and initialize the umbrella package @workleap/telemetry; do not mix undocumented standalone APIs.
  • Never manually set Telemetry Id or Device Id; let the library manage correlation automatically.
  • Use NoopTelemetryClient in Storybook and unit tests to avoid sending telemetry from non-production environments.
  • Do not include PII in LogRocket recordings; mark DOM attributes with data-public/data-private as required.
  • Propagate LogRocket session URL to Honeycomb/Mixpanel by enabling LogRocket in initialization for easier cross-tool debugging.

Example use cases

  • Bootstrapping telemetry during app startup and exposing clients via TelemetryProvider for hooks-based access.
  • Creating Honeycomb spans around network requests and enriching them with the current Telemetry Id and LogRocket session URL.
  • Recording Mixpanel events that include correlated Telemetry Id and Device Id to join analytics with traces.
  • Using NoopTelemetryClient in Storybook to test UI without emitting telemetry.
  • Reviewing a PR that adds new spans or events to ensure it uses the documented APIs and automatic correlation.

FAQ

How do I disable telemetry in tests or Storybook?

Use NoopTelemetryClient and pass it to TelemetryProvider so hooks return no-op clients and nothing is sent.

Can I set Telemetry Id or Device Id myself?

No. The library manages Telemetry Id and Device Id automatically; do not manually override them.