Skip to content

feat(personhog): add caller tag support to Node.js client#60368

Merged
nickbest-ph merged 6 commits into
masterfrom
nick/personhog-caller-tag-nodejs
May 29, 2026
Merged

feat(personhog): add caller tag support to Node.js client#60368
nickbest-ph merged 6 commits into
masterfrom
nick/personhog-caller-tag-nodejs

Conversation

@nickbest-ph
Copy link
Copy Markdown
Contributor

@nickbest-ph nickbest-ph commented May 27, 2026

Problem

We need per-caller attribution on personhog gRPC requests to identify which code paths are generating high-latency/data-intensive requests. The x-caller-tag header (consumed by the router in PR #60361) provides this, but each client service needs to send it.

Changes

  • Adds callerTag optional config to PersonHogClientConfig
  • Adds a gRPC interceptor that sets the x-caller-tag header on every request

How did you test this code?

  • existing unit tests

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 27, 2026

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
nodejs/src/ingestion/personhog/index.ts:21-24
Both `clientName` and `callerTag` derive from the same expression `config.PLUGIN_SERVER_MODE ?? 'unknown'`. Extracting it into a local variable avoids repeating the fallback logic and makes it clear that the two headers intentionally carry the same value.

```suggestion
    const serviceMode = config.PLUGIN_SERVER_MODE ?? 'unknown'
    return PersonHogClient.fromConfig({
        addr: config.PERSONHOG_ADDR,
        clientName: serviceMode,
        callerTag: serviceMode,
```

Reviews (1): Last reviewed commit: "feat(personhog): add caller tag support ..." | Re-trigger Greptile

Comment thread nodejs/src/ingestion/personhog/index.ts Outdated
Add callerTag config option and x-caller-tag header interceptor to the
Node.js PersonHogClient. The tag is set from PLUGIN_SERVER_MODE,
giving per-server-mode attribution (e.g., "events", "cdp-api",
"error-tracking") in the router's response_size_bytes and
backend_duration_ms metrics.
…group repositories

Add callerTag parameter to all person/group repository read interfaces
and wire feature-level context tags from each call site:

- cdp/hogflow-person-enrichment, cdp/hogflow-group-type-resolution, etc.
- ingestion/person-resolution, ingestion/group-type-resolution, etc.
- error-tracking/person-properties

Tags flow to both gRPC x-caller-tag headers (for personhog router
attribution) and PostgreSQL SQL comment annotations (for DB-level
observability). The interceptor now only sets the default tag when no
per-call tag is present.
The default callerTag duplicated clientName (both PLUGIN_SERVER_MODE).
x-client-name already identifies the service; untagged call paths should
show as "unknown" caller tag to make coverage gaps visible.
@nickbest-ph nickbest-ph force-pushed the nick/personhog-caller-tag-nodejs branch from 0fe18d4 to d5d6dba Compare May 29, 2026 21:37
@nickbest-ph nickbest-ph merged commit 9fc3381 into master May 29, 2026
145 checks passed
@nickbest-ph nickbest-ph deleted the nick/personhog-caller-tag-nodejs branch May 29, 2026 22:46
@deployment-status-posthog
Copy link
Copy Markdown

deployment-status-posthog Bot commented May 29, 2026

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-05-29 23:07 UTC Run
prod-us ✅ Deployed 2026-05-29 23:18 UTC Run
prod-eu ✅ Deployed 2026-05-29 23:20 UTC Run

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.

2 participants