Registry / observability / probe.gl

probe.gl

JSON →
library3.6.0jsnpmunverified

probe.gl is a robust collection of JavaScript tools designed for console-focused logging, performance instrumentation, benchmarking, and testing across both browser and Node.js environments. The current stable version is 3.6.0. It is developed and maintained as part of the vis.gl open-source visualization suite by Uber, indicating a steady release cadence tied to the evolution of their larger ecosystem. Key differentiators include its 'off by default' design to ensure a minimal performance footprint when not actively used, its lightweight nature, and features like persistent configuration through local storage. It enhances the debugging experience with capabilities such as defeating log cascades (to prevent console flooding) and providing direct source code links from console messages. The library offers a more advanced approach to application insights compared to basic `console.log`.

npm install probe.gl
INSTALL
IMPORT
SIG · PROBE.GL
P
probe.gl
observabilityjavascriptv3.6.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Probe
✓ import Probe from 'probe.gl';
✗ import { Probe } from 'probe.gl'; // Probe is a default export, not named.
The primary `Probe` object is exported as a default. It needs to be explicitly enabled to start logging and instrumentation activities.
log
✓ import { log } from '@probe.gl/log';
✗ import { log } from 'probe.gl'; // Specific logging utilities are in sub-modules.
For dedicated logging functions beyond the methods available directly on the `Probe` instance, import them from the `@probe.gl/log` sub-package.
Timer
✓ import { Timer } from '@probe.gl/stats';
✗ import { Timer } from 'probe.gl'; // Performance classes are typically in sub-modules.
Classes like `Timer` for performance measurement and statistics collection are generally found in the `@probe.gl/stats` sub-package.
window.Probe (browser)
✓ import Probe from 'probe.gl'; window.Probe = Probe;
In browser environments, it's a common pattern to expose the `Probe` instance globally (e.g., to `window.Probe`) for easier access during debugging in the developer console.

Demonstrates enabling probe.gl, setting log levels, using logging utilities, and basic performance timing with a `Timer`.

import Probe from 'probe.gl'; import { log } from '@probe.gl/log'; import { Timer } from '@probe.gl/stats'; // 1. Enable Probe and set logging level // Probe is 'off by default' to minimize performance impact. Probe.enable().setLevel(3); // Enable all features and verbose logging Probe.configure({ isPrintEnabled: true }); // Ensure messages are printed to console console.log('Probe.gl initialized. Check browser console for detailed logs.'); // 2. Use basic logging utilities log.log('Application started successfully.'); log.warn('A non-critical issue detected.', { code: 101, details: 'Example warning payload' }); log.error('Failed to load critical resource!', new Error('Resource not found')); // 3. Measure performance with a Timer const myTimer = new Timer('ExpensiveOperation'); function performExpensiveOperation() { myTimer.start(); // Simulate some work let sum = 0; for (let i = 0; i < 1000000; i++) { sum += Math.sqrt(i); } myTimer.end(); // Automatically logs duration if Probe is enabled log.log(`Result of expensive operation: ${sum}`); } performExpensiveOperation(); // 4. Using the main Probe object for options if (Probe.getOption('myFeatureFlag')) { log.log('Custom feature flag \'myFeatureFlag\' is enabled.'); } else { log.log('Custom feature flag \'myFeatureFlag\' is disabled, configuring it...'); Probe.configure({ myFeatureFlag: true }); log.log('Custom feature flag \'myFeatureFlag\' is now enabled for subsequent checks.'); }
Debug
Known issues
gotchaprobe.gl is 'off by default' to ensure a minimal performance footprint. If you don't explicitly call `Probe.enable()`, no logging or instrumentation will occur.
fix
Always call `Probe.enable()` early in your application's lifecycle, typically after import. You can also configure specific options via `Probe.configure()` and `Probe.setLevel()`.
affects: >=3.0.0
breakingAs with many libraries transitioning in the JavaScript ecosystem, `probe.gl` (especially in major version 3.x) has likely solidified its move to ES Modules (ESM). Direct `require()` statements for CommonJS might lead to issues in modern setups, particularly in browser-first environments or Node.js projects configured for ESM.
fix
Prefer ES Module `import` syntax (`import Probe from 'probe.gl';`) for all modern JavaScript projects. Ensure your build system (Webpack, Rollup, Parcel) or Node.js environment is configured to handle ESM correctly.
affects: >=3.0.0
gotchaConfiguration settings for `probe.gl` are persistent across browser sessions because they are stored in local storage. This can lead to unexpected behavior if you debug with certain settings and then forget to reset them.
fix
Be mindful of `Probe.configure()` and `Probe.enable()` calls. If debugging, consider a reset method (e.g., `localStorage.removeItem('probe.gl:config')` or a custom application setting) or explicitly setting desired options at application start.
affects: >=3.0.0
gotchaSpecific utilities like `log` or `Timer` are often found in dedicated sub-packages (e.g., `@probe.gl/log`, `@probe.gl/stats`) rather than directly exported from the root `probe.gl` package. Importing from the root for these specific functions will result in `undefined` or module not found errors.
fix
Always check the documentation or the package structure for the correct import path for specific tools. Use `import { log } from '@probe.gl/log';` instead of `import { log } from 'probe.gl';`.
affects: >=3.0.0
Errors
Common errors & fixes
TypeError: Probe.enable is not a function
`Probe` was not imported correctly as a default export or was not aliased to `window.Probe` in the browser environment.
fix
Ensure you are using `import Probe from 'probe.gl';`. If exposing to window for debugging, add `window.Probe = Probe;`.
Module not found: Can't resolve 'probe.gl'
This typically indicates an issue with module resolution, often related to attempting to `require()` an ESM-only package in a CommonJS context or a misconfigured bundler.
fix
Verify your project's module resolution settings. For Node.js, ensure you're running in an ESM context (`'type': 'module'` in `package.json` or `.mjs` files). For bundlers, check `resolve` configurations.
Logs are not appearing in the console, even after calling Probe.enable()
The logging level might be too low, or `isPrintEnabled` is false, preventing output to the console.
fix
Ensure `Probe.setLevel(level)` is called with a sufficiently high level (e.g., `Probe.setLevel(3)` for verbose logs). Also, confirm `Probe.configure({ isPrintEnabled: true })` to allow console output. Check browser local storage for persistent probe.gl configurations that might override current settings.
Upgrade
Version history
3.6.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
12
OpenAI (training)
2
Resources
probe.gl — npm install probe.gl · libregistry