Install with no code change
Turn WizeLens on for Node and ASP.NET Core without touching their code, with a Node --import hook, a .NET startup hook, or a Kubernetes webhook.
On this page 6 sections
Platform teams can turn WizeLens on for a service without a pull request to it. The app keeps its code; WizeLens comes in when the process starts, and environment variables set it up. The code install still works, and wins when both are there.
| You run | Turn it on with | Needs |
|---|---|---|
| Node | NODE_ |
Node 22. |
| ASP. |
DOTNET_ set to the hook's file |
. |
| Kubernetes | The label wizelens. on a pod template |
The wizelens-inject chart, once |
Node
NODE_OPTIONS="--import @wizeworks/lens-node/auto" node server.js
@wizeworks/lens-node must be where Node can find it: installed in the app (npm install @wizeworks/lens-node, no code),
or anywhere on disk with a path, for example --import /opt/wizelens/node/dist/auto.js. Node 22.13 or newer.
It hooks everything the add-on supports, as the app loads it:
| What | Hooked |
|---|---|
| Requests | Every node:http and node:https server, so every framework.@koa/), Hono (@hono/), Next. |
| Errors | Express (next(err) and unhandled), Fastify, Koa, and Hono errors go on the request span |
| Databases | pg, mysql2, better-sqlite3, node:sqlite, Prisma Client (@prisma/), ioredis, node-redis, MongoDB, and Elasticsearch. |
| Outgoing calls | fetch, undici, and node:http /node:https (axios, got, the AWS SDK) |
| gRPC and messaging | @grpc/, amqplib, kafkajs, @azure/, BullMQ, and Amazon SQS |
| GraphQL | graphql-js and GraphQL Yoga |
| Logs | console, pino (also Fastify's logger), winston, and bunyan |
| Metrics | CPU, memory, heap, event loop, and GC |
Nothing starts until the process serves a request or starts a server, so npm, build tools, and scripts that inherit
NODE_OPTIONS stay untouched. Worker threads are skipped.
On Node 22.13 and 22.14
The hooks that edit ES modules are off. That leaves out Hono's ES build, the ES builds of @azure/service-bus, the
Elasticsearch 9 transport, BullMQ, and the SQS client, graphql 16's ES build, and import "node:sqlite". Node 22.15 and
newer have them all.
ASP.NET Core
The startup hook is built for .NET 10. On .NET 8 or 9, add the WizeLens.AspNetCore package instead (ASP.NET Core).
DOTNET_STARTUP_HOOKS=/opt/wizelens/dotnet/WizeLens.AutoInstrumentation.dll dotnet MyApp.dll
The hook is a folder: WizeLens.AutoInstrumentation.dll with its dependencies next to it. Get it from the
wizelens-dotnet-auto-<version>.zip file on each GitHub release, from /wizelens/dotnet in the
ghcr.io/wizeworksllc/wizelens-inject image, or build it with
dotnet publish dotnet/src/WizeLens.AutoInstrumentation -c Release -o /opt/wizelens/dotnet.
If the app references the WizeLens.AutoInstrumentation NuGet package (still no code), one variable is enough:
ASPNETCORE_HOSTINGSTARTUPASSEMBLIES=WizeLens.AutoInstrumentation.
It does what AddWizeLens() and UseWizeLens() do: requests, routes, outgoing HTTP and gRPC, Npgsql, MySqlConnector, and
SqlClient, every ILogger line, metrics, and the dashboard at /_wizelens. It also records EF Core commands with no
UseWizeLens() on the DbContext, and the exceptions that the exception page or UseExceptionHandler catch. It works with
WebApplication and the generic web host. ASPNETCORE_PREVENTHOSTINGSTARTUP=true turns it off.
Settings
The same variables as the code install, plus the standard OpenTelemetry service name:
| Variable | What |
|---|---|
OTEL_ |
Service name.service. in OTEL_, else the app's package. name (no scope), else node-app. |
WIZELENS_ |
On or off. |
WIZELENS_ |
Serve / in the app. |
WIZELENS_ |
false takes the HUD off the app's HTML pages./ is served |
WIZELENS_, WIZELENS_ |
Where to send, see the hub and the cloud |
WIZELENS_ |
The project on a shared hub |
WIZELENS_ |
Share of traces kept, see Sampling |
WIZELENS_ |
The app's version on every span, for release markers and Problems |
WIZELENS_, WIZELENS_, WIZELENS_ |
Lines written outside a request, see Logs |
WIZELENS_ |
false stops the package report for the known-vulnerability check |
WIZELENS_ |
Node: hooks to leave off, comma-separated, for example prisma,pino |
The names WIZELENS_AUTO_SKIP takes: express, koa, fastify, hono, next, nest, pg, mysql2, sqlite,
prisma, ioredis, redis, mongodb, elasticsearch, amqplib, kafkajs, servicebus, bullmq, sqs, grpc,
graphql, pino, winston, and bunyan. The full list of variables is on Configuration.
In production, set WIZELENS_ENABLED=true and a hub, like any service: see Production.
Kubernetes
A mutating admission webhook adds the hook and the variables to every pod labeled wizelens.dev/inject. Install its
chart once:
helm install wizelens-inject oci://ghcr.io/wizeworksllc/charts/wizelens-inject \
--namespace wizelens --create-namespace \
--set endpoint=http://wizelens-hub.wizelens:5960
Then label a pod template and restart it:
spec:
template:
metadata:
labels:
wizelens.dev/inject: node # or: dotnet
Each new pod gets a small first step that copies the WizeLens files into a shared folder at /wizelens, then
NODE_OPTIONS (Node) or DOTNET_STARTUP_HOOKS (.NET), joined to any value the container already sets, and the settings
above. A variable the container sets itself is kept. The pod's annotations change one pod:
| Annotation | What |
|---|---|
wizelens. |
Service name.app. or app label, else the container name |
wizelens. |
Where this pod sends: a hub or the cloud |
wizelens. |
Project.project, else the namespace |
wizelens. |
"true" serves / in the pod |
wizelens. |
Only these containers, for example api,worker |
Chart values: endpoint, existingSecret.name and .key (default token; a Secret in each app namespace, read as WIZELENS_TOKEN),
project, dashboard, namespaceLabels (limit to labeled namespaces), and failurePolicy (default Ignore: a webhook
that is down never blocks a deploy). Injected pods carry wizelens.dev/injected. The chart makes its own TLS certificate.
When the app installs WizeLens too
The code install wins. Node: when the app calls createWizeLens(), the auto install stops its own instance and prints
... installs WizeLens in code, so the auto install steps aside. Libraries it already hooked send to the app's instance,
so nothing is counted twice. .NET: AddWizeLens() takes over the registration with its own options, and
UseWizeLens() adds the middleware once. Both need this version or newer on both sides.
Try it
The samples have no WizeLens code. With a hub running (pnpm dev:hub):
cd samples/auto-node && WIZELENS_ENDPOINT=http://localhost:5960 pnpm start:auto
dotnet build dotnet/WizeLens.slnx -c Release
DOTNET_STARTUP_HOOKS=$PWD/dotnet/src/WizeLens.AutoInstrumentation/bin/Release/net10.0/WizeLens.AutoInstrumentation.dll \
WIZELENS_ENDPOINT=http://localhost:5960 dotnet samples/auto-dotnet/bin/Release/net10.0/AutoDotnet.dll
Open http://localhost:5960/_wizelens and call /api/products/1/related on either: an N+1 shows up in its trace.