Skip to content

Commit 43ff851

Browse files
author
Shannon Anahata
committed
Resolve merge conflicts with master
2 parents aa9d965 + d6377c7 commit 43ff851

File tree

8 files changed

+316
-5
lines changed

8 files changed

+316
-5
lines changed

develop-docs/development-infrastructure/testing.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,10 @@ See the [Frontend Handbook](/frontend/#testing) for more Jest testing tips.
363363

364364
```shell
365365
# Run jest in interactive mode
366-
yarn test
366+
pnpm test
367367

368368
# Run a single test
369-
yarn test tests/js/spec/views/issueList/overview.spec.js
369+
pnpm test tests/js/spec/views/issueList/overview.spec.js
370370
```
371371

372372
### API Fixtures

develop-docs/sdk/telemetry/logs.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,6 @@ If a log is generated by an SDK integration, the SDK should also set the `sentry
311311

312312
#### User Attributes
313313

314-
If `sendDefaultPii`/`send_default_pii` is set to `true` in the SDK, the SDK should attach the following user data if available:
315-
316314
1. `user.id`: The user ID. Maps to `id` in the [User](/sdk/data-model/event-payloads/user/) payload.
317315
2. `user.name`: The username. Maps to `username` in the [User](/sdk/data-model/event-payloads/user/) payload.
318316
3. `user.email`: The email address. Maps to `email` in the [User](/sdk/data-model/event-payloads/user/) payload.
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
---
2+
title: Span Protocol
3+
---
4+
5+
<Alert level="info">
6+
This document uses key words such as "MUST", "SHOULD", and "MAY" as defined in [RFC 2119](https://www.ietf.org/rfc/rfc2119.txt) to indicate requirement levels.
7+
</Alert>
8+
9+
The SDK must implement a new "span v2" envelope item, which is used to emit spans to Sentry.
10+
11+
## Span v2 Envelope Item Header
12+
13+
The envelope item header must contain the following properties:
14+
15+
```json
16+
{
17+
"type": "span",
18+
"item_count": 2,
19+
"content_type": "application/vnd.sentry.items.span.v2+json"
20+
}
21+
```
22+
23+
## Span v2 Envelope Item Payload
24+
25+
The envelope item payload must contain an `items` array with span one and up to 1000 span objects:
26+
27+
```json
28+
{
29+
"items": [
30+
{
31+
"trace_id": "6cf173d587eb48568a9b2e12dcfbea52",
32+
"parent_span_id": null,
33+
"span_id": "438f40bd3b4a41ee",
34+
"name": "GET /users",
35+
"status": "ok",
36+
"is_remote": true,
37+
"kind": "server",
38+
"start_timestamp": 1742921669.158209,
39+
"end_timestamp": 1742921669.180536,
40+
"attributes": {
41+
"sentry.release": {
42+
"type": "string",
43+
"value": "1.0.0"
44+
},
45+
"sentry.environment": {
46+
"type": "string",
47+
"value": "local"
48+
},
49+
"sentry.platform": {
50+
"type": "string",
51+
"value": "php"
52+
},
53+
"sentry.sdk.name": {
54+
"type": "string",
55+
"value": "sentry.php"
56+
},
57+
"sentry.sdk.version": {
58+
"type": "string",
59+
"value": "4.10.0"
60+
},
61+
"sentry.transaction_info.source": {
62+
"type": "string",
63+
"value": "route"
64+
},
65+
"sentry.origin": {
66+
"type": "string",
67+
"value": "auto"
68+
},
69+
"server.address": {
70+
"type": "string",
71+
"value": "127.0.0.1"
72+
},
73+
"http.response.status_code": {
74+
"type": "integer",
75+
"value": 200
76+
},
77+
"links": [
78+
{
79+
"span_id": "6c71fc6b09b8b716",
80+
"trace_id": "627a2885119dcc8184fae7eef09438cb",
81+
"sampled": true,
82+
"attributes": {
83+
"sentry.link.type": {
84+
"type": "string",
85+
"value": "previous_trace"
86+
}
87+
}
88+
}
89+
]
90+
},
91+
},
92+
{
93+
"trace_id": "6cf173d587eb48568a9b2e12dcfbea52",
94+
"parent_span_id": "438f40bd3b4a41ee",
95+
"span_id": "f1196292f76e45c0",
96+
"name": "app.handle",
97+
"status": "ok",
98+
"is_remote": false,
99+
"kind": "server",
100+
"start_timestamp": 1742921669.178306,
101+
"end_timestamp": 1742921669.180484,
102+
"attributes": {
103+
"sentry.origin": {
104+
"type": "string",
105+
"value": "auto"
106+
}
107+
}
108+
}
109+
]
110+
}
111+
```
112+
113+
## Span v2 Protocol Properties
114+
115+
### Envelope Item Header Properties
116+
117+
| Property | Type | Required | Description |
118+
|----------|------|----------|-------------|
119+
| `type` | string | Yes | Must be set to `"span"` to identify this as a span envelope item |
120+
| `item_count` | integer | Yes | Number of span items in the payload |
121+
| `content_type` | string | Yes | Must be set to `"application/vnd.sentry.items.span.v2+json"` |
122+
123+
### Span Properties
124+
125+
| Property | Type | Required | Description |
126+
|----------|------|----------|-------------|
127+
| `trace_id` | string | Yes | 32-character hexadecimal string (a valid uuid4 without dashes) |
128+
| `span_id` | string | Yes | 16-character hexadecimal string (a valid uuid4 without dashes) |
129+
| `parent_span_id` | string | No | 16-character hexadecimal string (a valid uuid4 without dashes) |
130+
| `name` | string | Yes | A low cardinality description of what the span represents (e.g., "GET /users", "database.query") |
131+
| `status` | string | Yes | Status of the span operation. Either `"ok"` or `"error"` |
132+
| `is_remote` | boolean | Yes | Whether the SpanContext creating the span was received from somewhere else or locally generated |
133+
| `kind` | string | Yes | The kind of span. Values: `"server"`, `"client"`, `"producer"`, `"consumer"`, `"internal"` |
134+
| `start_timestamp` | number | Yes | Unix timestamp (with fractional microseconds) when the span was started |
135+
| `end_timestamp` | number | Yes | Unix timestamp (with fractional microseconds) when the span was ended |
136+
| `attributes` | object | No | Key-value pairs containing additional metadata about the span |
137+
| `links` | array | No | Array of links connecting this span to other spans or traces |
138+
139+
### Attribute Object Properties
140+
141+
Attributes are stored as key-value pairs where each value is an object with type information:
142+
143+
| Property | Type | Required | Description |
144+
|----------|------|----------|-------------|
145+
| `type` | string | Yes | The data type of the attribute value. Values: `"string"`, `"integer"`, `"float"`, `"boolean"` |
146+
| `value` | any | Yes | The actual attribute value, must match the specified type |
147+
| `unit` | string | No | The unit of the attribute value. Example values: `"ms"`, `"s"`, `"bytes"`, `"count"`, `"percent"` |
148+
149+
#### Common Attribute Keys
150+
151+
| Attribute Key | Type | Description |
152+
|---------------|------|-------------|
153+
| `sentry.release` | string | The release version of the application |
154+
| `sentry.environment` | string | The environment name (e.g., "production", "staging", "development") |
155+
| `sentry.platform` | string | The platform/language (e.g., "php", "javascript", "python") |
156+
| `sentry.sdk.name` | string | Name of the Sentry SDK (e.g., "sentry.php", "sentry.javascript") |
157+
| `sentry.sdk.version` | string | Version of the Sentry SDK |
158+
159+
See [Sentry Conventions](https://github.com/getsentry/sentry-conventions/) for a full list of supported attributes.
160+
161+
### Link Object Properties
162+
163+
Links connect spans to other spans or traces, enabling distributed tracing:
164+
165+
| Property | Type | Required | Description |
166+
|----------|------|----------|-------------|
167+
| `span_id` | string | Yes | 16-character hexadecimal string (a valid uuid4 without dashes) |
168+
| `trace_id` | string | Yes | 32-character hexadecimal string (a valid uuid4 without dashes) |
169+
| `sampled` | boolean | No | Whether the linked trace was sampled |
170+
| `attributes` | object | No | Additional metadata about the link relationship |
171+
172+
#### Link Attribute Keys
173+
174+
| Attribute Key | Type | Description |
175+
|---------------|------|-------------|
176+
| `sentry.link.type` | string | Type of link relationship (e.g., "previous_trace", "child_of", "follows_from") |
177+
178+
## Data Types and Formats
179+
180+
### Timestamp Format
181+
Timestamps use Unix time with fractional microseconds as a floating-point number:
182+
```
183+
1742921669.158209
184+
```
185+
186+
### ID Formats
187+
- **Trace ID**: 32-character (128 bits) lowercase hexadecimal string (a valid uuid4 without dashes)
188+
- **Span ID**: 16-character (64 bits) lowercase hexadecimal string (a valid uuid4 without dashes)
189+
190+
Example:
191+
```
192+
trace_id: "6cf173d587eb48568a9b2e12dcfbea52"
193+
span_id: "438f40bd3b4a41ee"
194+
```
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
title: Set Up Logs in Rust
3+
sidebar_title: Logs
4+
description: "Structured logs allow you to send, view, and query logs sent from your applications within Sentry."
5+
sidebar_order: 5600
6+
---
7+
8+
<Include name="feature-stage-beta-logs.mdx" />
9+
10+
With Sentry Structured Logs, you can send text based log information from your applications to Sentry. Once in Sentry, these logs can be viewed alongside relevant errors, searched by text-string, or searched using their individual attributes.
11+
12+
## Requirements
13+
14+
Logs in Rust are supported in Sentry Rust SDK version `0.39.0` and above.
15+
Additionally, the `logs` feature flag needs to be enabled.
16+
17+
```toml {filename:Cargo.toml}
18+
[dependencies]
19+
sentry = { version = "{{@inject packages.version('sentry.rust') }}", features = ["logs"] }
20+
```
21+
22+
## Setup
23+
24+
To enable logging, you need to initialize the SDK with the `enable_logs` option set to `true`.
25+
26+
```rust
27+
let _guard = sentry::init(("___PUBLIC_DSN___", sentry::ClientOptions {
28+
release: sentry::release_name!(),
29+
enable_logs: true,
30+
..Default::default()
31+
}));
32+
```
33+
34+
## Usage
35+
36+
Once the feature is enabled on the SDK and the SDK is initialized, you can send logs by using the logging macros.
37+
The `sentry` crate exposes macros that support six different log levels:
38+
`logger_trace`, `logger_debug`, `logger_info`, `logger_warn`, `logger_error` and `logger_fatal`.
39+
The macros support logging a simple message, or a message with parameters, with `format` syntax:
40+
41+
```rust
42+
use sentry::logger_info;
43+
44+
logger_info!("Hello, world!");
45+
logger_info!("Hello, {}!", "world");
46+
```
47+
48+
You can also attach additional attributes to a log using the `key = value` syntax before the message:
49+
50+
```rust
51+
use sentry::logger_error;
52+
53+
logger_error!(
54+
database.host = "prod-db-01",
55+
database.port = 5432,
56+
database.name = "user_service",
57+
retry_attempt = 2,
58+
beta_features = false,
59+
"Database connection failed"
60+
);
61+
```
62+
63+
The supported attribute keys consist of any number of valid Rust identifiers, separated by dots.
64+
Attributes containing dots will be nested under their common prefix when displayed in the UI.
65+
66+
The supported attribute values correspond to the values that can be converted to a `serde_json::Value`,
67+
which include primitive types for numbers, `bool`, and string types.
68+
As of today, array and object types will be converted to strings using their JSON representation.
69+
70+
## Integrations
71+
72+
We're actively working on adding integration support for Logs.
73+
Currently, we're looking at adding support for the `tracing` and `log` crates.
74+
You can follow progress on the following GitHub issues or open a [new one](https://github.com/getsentry/sentry-rust/issues/new/choose) for any additional integration you would like to see.
75+
- [`tracing`](https://github.com/getsentry/sentry-rust/issues/799)
76+
- [`log`](https://github.com/getsentry/sentry-rust/issues/818)
77+
78+
## Options
79+
80+
### `before_send_log`
81+
82+
To filter logs, or update them before they are sent to Sentry, you can use the `before_send_log` client option.
83+
84+
```rust
85+
let _guard = sentry::init(("___PUBLIC_DSN___", sentry::ClientOptions {
86+
release: sentry::release_name!(),
87+
enable_logs: true,
88+
before_send_log: Some(std::sync::Arc::new(|log| {
89+
// filter out all trace level logs
90+
if log.level == sentry::protocol::LogLevel::Trace {
91+
return None;
92+
}
93+
Some(log)
94+
})),
95+
..Default::default()
96+
}));
97+
```

docs/product/ai-in-sentry/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Seer is Sentry's AI debugging agent that helps resolve errors and performance is
1414

1515
- **[Issue Fix](/product/ai-in-sentry/seer/issue-fix/)**: Automated root cause analysis and suggested code fixes.
1616
- **Issue Scan**: Scans issues as they are ingested in Sentry to determine an actionability score and run Seer's Issue Fix on them automatically.
17-
- **[Privacy & Security](/product/ai-in-sentry/seer/seer-privacy-security/)**: Understanding how Seer handles your data securely.
17+
- **[Privacy & Security](/product/ai-in-sentry/seer/seer-privacy-and-security/)**: Understanding how Seer handles your data securely.
1818

1919
## Issue Summary
2020

docs/product/sentry/explore/logs/getting-started/index.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ To set up Sentry Logs, use the links below for supported SDKs. After it's been s
227227

228228
- <LinkWithPlatformIcon platform="go" label="Go" url="/platforms/go/logs/" />
229229

230+
### Rust
231+
232+
- <LinkWithPlatformIcon platform="rust" label="Rust" url="/platforms/rust/logs/" />
233+
230234
## Upcoming SDKs
231235

232236
We're actively working on adding Log functionality to additional SDKs. Check out these GitHub issues for the latest updates:
@@ -266,5 +270,10 @@ We're actively working on adding Log functionality to additional SDKs. Check out
266270
label="Unity"
267271
url="https://github.com/getsentry/sentry-unity/issues/2172"
268272
/>
273+
- <LinkWithPlatformIcon
274+
platform="native"
275+
label="Native"
276+
url="https://github.com/getsentry/sentry-native/issues/1210"
277+
/>
269278

270279
If you don't see your platform listed above, please reach out to us on [GitHub](https://github.com/getsentry/sentry/discussions/86804) or [Discord](https://discord.gg/sentry), we'll get it prioritized!

docs/product/sentry/sentry-toolbar/faq.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,18 @@ useSentryToolbar({
5050
},
5151
})
5252
```
53+
</Expandable>
54+
55+
<Expandable permalink title="Why is the Toolbar stuck saying 'Connecting to ...'?">
56+
57+
If you're seeing the message "Connecting to ...' in the Toolbar, it means that the Toolbar is unable to connect to the Sentry server. This can happen for a few reasons:
58+
59+
1. Check your browser console for a message like `Refused to frame 'https://my-org.sentry.io/toolbar/sentry/javascript/iframe/' because it violates the following Content Security Policy directive: "frame-src 'self'".` This means your site is not allowing the toolbar's iframe to load. To fix this you can add your sentry domain into the [`frame-src`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-src) directive in your CSP. The result would be a response header that says `Content-Security-Policy: frame-src my-org.sentry.io;`
5360

61+
2. The Sentry server is down or unreachable. If this is the case check the following:
62+
- Check the [Sentry status page](https://status.sentry.io/) to see if there are any issues.
63+
- If the Sentry server is down, you can try again later.
64+
- If the Sentry server is unreachable, you can try again later.
5465
</Expandable>
5566

5667
<Expandable permalink title="Are there plans to include the Toolbar in the JavaScript SDK?">

docs/product/sentry/sentry-toolbar/setup.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ You will need to edit the [Project Settings](https://sentry.io/orgredirect/organ
2121

2222
![Sentry's Toolbar Settings Page](./img/sentry-project-settings-toolbar.png)
2323

24+
You may also need to add your Sentry domain to the [`frame-src`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-src) directive in your CSP response headers. See the [FAQ: _"Why is the Toolbar stuck saying 'Connecting to ...'?"_](/product/sentry-toolbar/faq/#why-is-the-toolbar-stuck-saying-connecting-to-) for more information.
25+
2426
## 2. Install
2527

2628
If you are developing a React based application, it's time to add the Toolbar into your `package.json` file.

0 commit comments

Comments
 (0)