Skip to content

Commit c0afb0c

Browse files
authored
Cleaning up mermaid code and made it a bit more readable in dark mode (#11726)
* Cleaning up mermaid code and made it a bit more readable in dark mode * The half working solution * Added documentation on how to use Mermaid in MDX.
1 parent babc777 commit c0afb0c

File tree

13 files changed

+214
-171
lines changed

13 files changed

+214
-171
lines changed

develop-docs/application/architecture.mdx

Lines changed: 58 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,28 @@ Edges represent service dependencies.
99

1010
```mermaid
1111
graph TD
12-
app[Your Application] --> |SDK| lb{{Load Balancer}}
13-
lb --> |"sentry.example.com/api/\d+/store/"| relay
14-
lb --> |"sentry.example.com"| sentry_web["Sentry (web)"]
15-
symbolicator --> sentry_web
16-
relay --> kafka
17-
relay --> redis
18-
sentry_web --> snuba
19-
sentry_web --> memcached
20-
sentry_web --> postgres
21-
sentry_web --> redis
22-
snuba --> kafka
23-
snuba --> redis
24-
snuba --> clickhouse
25-
kafka --> zookeeper
26-
sentry_web --> sentry_worker["Sentry (worker)"]
27-
sentry_worker --> memcached
28-
sentry_worker --> redis
29-
sentry_worker --> postgres
30-
sentry_worker --> symbolicator
31-
32-
click snuba "https://github.com/getsentry/snuba" "Snuba Documentation"
33-
click relay "https://github.com/getsentry/relay" "Relay Documentation"
12+
app[Your Application] --> |SDK| lb{{Load Balancer}}
13+
lb --> |"sentry.example.com/api/\d+/store/"| relay
14+
lb --> |"sentry.example.com"| sentry_web["Sentry (web)"]
15+
symbolicator --> sentry_web
16+
relay --> kafka
17+
relay --> redis
18+
sentry_web --> snuba
19+
sentry_web --> memcached
20+
sentry_web --> postgres
21+
sentry_web --> redis
22+
snuba --> kafka
23+
snuba --> redis
24+
snuba --> clickhouse
25+
kafka --> zookeeper
26+
sentry_web --> sentry_worker["Sentry (worker)"]
27+
sentry_worker --> memcached
28+
sentry_worker --> redis
29+
sentry_worker --> postgres
30+
sentry_worker --> symbolicator
31+
32+
click snuba "https://github.com/getsentry/snuba" "Snuba Documentation"
33+
click relay "https://github.com/getsentry/relay" "Relay Documentation"
3434
```
3535
## Event pipeline
3636

@@ -49,26 +49,25 @@ For more information read [Path of an event through Relay](https://getsentry.git
4949

5050
```mermaid
5151
graph TD
52-
53-
app[Your application] --> |sends crashes| lb{{nginx}}
54-
lb --> |/api/n/store/| relay
55-
relay --> kafka[(Ingest Kafka)]
56-
kafka --> ingest-consumer["Sentry ingest consumer"]
57-
ingest-consumer --> preprocess-event
58-
59-
subgraph celery["Sentry celery tasks"]
60-
preprocess-event --> save-event
61-
preprocess-event --> process-event
62-
preprocess-event --> symbolicate-event
63-
symbolicate-event --> process-event
64-
process-event --> save-event
65-
save-event --> snuba-kafka[("Snuba Kafka<br>(eventstream)")]
66-
end
67-
68-
subgraph snuba["Snuba"]
69-
snuba-kafka --> snuba-consumer["Snuba consumers"]
70-
snuba-consumer --> clickhouse[("Clickhouse")]
71-
end
52+
app[Your application] --> |sends crashes| lb{{nginx}}
53+
lb --> |/api/n/store/| relay
54+
relay --> kafka[(Ingest Kafka)]
55+
kafka --> ingest-consumer["Sentry ingest consumer"]
56+
ingest-consumer --> preprocess-event
57+
58+
subgraph celery["Sentry celery tasks"]
59+
preprocess-event --> save-event
60+
preprocess-event --> process-event
61+
preprocess-event --> symbolicate-event
62+
symbolicate-event --> process-event
63+
process-event --> save-event
64+
save-event --> snuba-kafka[("Snuba Kafka<br>(eventstream)")]
65+
end
66+
67+
subgraph snuba["Snuba"]
68+
snuba-kafka --> snuba-consumer["Snuba consumers"]
69+
snuba-consumer --> clickhouse[("Clickhouse")]
70+
end
7271
```
7372

7473
## Multi-Region
@@ -116,23 +115,23 @@ In addition to the siloed modes, there also exists a **Monolith** mode. In monol
116115

117116
```mermaid
118117
flowchart TD
119-
120-
ui[Frontend UI] --> usr
121-
ui --> cs
122-
ui --> eur
123-
124-
125-
subgraph usr [US Region]
126-
usapi[US Sentry API] --> uspg[(US Postgres)]
127-
usapi --> used[(EU Event Data)]
128-
end
129-
subgraph cs [Control Silo]
130-
capi[Control Silo Sentry API] --> cpg[(Control Postgres)]
131-
end
132-
subgraph eur [EU Region]
133-
euapi[EU Sentry API] --> eupg[(EU Postgres)]
134-
euapi --> eued[(EU Event Data)]
135-
end
118+
ui[Frontend UI] --> usr
119+
ui --> cs
120+
ui --> eur
121+
122+
subgraph usr [US Region]
123+
usapi[US Sentry API] --> uspg[(US Postgres)]
124+
usapi --> used[(EU Event Data)]
125+
end
126+
127+
subgraph cs [Control Silo]
128+
capi[Control Silo Sentry API] --> cpg[(Control Postgres)]
129+
end
130+
131+
subgraph eur [EU Region]
132+
euapi[EU Sentry API] --> eupg[(EU Postgres)]
133+
euapi --> eued[(EU Event Data)]
134+
end
136135
```
137136

138137
Each region silo can be scaled independently, and is isolated from other regions. Within each region exists separate, dedicated infrastructure and applications as outlined in the [application overview](/architecture/#high-level-overview).

develop-docs/application/control-silo.mdx

Lines changed: 36 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,22 @@ Integrations can be shared by multiple organizations. For example, a single MS t
4444

4545
```mermaid
4646
sequenceDiagram
47-
48-
actor RegionSilo
49-
actor ControlSilo
50-
actor MsTeams
51-
52-
RegionSilo ->> RegionSilo: send issue alert
53-
RegionSilo ->> ControlSilo : send issue alert to msteams
54-
ControlSilo ->> ControlSilo : load integration metadata
55-
ControlSilo ->> ControlSilo : add integration credentials to request
56-
ControlSilo ->> MsTeams : send notification request with credentials
57-
MsTeams -->> ControlSilo : token expired!
58-
ControlSilo ->> MsTeams : refresh token
59-
MsTeams -->> ControlSilo : response
60-
ControlSilo ->> ControlSilo : update stored token
61-
ControlSilo ->> MsTeams : send notification with new token
62-
MsTeams -->> ControlSilo : response
63-
ControlSilo -->> RegionSilo : response
47+
actor RegionSilo
48+
actor ControlSilo
49+
actor MsTeams
50+
51+
RegionSilo ->> RegionSilo: send issue alert
52+
RegionSilo ->> ControlSilo : send issue alert to msteams
53+
ControlSilo ->> ControlSilo : load integration metadata
54+
ControlSilo ->> ControlSilo : add integration credentials to request
55+
ControlSilo ->> MsTeams : send notification request with credentials
56+
MsTeams -->> ControlSilo : token expired!
57+
ControlSilo ->> MsTeams : refresh token
58+
MsTeams -->> ControlSilo : response
59+
ControlSilo ->> ControlSilo : update stored token
60+
ControlSilo ->> MsTeams : send notification with new token
61+
MsTeams -->> ControlSilo : response
62+
ControlSilo -->> RegionSilo : response
6463
```
6564

6665
The integration proxy is implemented as a class that integrations requiring refresh tokens can sub-class. Currently the following integrations use the integration credential proxy:
@@ -141,13 +140,12 @@ For each mailbox with undelivered messages, we select a block of messages, and u
141140

142141
```mermaid
143142
sequenceDiagram
143+
participant Control Silo
144144
145-
participant Control Silo
146-
147-
Control Silo ->> Control Silo : find mailboxes with messages
148-
Control Silo ->> Control Silo : filter out mailboxes with future delivery
149-
Control Silo ->> Control Silo : update next delivery time for the next block
150-
Control Silo ->> Control Silo : Spawn task to drain a mailbox
145+
Control Silo ->> Control Silo : find mailboxes with messages
146+
Control Silo ->> Control Silo : filter out mailboxes with future delivery
147+
Control Silo ->> Control Silo : update next delivery time for the next block
148+
Control Silo ->> Control Silo : Spawn task to drain a mailbox
151149
```
152150

153151
### Webhook Delivery
@@ -158,21 +156,21 @@ Draining a mailbox involves sending as many messages from a given mailbox as we
158156

159157
```mermaid
160158
sequenceDiagram
161-
participant Control Silo
162-
participant Region Silo
163-
164-
Control Silo ->> Control Silo : Fetch head block of mailbox
165-
loop foreach message
166-
Control Silo ->> Control Silo : if hook is above max attempts delete.
167-
Control Silo ->> Region Silo : Deliver hook
168-
alt success
169-
Region Silo -->> Control Silo : 200-40x
170-
Control Silo ->> Control Silo : delete hook
171-
else error
172-
Region Silo -->> Control Silo : 50x
173-
Control Silo ->> Control Silo : increment attempt and reschedule
174-
end
175-
end
159+
participant Control Silo
160+
participant Region Silo
161+
162+
Control Silo ->> Control Silo : Fetch head block of mailbox
163+
loop foreach message
164+
Control Silo ->> Control Silo : if hook is above max attempts delete.
165+
Control Silo ->> Region Silo : Deliver hook
166+
alt success
167+
Region Silo -->> Control Silo : 200-40x
168+
Control Silo ->> Control Silo : delete hook
169+
else error
170+
Region Silo -->> Control Silo : 50x
171+
Control Silo ->> Control Silo : increment attempt and reschedule
172+
end
173+
end
176174
```
177175

178176
Notably, most 40x errors are considered 'successful' deliveries. The reason for this is that re-attempting a delivery of a webhook that initially had a 40x response will generally not result in a 200.

develop-docs/application/cross-region-replication.mdx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,21 @@ User, Organization, and Membership deletions are the most common form of cross r
4141

4242
The flow for removing a user is
4343

44-
![tombstone workflow diagram](https://mermaid.ink/svg/pako:eNplkTFrwzAQhf-K0BYcD203Q7O0ayHEdNMiSxdHIN2l0qk0hPz3ntMUYme703vf49A7a0cedKcLfFVAB-_Bjtkmg7YyYU0DZIOyOaasPsu0HW3m4MLRIqs3Qs4UVR8izZUdjIHwJhicUNVuNs0MUZ3yEIFB1UkP_vXp-cXgzCLQktlBou8b06hiZabKA_2oBKXYEZYRktFerxd4OD3Kq-b-XjFt6xBDOTzE3ruuoXOsn05hSkORz1va29XCvQNH6EKcIXqtE-Rkg5dWzgaVMpoPkMDoTkYPe1sjG23wItappf6ETnecK6x1PXrL_yXqbm9jkVfwQer7-Gv6WvjlF-fzsOs)
45-
[diagram source](https://mermaid.live/edit#pako:eNplkTFrwzAQhf-K0BYcD203Q7O0ayHEdNMiSxdHIN2l0qk0hPz3ntMUYme703vf49A7a0cedKcLfFVAB-_Bjtkmg7YyYU0DZIOyOaasPsu0HW3m4MLRIqs3Qs4UVR8izZUdjIHwJhicUNVuNs0MUZ3yEIFB1UkP_vXp-cXgzCLQktlBou8b06hiZabKA_2oBKXYEZYRktFerxd4OD3Kq-b-XjFt6xBDOTzE3ruuoXOsn05hSkORz1va29XCvQNH6EKcIXqtE-Rkg5dWzgaVMpoPkMDoTkYPe1sjG23wItappf6ETnecK6x1PXrL_yXqbm9jkVfwQer7-Gv6WvjlF-fzsOs)
44+
```mermaid
45+
sequenceDiagram
46+
autonumber
47+
48+
actor User
49+
participant Control Silo
50+
participant Region Silo
51+
52+
User ->>+ Control Silo : delete user id=123
53+
Control Silo ->> Control Silo : Remove user + save outbox message
54+
Control Silo -->>- User : bye
55+
Control Silo --)+ Region Silo : Publish outbox message
56+
Region Silo ->>- Region Silo : Save tombstone
57+
Region Silo --) Region Silo : Reconcile tombstone
58+
```
4659

4760
In step 5 and 6 of the above diagram we reconcile the tombstone changes with the rest of the data in the region. Tombstones needs to be reconciled for each relation that the removed record had. For example, removing a user will:
4861

develop-docs/application/dynamic-sampling/outcomes.mdx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@ For a sampled transaction:
1515

1616
```mermaid
1717
flowchart LR
18-
SDK --transaction--> Relay
19-
Relay --transaction--> DS[Dynamic Sampling]
20-
Relay --transaction_indexed--> DS
21-
DS --transaction-->Store
22-
DS --transaction_indexed-->Store
18+
SDK --transaction--> Relay
19+
Relay --transaction--> DS[Dynamic Sampling]
20+
Relay --transaction_indexed--> DS
21+
DS --transaction-->Store
22+
DS --transaction_indexed-->Store
2323
```
2424

2525
For a transaction filtered by dynamic sampling:
2626

2727
```mermaid
2828
flowchart LR
29-
SDK --transaction--> Relay
30-
Relay --transaction--> DS[Dynamic Sampling]
31-
Relay --transaction_indexed--> DS
32-
DS --transaction-->Store
33-
DS --transaction_indexed-->Reject
34-
style Reject stroke:#f00
29+
SDK --transaction--> Relay
30+
Relay --transaction--> DS[Dynamic Sampling]
31+
Relay --transaction_indexed--> DS
32+
DS --transaction-->Store
33+
DS --transaction_indexed-->Reject
34+
style Reject stroke:#f00
3535
```
3636

3737
## Data Types

0 commit comments

Comments
 (0)