getsentry / getsentry/sentry-javascript

Add file path attribute to page-related spans

Đang mở
#17,134 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Feature
Ngôn ngữ chính
TypeScript
Star
8.7k
Fork
1.8k
Merge trung bình
1 ngày 17 giờ
Pull request đã merge (30 ngày)
515

Mô tả

### Problem Statement

Our `pageload`, `navigation` but also ` http.server` spans often can be be mentally associated to specific files. For example:

- A pageload of a NextJS (/insert file-based routing framework of your choice) route, has a clear file where the page code is living
- A server-side SSR request for a specific page in an NextJS app can be associated with the same files.

Today, we don't track this information with our spans. In many cases, the span name will be very similar to the file path, but any connection we make here will always be implicit and prone to errors (e.g. `/users/[id]` corresponding to a route like `src/users/[id]/page.jsx`

### Solution Brainstorm

For framework SDKs where we already collect build-time information about the available routes (e.g. #16686 or more broadly, our recent [parametrization efforts](https://linear.app/getsentry/project/parametrized-routes-everywhere-443af0345211)), this should be possible.

Things get more complicated for frameworks or projects that don't rely on file-based routing. For these, adding a file name attribute is likely out of scope.

We'll probably make use of the [`code.file.path` attribute](https://opentelemetry.io/docs/specs/semconv/registry/attributes/code/#code-file-path) semantic attribute.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.