Skip to content

feat(observability): identify the lens on eth_call wide events - #89

Draft
haydenshively wants to merge 1 commit into
mainfrom
lens-identity
Draft

haydenshively wants to merge 1 commit into
mainfrom
lens-identity

Conversation

@haydenshively

Copy link
Copy Markdown
Collaborator

Context

  • A wide event doesn't say which lens a lens eth_call ran. The lens is identified by its bytecode and calldata, and observe trims every req string to 100 characters, which cuts both off.
  • withLogging metadata can't fill the gap. Hosts open the scope once per procedure or lambda, well above individual calls, and nesting a second scope drops the outer one's fields.
  • As a result, the packing chart downstream can only split by procedure, and several lenses collapse into one point. Closes APPS-1495, narrowed to lens identity.

Special things to note

  • The label travels inside the policy sentinel, so it changes the request bytes without changing cache identity. Two concurrent cached requests that differ only by label no longer coalesce in one cycle. The second waits for the next leader cycle and is then served from the entries the first wrote. viem's own request dedupe treats them as distinct for the same reason.
  • No ALS changes. A general "merge fields into the current scope" helper (APPS-1495's original suggestion) is left out until another call-site field needs it.

Change outline

Each lens handler adds three fields to the eth_call facet it already writes (deployless.eth_call.* or cache.eth_call.*). Both handlers already decode everything required.

 facet.set({
   input_elements,
+  lens_address,    // counterfactual address from factory + factoryData; changes with each lens build
+  lens_signature,  // per-item function, e.g. "balancesOf(address)"
+  lens_label,      // policy.label, when the caller sets it
 })
  • EthCallPolicy gains label?: string. readLens and policy() accept it and pass it through.
  • lens_address lets dashboards tell lens versions apart. lens_label gives a readable name without a lookup table from addresses to names.

Evidence

  • New tests in deployless.test.ts and cache/eth-call/handler.test.ts read all three fields off the emitted event. A cache test shows a labelled request served entirely from entries an unlabelled one wrote.
  • pnpm test: 688 passed, 1 skipped. pnpm typecheck and biome check are clean.

🤖 Generated with Claude Code

Both lens handlers stamp `eth_call.lens_address` and `eth_call.lens_signature`
on their facet, and `EthCallPolicy` gains an optional `label`, accepted by
`readLens` and `policy()`, stamped as `eth_call.lens_label`. The label is not
part of cache identity.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant