Skip to content

Commit 93fd56c

Browse files
committed
Add doc
1 parent 1f1e758 commit 93fd56c

File tree

1 file changed

+101
-0
lines changed

1 file changed

+101
-0
lines changed

docs/performance-monitoring.md

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Performance Monitoring
2+
3+
## Data types
4+
5+
### Transaction
6+
| Field | Type | Description |
7+
|-------|------|-------------|
8+
| id | string | Unique identifier of the transaction |
9+
| type | string | Type of transaction sampling ('default' or 'critical'). See [Sampling](#sampling) for details |
10+
| name | string | Name of the transaction |
11+
| startTime | number | Timestamp when transaction started |
12+
| endTime | number | Timestamp when transaction ended |
13+
| duration | number | Total duration of transaction in milliseconds |
14+
| finishStatus | string | Status when transaction finished. 'success' (default) or 'failure'. See [Transaction Completion](#2-transaction-completion) |
15+
| spans | Span[] | Array of [spans](#span) associated with this transaction |
16+
| tags | object | Additional context data attached to transaction |
17+
18+
### AggregatedTransaction
19+
| Field | Type | Description |
20+
|-------|------|-------------|
21+
| id | string | Unique identifier of the transaction |
22+
| name | string | Name of the transaction |
23+
| avgStartTime | number | Average timestamp when transaction started |
24+
| minStartTime | number | Minimum timestamp when transaction started |
25+
| maxEndTime | number | Maximum timestamp when transaction ended |
26+
| p50duration | number | 50th percentile (median) duration of transaction in milliseconds |
27+
| p95duration | number | 95th percentile duration of transaction in milliseconds |
28+
| maxDuration | number | Maximum duration of transaction in milliseconds |
29+
30+
### Span
31+
| Field | Type | Description |
32+
|-------|------|-------------|
33+
| id | string | Unique identifier of the span |
34+
| name | string | Name of the span |
35+
| startTime | number | Timestamp when span started |
36+
| endTime | number | Timestamp when span ended |
37+
| duration | number | Total duration of span in milliseconds |
38+
39+
### AggregatedSpan
40+
See [Transaction Aggregation](#transaction-aggregation) for details on how spans are aggregated.
41+
42+
| Field | Type | Description |
43+
|-------|------|-------------|
44+
| id | string | Unique identifier of the span |
45+
| name | string | Name of the span |
46+
| avgStartTime | number | Average timestamp when span started |
47+
| minStartTime | number | Minimum timestamp when span started |
48+
| maxEndTime | number | Maximum timestamp when span ended |
49+
| p50duration | number | 50th percentile (median) duration of span in milliseconds |
50+
| p95duration | number | 95th percentile duration of span in milliseconds |
51+
| maxDuration | number | Maximum duration of span in milliseconds |
52+
53+
54+
## Transaction Lifecycle
55+
56+
### 1. Transaction Creation
57+
When creating a transaction, you can specify its type:
58+
- 'critical' - important transactions that are always sent to the server
59+
- 'default' - regular transactions that go through the [sampling process](#sampling)
60+
61+
### 2. Transaction Completion
62+
When completing a transaction:
63+
1. A finish status is specified (finishStatus):
64+
- 'success' (default) - successful completion
65+
- 'failure' - completion with error (such transactions are always sent to the server)
66+
67+
2. The transaction duration is checked:
68+
- If thresholdMs parameter is specified and the transaction duration is less than this value, the transaction is discarded
69+
- Otherwise, the transaction goes through the [sampling process](#sampling)
70+
71+
3. After successful sampling, the transaction is added to the list for sending
72+
73+
### 3. Sending Transactions
74+
- When the first transaction is added to the list, a timer starts
75+
- When the timer expires:
76+
1. All collected transactions are [aggregated](#transaction-aggregation)
77+
2. Aggregated data is sent to the server
78+
3. The transaction list is cleared
79+
80+
## Sampling
81+
- The probability of sending transactions is configured through the `performance.sampleRate` parameter (value from 0 to 1)
82+
- Only transactions of type 'default' with finish status 'success' are subject to sampling
83+
- Sampling process:
84+
1. A random number between 0 and 1 is generated for each transaction
85+
2. If the number is less than or equal to sampleRate, the transaction is sent
86+
87+
## Transaction Aggregation
88+
1. [Transactions](#transaction) are grouped by name (name field)
89+
2. For each group, statistical indicators are calculated:
90+
- minStartTime - earliest start time
91+
- maxEndTime - latest end time
92+
- p50duration - median duration (50th percentile)
93+
- p95duration - 95th percentile duration
94+
- maxDuration - maximum duration
95+
96+
3. Based on this data, [AggregatedTransaction](#aggregatedtransaction) objects are created
97+
98+
4. For each aggregated transaction:
99+
- [Spans](#span) are grouped by name
100+
- The same statistical indicators are calculated for each span group
101+
- [AggregatedSpan](#aggregatedspan) objects are created

0 commit comments

Comments
 (0)