SIGN IN SIGN UP

fix(server): attach service and pod identity to exported metrics (#24756)

## Context

The `MeterProvider` in `instrument.ts` is created without a resource, so
every metric exported through the OTLP pipeline lands in ClickHouse with
`ResourceAttributes: {'service.name': 'unknown_service:node', ...}` and
no pod identity. Fleet-level questions are answerable (max event-loop
utilization, pool saturation) but per-pod attribution is impossible:
prod currently shows some pod pinned at event-loop utilization 1.0 at
every minute of the day and a core pool at 40/40 with up to 83 queued
requests, and there is no way to tell which deployment or pod it is.
(The Prometheus scrape path is unaffected — it gets pod labels from the
scraper.)

## What this does

Gives the `MeterProvider` a resource with `service.name`
(`OTEL_SERVICE_NAME` env, default `twenty-server`) and `k8s.pod.name`
(`HOSTNAME`, which Kubernetes sets to the pod name; `os.hostname()`
fallback locally). Pod names encode the deployment
(`twenty-server-worker-default-*`, `twenty-server-*`), so this is enough
to attribute any ClickHouse-backed panel per component and per pod.

Adds `@opentelemetry/resources` as a direct dependency — it was already
in the tree at 2.8.0 via `@opentelemetry/sdk-metrics`, so the lockfile
change is descriptor-only.

<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/twentyhq/twenty/pull/24756?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
C
Charles Bochet committed
95ea62c9d9f6c408c22bf77cd6be355263cfa5eb
Parent: 15b9cbe
Committed by GitHub <noreply@github.com> on 8/25/2026, 1:57:56 PM