APM / Performance

Приём Sentry transactions через envelope, просмотр waterfall в dashboard.

DevLogs принимает Sentry transactions через envelope и показывает список transactions с waterfall spans в личном кабинете.

Поддерживаются transaction + spans (Sentry envelope), waterfall, N+1/slow hints, Apdex за 24 ч и нативный модуль performance в devlogs-sdk-js.

1. Sentry SDK Performance

Укажите DevLogs DSN (см. миграцию с Sentry) и включите tracing:

javascript
import * as Sentry from "@sentry/browser";

Sentry.init({
  dsn: "https://YOUR_PUBLIC_KEY@dev-logs.ru/YOUR_PROJECT_ID",
  tracesSampleRate: 1.0,
});

// SDK отправляет transaction items в /api/{projectId}/envelope/

2. Node / Next.js

javascript
import * as Sentry from "@sentry/node";

Sentry.init({
  dsn: "https://YOUR_PUBLIC_KEY@dev-logs.ru/YOUR_PROJECT_ID",
  tracesSampleRate: 1.0,
});

const transaction = Sentry.startTransaction({ name: "my-task", op: "task" });
// ... work ...
transaction.finish();

3. Dashboard

  • Список: /dashboard/projects/[id]/performance
  • Детали + waterfall: /dashboard/projects/[id]/performance/[traceId]
  • На странице issue — ссылка «Trace / transaction», если в событии есть contexts.trace.trace_id

4. devlogs-sdk-js performance

Без Sentry SDK — опциональный helper: envelope transaction + instrumentFetch() в браузере, wrapHttpHandler в Node. Нужен DSN в формате Sentry URL.

javascript
import { init, performance } from 'devlogs-sdk-js';

init({
  dsn: "https://YOUR_PUBLIC_KEY@dev-logs.ru/YOUR_PROJECT_ID",
  serverUrl: "https://dev-logs.ru",
});

performance.instrumentFetch(); // browser — одна transaction на fetch

// Node: http.createServer(performance.wrapHttpHandler((req, res) => { ... }));

5. REST API (session auth)

text
GET /api/projects/{projectId}/transactions?limit=50&offset=0
GET /api/projects/{projectId}/transactions/stats
GET /api/projects/{projectId}/transactions/{traceId}  — включает hints

6. Ingest и ограничения

  • Sentry envelope transaction — да; OpenTelemetry JSON: POST /api/{projectId}/otel/v1/traces.
  • Waterfall и flamegraph на странице trace.
  • Service map — /performance/service-map.