- Notifications
You must be signed in to change notification settings - Fork911
Commit92d22e2
authored
chore: track usage of organizations in telemetry (#16323)
Addressescoder/internal#317.## ChangesRequirements are quoted below:> how many orgs does deployment haveAdds the Organization entity to telemetry.> ensuring resources are associated with orgsAll resources that reference an org already report the org id totelemetry. Adds a test to check that.> whether org sync is configuredAdds the `IDPOrgSync` boolean field to the Deployment entity.## Implementation of the org sync checkWhile there's an `OrganizationSyncEnabled` method on the IDPSyncinterface, I decided not to use it directly and implemented acounterpart just for telemetry purposes. It's a compromise I'm not happyabout, but I found that it's a simpler approach than the alternative.There are multiple reasons:1. The telemetry package cannot statically access the IDPSync interfacedue to a circular import.2. We can't dynamically pass a reference to the`OrganizationSyncEnabled` function at the time of instantiating thetelemetry object, because our server initialization logic depends on thetelemetry object being created before the IDPSync object.3. If we circumvent that problem by passing the reference as aninitially empty pointer, initializing telemetry, then IDPSync, thenupdating the pointer to point to `OrganizationSyncEnabled`, we have torefactor the initialization logic of the telemetry object itself toavoid a race condition where the first telemetry report is performedwithout a valid reference.I actually implemented that approach in#16307, but realized I'm unable tofully test it. It changed the initialization order in the servercommand, and I wanted to test our CLI with Org Sync configured with apremium license. As far as I'm aware, we don't have the tooling to dothat. I couldn't figure out a way to start the CLI with a mock license,and I didn't want to go down further into the refactoring rabbit hole.So I decided that reimplementing the org sync checking logic is simpler.1 parentb77b543 commit92d22e2
File tree
4 files changed
+152
-6
lines changed- coderd
- idpsync
- telemetry
- enterprise/coderd/enidpsync
4 files changed
+152
-6
lines changedLines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
45 | 45 |
| |
46 | 46 |
| |
47 | 47 |
| |
| 48 | + | |
| 49 | + | |
48 | 50 |
| |
49 | 51 |
| |
50 | 52 |
| |
|
Lines changed: 79 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4 | 4 |
| |
5 | 5 |
| |
6 | 6 |
| |
| 7 | + | |
7 | 8 |
| |
8 | 9 |
| |
9 | 10 |
| |
| |||
244 | 245 |
| |
245 | 246 |
| |
246 | 247 |
| |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
247 | 253 |
| |
248 | 254 |
| |
249 | 255 |
| |
| |||
263 | 269 |
| |
264 | 270 |
| |
265 | 271 |
| |
| 272 | + | |
266 | 273 |
| |
267 | 274 |
| |
268 | 275 |
| |
| |||
284 | 291 |
| |
285 | 292 |
| |
286 | 293 |
| |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
287 | 333 |
| |
288 | 334 |
| |
289 | 335 |
| |
| |||
518 | 564 |
| |
519 | 565 |
| |
520 | 566 |
| |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
521 | 582 |
| |
522 | 583 |
| |
523 | 584 |
| |
| |||
916 | 977 |
| |
917 | 978 |
| |
918 | 979 |
| |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
919 | 988 |
| |
920 | 989 |
| |
921 | 990 |
| |
| |||
942 | 1011 |
| |
943 | 1012 |
| |
944 | 1013 |
| |
| 1014 | + | |
945 | 1015 |
| |
946 | 1016 |
| |
947 | 1017 |
| |
| |||
964 | 1034 |
| |
965 | 1035 |
| |
966 | 1036 |
| |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
967 | 1040 |
| |
968 | 1041 |
| |
969 | 1042 |
| |
| |||
1457 | 1530 |
| |
1458 | 1531 |
| |
1459 | 1532 |
| |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
1460 | 1539 |
| |
1461 | 1540 |
| |
1462 | 1541 |
| |
|
Lines changed: 69 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
22 | 22 |
| |
23 | 23 |
| |
24 | 24 |
| |
| 25 | + | |
| 26 | + | |
25 | 27 |
| |
| 28 | + | |
26 | 29 |
| |
27 | 30 |
| |
28 | 31 |
| |
| |||
40 | 43 |
| |
41 | 44 |
| |
42 | 45 |
| |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
43 | 50 |
| |
44 | 51 |
| |
45 |
| - | |
46 |
| - | |
47 |
| - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
48 | 56 |
| |
49 | 57 |
| |
50 |
| - | |
| 58 | + | |
| 59 | + | |
51 | 60 |
| |
52 | 61 |
| |
53 | 62 |
| |
54 | 63 |
| |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
55 | 68 |
| |
56 |
| - | |
57 | 69 |
| |
58 |
| - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
59 | 73 |
| |
60 | 74 |
| |
61 | 75 |
| |
| |||
112 | 126 |
| |
113 | 127 |
| |
114 | 128 |
| |
| 129 | + | |
115 | 130 |
| |
116 | 131 |
| |
117 | 132 |
| |
| |||
128 | 143 |
| |
129 | 144 |
| |
130 | 145 |
| |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
131 | 159 |
| |
132 | 160 |
| |
133 | 161 |
| |
| |||
243 | 271 |
| |
244 | 272 |
| |
245 | 273 |
| |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
246 | 309 |
| |
247 | 310 |
| |
248 | 311 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
19 | 19 |
| |
20 | 20 |
| |
21 | 21 |
| |
| 22 | + | |
| 23 | + | |
22 | 24 |
| |
23 | 25 |
| |
24 | 26 |
| |
|
0 commit comments
Comments
(0)