@fiberplane/hono-otel
Version:
Hono middleware to forward OpenTelemetry traces to a local instance of @fiberplane/studio
19 lines (18 loc) • 642 B
JavaScript
import { getFpResolvedConfig } from "./context.js";
/**
* Helper function to determine whether we want to record potentially sensitive data
* inside trace attributes.
*
* Optionally takes a config argument, but falls back to whatever is set on the OpenTelemetry context.
*
* If this returns true, then traces will include things like:
* - environment variables
* - sensitive req/res headers
* - results from database queries
* - etc., etc.,
*/
export function getShouldTraceEverything(resolvedConfig) {
const config = resolvedConfig ?? getFpResolvedConfig();
const isLocal = config?.mode === "local";
return isLocal;
}