Skip to content

Commit 5e348ce

Browse files
committed
port the rest of mermaid diagrams to docs
1 parent 24df838 commit 5e348ce

File tree

3 files changed

+133
-17
lines changed

3 files changed

+133
-17
lines changed

develop-docs/application/control-silo.mdx

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,26 @@ When a request is handled by the API Gateway, the response delivered to the clie
4242

4343
Integrations can be shared by multiple organizations. For example, a single MS teams workspace can be connected to multiple organizations, and those organizations can live in multiple regions. A few of our integrations leverage refresh tokens and use short lived access tokens. To avoid racy updates when tokens become invalidated and need to be refreshed, we send outbound requests to control silo, which acts as a proxy for the integration service. By funnelling all outbound traffic for integrations that require refresh tokens through control silo we can more easily co-ordinate token replacements.
4444

45-
![credential-proxy-flowchart](https://mermaid.ink/svg/pako:eNqdk01uwjAQha8y9RoukAWbdsumdOnNKH4Bq_GY2hNBhbh7DUnURJFA7c4ave_Nry-mjg6mMhlfHaTGm-d94mDFCtcaE71j76PsfBvHyGsUTbGdhrb5AxzyjfrV03qzmeAVZYgjn3MH4hZJF-KJMy3lpJFC1j7RVLpE28gFFUXpRUsGClB2rPwMZDfn6gQHUc9tvqVPtyllXboMAxirlqi-8XXvMUB08nqYGloZqfWyEI2fEML56Avw8ihhQpOQDz3x0LPIjlEyng2hO5ZRgXLZLNzo-5eO750KTv-vaX46M51ZmYAU2LtythcrRNboAQHWVOXp0HDXqjVWrkXKncbdt9Sm0tRhZfrehis3VVP2UKJwvjS77b_C_UdcfwDQFR3U)
46-
[diagram source](https://mermaid.live/edit#pako:eNqdk01uwjAQha8y9RoukAWbdsumdOnNKH4Bq_GY2hNBhbh7DUnURJFA7c4ave_Nry-mjg6mMhlfHaTGm-d94mDFCtcaE71j76PsfBvHyGsUTbGdhrb5AxzyjfrV03qzmeAVZYgjn3MH4hZJF-KJMy3lpJFC1j7RVLpE28gFFUXpRUsGClB2rPwMZDfn6gQHUc9tvqVPtyllXboMAxirlqi-8XXvMUB08nqYGloZqfWyEI2fEML56Avw8ihhQpOQDz3x0LPIjlEyng2hO5ZRgXLZLNzo-5eO750KTv-vaX46M51ZmYAU2LtythcrRNboAQHWVOXp0HDXqjVWrkXKncbdt9Sm0tRhZfrehis3VVP2UKJwvjS77b_C_UdcfwDQFR3U)
45+
```mermaid
46+
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
64+
```
4765

4866
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:
4967

@@ -121,17 +139,40 @@ where id in (...) and schedule_for < current_timestamp
121139

122140
For each mailbox with undelivered messages, we select a block of messages, and update their next schedule time to be a few minutes in the future. Doing this helps reduce the next scheduling task from attempting to deliver the same messages again.
123141

124-
![mailbox-delivery-flowchart](https://mermaid.ink/svg/pako:eNqNUTtyAzEIvQpD7VxgCzdJm2pbNXjF2owl2EjIn_H47lFiJ5OkcTrgfWB4F5wsMg5Y-a2xTvwitC2UgwZdqLhMspA6PJt6sQSjJPvAfvbwtF7_IsAAs2iETJI2duIKR_EdZK6Vtlz_o07OBaz5X4-5eSsMkZMcuJwfW7UlkjMon_xbBS6ZYbYCvrtDm2TT_rHbuNBRwanuwQ1iIVGgrxuD4gozl97G_tFLUICAfUXmgEMvI8_UkgcMeu1Uam7jWSccvDRe4e3UewA4zJRqn3IUt_J6S-kzrOs7BGObcw)
125-
[diagram source](https://mermaid.live/edit#pako:eNqNUTtyAzEIvQpD7VxgCzdJm2pbNXjF2owl2EjIn_H47lFiJ5OkcTrgfWB4F5wsMg5Y-a2xTvwitC2UgwZdqLhMspA6PJt6sQSjJPvAfvbwtF7_IsAAs2iETJI2duIKR_EdZK6Vtlz_o07OBaz5X4-5eSsMkZMcuJwfW7UlkjMon_xbBS6ZYbYCvrtDm2TT_rHbuNBRwanuwQ1iIVGgrxuD4gozl97G_tFLUICAfUXmgEMvI8_UkgcMeu1Uam7jWSccvDRe4e3UewA4zJRqn3IUt_J6S-kzrOs7BGObcw)
142+
```mermaid
143+
sequenceDiagram
144+
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
151+
```
126152

127153
### Webhook Delivery
128154

129155
Scheduled webhooks are delivered by celery tasks. Delivery tasks attempt to forward requests to the relevant region silo. If delivery succeeds, the payload record is deleted from postgres. If the request fails and `attempts` is lower than the max attempts (10) the message is left alone, if the `attempts` is equal or higher than the max attempts, an log message is emitted and the webhook is discarded.
130156

131157
Draining a mailbox involves sending as many messages from a given mailbox as we can. Should we hit a networking error, the current head of line will be rescheduled and have its attempt number increased.
132158

133-
![delivery flow chart](https://mermaid.ink/svg/pako:eNqNUrFuAjEM_RUrM1SoapcbWIq6dYE1i0l8XETOviYOokL8e8NBK5CQYIkS-eW9Z_sdjBNPpjGZvguxo0XATcLe8oBJgwsDssKHsCaJsApRbitL2gThS8HyNRCm8_nNT2jgk9R10BF6WEdxW5AWegxxLXvLUWSAVhJhxfSUM27IMsAj0tBCJ7KFkAHXsqPKuAdUpX7QDJ4iKb3cJbpyX3kWFMOO0khWm1GMCrk4V52cnnADn94x8jqbTd9m-zP4keuzr38xipmAUpL0nNb7SQfgiemwS9RT3dVlJIDsIVF2HfkSaRRnb3k8LJuJ6SnVpfiaisNJwxrtKoM1Tb16arFEtcbysUKxqKx-2JlGU6GJKYNH_QuRaVqsbU0M-aCSvs5JGwN3_AUkRNw7)
134-
135-
[diagram source](https://mermaid.live/edit#pako:eNqNUrFuAjEM_RUrM1SoapcbWIq6dYE1i0l8XETOviYOokL8e8NBK5CQYIkS-eW9Z_sdjBNPpjGZvguxo0XATcLe8oBJgwsDssKHsCaJsApRbitL2gThS8HyNRCm8_nNT2jgk9R10BF6WEdxW5AWegxxLXvLUWSAVhJhxfSUM27IMsAj0tBCJ7KFkAHXsqPKuAdUpX7QDJ4iKb3cJbpyX3kWFMOO0khWm1GMCrk4V52cnnADn94x8jqbTd9m-zP4keuzr38xipmAUpL0nNb7SQfgiemwS9RT3dVlJIDsIVF2HfkSaRRnb3k8LJuJ6SnVpfiaisNJwxrtKoM1Tb16arFEtcbysUKxqKx-2JlGU6GJKYNH_QuRaVqsbU0M-aCSvs5JGwN3_AUkRNw7)
159+
```mermaid
160+
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
176+
```
136177

137178
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/dynamic-sampling/outcomes.mdx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,26 @@ These charts illustrate the flow of data categories for transactions:
1313

1414
For a sampled transaction:
1515

16-
![](https://mermaid.ink/img/pako:eNp1UT1vgzAQ_SvWzYAgJoA9ZGJru4StdVWdwCGWwI4c04Yi_nsNDI2U1l589z58TzdBbRoJHE6d-arPaB15PgpN_KnKJxKGzqK-Yu2U0WF4IEfZ4bjh6_ORUVZv5aixVzWpsL90Srfv_wo-lG7kTTabcKOV1YNp5YyVf6N3DncsoZcLAfTS9qgaH3BaEPGbUwAnk2_Ug_2USyHAzyrRCiCz0LMX4-BMNeoauLODDGC4NOhkqbC12AM_YXf13Qtq4BPcgCcJi2gRs13BaLYvkl0RwAg8zVjEWBonOaVZwWI6B_BtjHeIo32esyyOk5SmdJcleQCyUT7Hy7aVdTkBWDO05_sPX1f5MtX8Azhkjhw)
16+
```mermaid
17+
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
23+
```
1724

1825
For a transaction filtered by dynamic sampling:
1926

20-
![](https://mermaid.ink/img/pako:eNp1UcFSgzAQ_ZXMeoVOaCiQHDxxUy_lpnGcDGzbKCSdNGiR4d8N5WBnqskl-_a9t9ndEWrbIAjYtfarPijnyeNWGhJOVT6QOPZOmZOqvbYmju_JFls1LPnL85ZRVi_lYFSna1Kp7thqs3_9V_CmTYNnbBbhQiurG9PKW4d_Z68ctviOtV9oJz-0SBYkBM5-oLjbUSrNfCGCDl2ndBM6H2eF_B2ABEHGANS9-8Q5kBCaQOUkkEmaKYhV7201mBqEdz1G0B8b5bHUau9UB2Kn2lNAj8qAGOEMIkn4ihWUrwvOsk2RrIsIBhBpxlecpzTJGcsKTtkUwbe1wYGuNnnOM0qTlKVsnSV5BNjoMIanZV2XrUXgbL8_XBd8vsjnX00_t7aW9Q)
27+
```mermaid
28+
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
35+
```
2136

2237
## Data Types
2338

develop-docs/application/feedback-architecture.mdx

Lines changed: 68 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,15 @@ event[”contexts”][”feedback”] = {
7474

7575
### Ingest diagram
7676

77-
![](https://mermaid.ink/svg/pako:eNptkc1qwzAQhF9F7MmGmN59KJSmx_ZQ91IsYxR5YwvbkqqfgEny7l05NW0hOg3a0erb2TNI0yGU0DthB_ax55rREdbWnyY69mTtpKQIyuiGFcUju3BAfcLJWORwYe84iYVrHlaxOo6tNNrHGV1WK92jD8URsTsIORZ4Qh18k6cXv76t8VfEiJ4JzyRO6BYWhB_TL9KhCNhubVrlfcTU425hbWf-UHD44TBSRudQS_QcbhTmP4WmNHwwDuvsbZN5c8dIuC9pmCoQwpwgvY4HUWccqiQenim3cTDRU055Azugl7NQHWV9TiFzCAPOVCxJTqofAgeur2QUMZhq0RLK4CLuINqOhtwrQTuat0vsFLG93pa37vD6DRJvo7g)
78-
[diagram source](https://mermaid.live/edit#pako:eNptkc1qwzAQhF9F7MmGmN59KJSmx_ZQ91IsYxR5YwvbkqqfgEny7l05NW0hOg3a0erb2TNI0yGU0DthB_ax55rREdbWnyY69mTtpKQIyuiGFcUju3BAfcLJWORwYe84iYVrHlaxOo6tNNrHGV1WK92jD8URsTsIORZ4Qh18k6cXv76t8VfEiJ4JzyRO6BYWhB_TL9KhCNhubVrlfcTU425hbWf-UHD44TBSRudQS_QcbhTmP4WmNHwwDuvsbZN5c8dIuC9pmCoQwpwgvY4HUWccqiQenim3cTDRU055Azugl7NQHWV9TiFzCAPOVCxJTqofAgeur2QUMZhq0RLK4CLuINqOhtwrQTuat0vsFLG93pa37vD6DRJvo7g)
77+
```mermaid
78+
graph TD
79+
app[Your Application] --> |"envelope"| Relay
80+
Relay --> f_consumer([ingest-feedback-events])
81+
f_consumer --> |"queues as celery task"| create_feedback_issue
82+
create_feedback_issue --> o_consumer(["ingest-occurrences"])
83+
o_consumer --> nodestore[(Nodestore)]
84+
o_consumer --> |"EventStream"| snuba[("Snuba/Clickhouse")]
85+
```
7986

8087
In Relay v24.5.1, we migrated feedback to its own kafka topic + consumer,
8188
`ingest-feedback-events`. This decouples risk and ownership from errors
@@ -114,8 +121,39 @@ user_report = {
114121

115122
### Ingest diagram
116123

117-
![](https://mermaid.ink/svg/pako:eNp9VNtq3DAQ_ZVBEHAgy77vQ6EkDfShF7KhUKzFaOXZtYgtqbpsCUn-vaOxvWmT3frF4-HozJkzIz8J7VoUK7EPyndwfyOtTDFvx8812hQeS0qmgN6F1KBtvTM21VIsc8Sw2CG2W6UfpNiMQB1U7JoJPrhW9YS9Lkm44yT8MPh7ghMdvf6uuctWJ-NsrG_nCBYQsgVjIeAOQ8AwlYrqgE1RMVYrSaAndmZokmuO0iZdqBIek42JMeNJHlgsPsCzFJ9vAQ9kAfjgNMaIrRTPZ9jfZpnjbMlj2xcXgPaAvfMI3njsjWWA8r7-6XKAj973Rqviw2bWNZ8oau6wVzwhDhihSIc3uqqN3WNMC5WS0t1AjcTNJZOPAAa_t3BWNc4ZlG2BRwojIk7yZjHfv63vi5A3-3GG_NTJ9wvzX2VsYgTfq7RzYSjZkz4ziWs0LVAeMFS0hZMhTutMrJZmSmvIlrzi-JilSxGTC1hXX-fwcnMCSG18KiuypvuhBl4Pm7eqrtbltbym2T10jrrg02MDpafJLm4yLrNvST87e2oVvYtpHzDWFZk2xVKMerjcLOVXxmDIG95aFs2K_qUUV4LUD8q0dO2fpAWQInU4EHZFYW_2XZJC2hcCqpzc-tFqsUoh45UYhd4YRXd1EKud6iNlsTVU68v4I-H_ycsfwTWaqg)
118-
[diagram source](https://mermaid.live/edit#pako:eNp9VNtq3DAQ_ZVBEHAgy77vQ6EkDfShF7KhUKzFaOXZtYgtqbpsCUn-vaOxvWmT3frF4-HozJkzIz8J7VoUK7EPyndwfyOtTDFvx8812hQeS0qmgN6F1KBtvTM21VIsc8Sw2CG2W6UfpNiMQB1U7JoJPrhW9YS9Lkm44yT8MPh7ghMdvf6uuctWJ-NsrG_nCBYQsgVjIeAOQ8AwlYrqgE1RMVYrSaAndmZokmuO0iZdqBIek42JMeNJHlgsPsCzFJ9vAQ9kAfjgNMaIrRTPZ9jfZpnjbMlj2xcXgPaAvfMI3njsjWWA8r7-6XKAj973Rqviw2bWNZ8oau6wVzwhDhihSIc3uqqN3WNMC5WS0t1AjcTNJZOPAAa_t3BWNc4ZlG2BRwojIk7yZjHfv63vi5A3-3GG_NTJ9wvzX2VsYgTfq7RzYSjZkz4ziWs0LVAeMFS0hZMhTutMrJZmSmvIlrzi-JilSxGTC1hXX-fwcnMCSG18KiuypvuhBl4Pm7eqrtbltbym2T10jrrg02MDpafJLm4yLrNvST87e2oVvYtpHzDWFZk2xVKMerjcLOVXxmDIG95aFs2K_qUUV4LUD8q0dO2fpAWQInU4EHZFYW_2XZJC2hcCqpzc-tFqsUoh45UYhd4YRXd1EKud6iNlsTVU68v4I-H_ycsfwTWaqg)
124+
```mermaid
125+
graph TD
126+
subgraph Sentry
127+
report_endpoint["/user-feedback"]
128+
crash_report_modal["Crash Report View"]
129+
end
130+
131+
subgraph functions[Functions - run in referrer]
132+
save_userreport
133+
shim_to_feedback
134+
create_feedback_issue
135+
save_userreport --> |"IF event processed"| shim_to_feedback
136+
shim_to_feedback --> create_feedback_issue
137+
end
138+
139+
%% envelope pipeline
140+
app[Your Application] --> |"envelope"| Relay
141+
Relay --> a_topic([ingest-attachments])
142+
a_topic --> save_userreport
143+
144+
%% endpoint and crash reports
145+
app --> |"POST"| report_endpoint --> save_userreport
146+
app --> |"POST"| crash_report_modal --> save_userreport
147+
148+
%% issues platform
149+
create_feedback_issue --> o_consumer(["ingest-occurrences"])
150+
o_consumer --> nodestore[(Nodestore)]
151+
o_consumer --> |"EventStream"| snuba[(Snuba/Clickhouse)]
152+
153+
%% user report saves/updates
154+
save_userreport --> postgres[("Postgres")]
155+
snuba --> |"queries eventstore"| save_userreport
156+
```
119157

120158
<br />
121159

@@ -134,8 +172,14 @@ added a post process job to the errors pipeline: [`link_event_to_user_report()`]
134172
This is the 5th, automated way of creating feedback.
135173

136174
Simplified diagram:
137-
![](https://mermaid.ink/svg/pako:eNpdULtuwzAM_BWBUwIkzm4UXZq1QIF0MwNDlllLTfSoKAUokvx7ZasZWi06kMfj8a6g_EjQwhRl0OJ9j06Ux9rYPvn-g2gcpDqJ7fZZ3BCapkG4CXZ5kN3qMH-7l7NRJ-0z0_qIDtPSfAx8ZYqGWNCFXOLkI83zIfSffqirKu4QKEYfWQTPSYToFTGLmQVH8fRXbZfDKBPxIlXoUyTuVghvvxihOqnSi5X_B9XdsAFL0UozlgSucw0habLFZFvg2Uw6IaC7F6LMyR--nYI2xUwbqB72Rpbk7KNIoyk3vtZIl2TvP_9DeX4)
138-
[diagram source](https://mermaid.live/edit#pako:eNpdULtuwzAM_BWBUwIkzm4UXZq1QIF0MwNDlllLTfSoKAUokvx7ZasZWi06kMfj8a6g_EjQwhRl0OJ9j06Ux9rYPvn-g2gcpDqJ7fZZ3BCapkG4CXZ5kN3qMH-7l7NRJ-0z0_qIDtPSfAx8ZYqGWNCFXOLkI83zIfSffqirKu4QKEYfWQTPSYToFTGLmQVH8fRXbZfDKBPxIlXoUyTuVghvvxihOqnSi5X_B9XdsAFL0UozlgSucw0habLFZFvg2Uw6IaC7F6LMyR--nYI2xUwbqB72Rpbk7KNIoyk3vtZIl2TvP_9DeX4)
175+
176+
```mermaid
177+
graph TD
178+
shim_to_feedback --> |"..."| snuba[(Snuba/Clickhouse)]
179+
snuba --> |"queries eventstore"| pp_job
180+
pp_job["errors post process job"] <--> |"queries/updates"| postgres[("Postgres")]
181+
pp_job --> shim_to_feedback
182+
```
139183

140184
<br />
141185

@@ -179,8 +223,24 @@ Crash reports are also shimmed to feedback. The pipeline is the same as the
179223

180224
## Sentry UI
181225

182-
![](https://mermaid.ink/svg/pako:eNp9Uj1vwjAQ_SvWTUECsWdgKaViqFQVmDhUmeRILBI7tc8DAv577YRAG6F68fn53b37OkNmcoIUCiubUqznqEU4zu87YMXGyoJcB8fTGMeFJbdNED5utkg2juwnNcayGyGMdg--034vt8kqXtOXSmXH0nhHPYV03hmokR-ypNmeIoSsnPPkvgKxMUrzFmHaQQi7pwwxmczEBeHtdY1wEV4FlwVRvpfZUWyWIpkebq_RPYRtc_8jEpK0k57ZEvuSBuSB3u23lV3GzMScWKrKRe2ZiJ0Si2dh_y_jHvZX3zqzn0jv8O3JqtieyzDTtsdxEE-oA3UYQ022lioPy3GOQghcUk0IaTArVZSMgPoaiNKzWZ10BilbT2PwTS6Z5kqGYdaQHmTlAkq5Csv03q1bu3XXH4El2dU)
183-
[diagram source](https://mermaid.live/edit#pako:eNp9Uj1vwjAQ_SvWTUECsWdgKaViqFQVmDhUmeRILBI7tc8DAv577YRAG6F68fn53b37OkNmcoIUCiubUqznqEU4zu87YMXGyoJcB8fTGMeFJbdNED5utkg2juwnNcayGyGMdg--034vt8kqXtOXSmXH0nhHPYV03hmokR-ypNmeIoSsnPPkvgKxMUrzFmHaQQi7pwwxmczEBeHtdY1wEV4FlwVRvpfZUWyWIpkebq_RPYRtc_8jEpK0k57ZEvuSBuSB3u23lV3GzMScWKrKRe2ZiJ0Si2dh_y_jHvZX3zqzn0jv8O3JqtieyzDTtsdxEE-oA3UYQ022lioPy3GOQghcUk0IaTArVZSMgPoaiNKzWZ10BilbT2PwTS6Z5kqGYdaQHmTlAkq5Csv03q1bu3XXH4El2dU)
226+
```mermaid
227+
graph TD
228+
subgraph Storages
229+
postgres[("Postgres (UserReports)")]
230+
snuba[(Snuba/Clickhouse)]
231+
end
232+
233+
subgraph Sentry
234+
issues_endpoint["/issues"]
235+
issues_endpoint --> |"GET"| ui["Feedback UI (/feedback)"]
236+
report_endpoint["/user-feedback"]
237+
report_endpoint --> |"GET"| report_ui["Issue Details UI > User Feedback"]
238+
issues_endpoint --> |"GET"| report_ui
239+
end
240+
241+
postgres --> |"queries"| report_endpoint
242+
snuba --> |"queries"| issues_endpoint
243+
```
184244

185245
You can view the user reports related to a specific issue at the "User Feedback"
186246
tab of Issue Details. This excludes "new" feedback (anything sent from the widget).

0 commit comments

Comments
 (0)