-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanalytics.asyncapi.yaml
More file actions
568 lines (544 loc) · 17 KB
/
analytics.asyncapi.yaml
File metadata and controls
568 lines (544 loc) · 17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
asyncapi: 3.0.0
info:
title: Analytics Service
version: 1.0.0
description: |
A centralized analytics service that receives and processes analytics events from all other services.
Provides insights, reporting, and analytics data aggregation for user behavior, notification performance,
campaign effectiveness, and system-wide metrics.
channels:
user.analytics:
address: user.analytics
messages:
UserAnalyticsEvent:
$ref: '#/components/messages/UserAnalyticsEvent'
notification.analytics:
address: notification.analytics
messages:
NotificationAnalyticsEvent:
$ref: '#/components/messages/NotificationAnalyticsEvent'
campaign.analytics:
address: campaign.analytics
messages:
CampaignAnalyticsEvent:
$ref: '#/components/messages/CampaignAnalyticsEvent'
analytics.report.request:
address: analytics.report.request
messages:
AnalyticsReportRequest:
$ref: '#/components/messages/AnalyticsReportRequest'
AnalyticsReportReply:
$ref: '#/components/messages/AnalyticsReportReply'
analytics.insights:
address: analytics.insights
messages:
AnalyticsInsight:
$ref: '#/components/messages/AnalyticsInsight'
analytics.alert:
address: analytics.alert
messages:
AnalyticsAlert:
$ref: '#/components/messages/AnalyticsAlert'
operations:
receiveUserAnalytics:
action: receive
channel:
$ref: '#/channels/user.analytics'
summary: Receive user analytics events from user service
messages:
- $ref: '#/channels/user.analytics/messages/UserAnalyticsEvent'
receiveNotificationAnalytics:
action: receive
channel:
$ref: '#/channels/notification.analytics'
summary: Receive notification analytics events from notification service
messages:
- $ref: '#/channels/notification.analytics/messages/NotificationAnalyticsEvent'
receiveCampaignAnalytics:
action: receive
channel:
$ref: '#/channels/campaign.analytics'
summary: Receive campaign analytics events from campaign service
messages:
- $ref: '#/channels/campaign.analytics/messages/CampaignAnalyticsEvent'
replyAnalyticsReport:
action: receive
channel:
$ref: '#/channels/analytics.report.request'
summary: Receive analytics report requests and reply with report data
messages:
- $ref: '#/channels/analytics.report.request/messages/AnalyticsReportRequest'
reply:
channel:
$ref: '#/channels/analytics.report.request'
messages:
- $ref: '#/channels/analytics.report.request/messages/AnalyticsReportReply'
sendAnalyticsInsights:
action: send
channel:
$ref: '#/channels/analytics.insights'
summary: Send automated analytics insights and recommendations
messages:
- $ref: '#/channels/analytics.insights/messages/AnalyticsInsight'
sendAnalyticsAlert:
action: send
channel:
$ref: '#/channels/analytics.alert'
summary: Send analytics alerts for anomalies or important events
messages:
- $ref: '#/channels/analytics.alert/messages/AnalyticsAlert'
components:
messages:
UserAnalyticsEvent:
name: UserAnalyticsEvent
title: User Analytics Event Message
summary: Message for tracking user-related analytics
contentType: application/json
payload:
type: object
properties:
event_id:
type: string
format: uuid
description: Unique identifier for the event
event_type:
type: string
enum: [user_registered, user_logged_in, profile_updated, preferences_changed, account_deleted]
description: Type of the analytics event
user_id:
type: string
format: uuid
description: ID of the user
timestamp:
type: string
format: date-time
description: When the event occurred
metadata:
$ref: '#/components/schemas/Metadata'
required:
- event_id
- event_type
- user_id
- timestamp
NotificationAnalyticsEvent:
name: NotificationAnalyticsEvent
title: Notification Analytics Event Message
summary: Message for tracking notification-related analytics
contentType: application/json
payload:
type: object
properties:
event_id:
type: string
format: uuid
description: Unique identifier for the event
event_type:
type: string
enum: [notification_sent, notification_opened, notification_clicked]
description: Type of the analytics event
user_id:
type: string
format: uuid
description: ID of the user
notification_id:
type: string
format: uuid
description: ID of the related notification
timestamp:
type: string
format: date-time
description: When the event occurred
metadata:
$ref: '#/components/schemas/Metadata'
required:
- event_id
- event_type
- user_id
- timestamp
CampaignAnalyticsEvent:
name: CampaignAnalyticsEvent
title: Campaign Analytics Event Message
summary: Message for tracking campaign-related analytics
contentType: application/json
payload:
type: object
properties:
event_id:
type: string
format: uuid
description: Unique identifier for the event
event_type:
type: string
enum: [campaign_created, campaign_executed, notification_sent, notification_opened, notification_clicked, campaign_completed, campaign_failed]
description: Type of the campaign analytics event
campaign_id:
type: string
format: uuid
description: ID of the campaign
execution_id:
type: string
format: uuid
description: ID of the campaign execution
user_id:
type: string
format: uuid
description: ID of the user (for user-specific events)
notification_id:
type: string
format: uuid
description: ID of the notification (for notification-specific events)
timestamp:
type: string
format: date-time
description: When the event occurred
metadata:
$ref: '#/components/schemas/Metadata'
required:
- event_id
- event_type
- campaign_id
- timestamp
AnalyticsReportRequest:
name: AnalyticsReportRequest
title: Analytics Report Request Message
summary: Message for requesting analytics reports and insights
contentType: application/json
payload:
type: object
properties:
report_id:
type: string
format: uuid
description: Unique identifier for the report request
report_type:
type: string
enum: [user_activity, notification_performance, campaign_effectiveness, system_health, custom]
description: Type of report requested
time_range:
$ref: '#/components/schemas/TimeRange'
filters:
type: object
properties:
user_segments:
type: array
items:
type: string
enum: [all_users, new_users, active_users, inactive_users, premium_users, free_users]
event_types:
type: array
items:
type: string
campaign_ids:
type: array
items:
type: string
format: uuid
user_ids:
type: array
items:
type: string
format: uuid
description: Filters to apply to the report
metrics:
type: array
items:
type: string
enum: [event_count, user_count, conversion_rate, engagement_rate, response_time, error_rate]
description: Specific metrics to include in the report
format:
type: string
enum: [json, csv, pdf]
default: json
description: Output format for the report
created_at:
type: string
format: date-time
description: When the report request was created
required:
- report_id
- report_type
- time_range
AnalyticsReportReply:
name: AnalyticsReportReply
title: Analytics Report Reply Message
summary: Message containing requested analytics report data
contentType: application/json
payload:
type: object
properties:
report_id:
type: string
format: uuid
description: ID of the report request
report_type:
type: string
enum: [user_activity, notification_performance, campaign_effectiveness, system_health, custom]
description: Type of report
time_range:
$ref: '#/components/schemas/TimeRange'
summary:
$ref: '#/components/schemas/ReportSummary'
data:
type: object
description: Detailed report data (structure varies by report type)
insights:
type: array
items:
$ref: '#/components/schemas/Insight'
description: Automated insights generated from the data
generated_at:
type: string
format: date-time
description: When the report was generated
error:
type: object
properties:
code:
type: string
description: Error code
message:
type: string
description: Error message
required:
- report_id
- report_type
- time_range
- summary
- generated_at
AnalyticsInsight:
name: AnalyticsInsight
title: Analytics Insight Message
summary: Message containing automated analytics insights and recommendations
contentType: application/json
payload:
type: object
properties:
insight_id:
type: string
format: uuid
description: Unique identifier for the insight
insight_type:
type: string
enum: [trend, anomaly, recommendation, alert]
description: Type of insight
category:
type: string
enum: [user_behavior, notification_performance, campaign_effectiveness, system_health]
description: Category of the insight
title:
type: string
description: Insight title
description:
type: string
description: Detailed description of the insight
severity:
type: string
enum: [low, medium, high, critical]
description: Severity level of the insight
confidence:
type: number
format: float
minimum: 0
maximum: 1
description: Confidence level of the insight (0-1)
data_points:
type: array
items:
type: object
description: Supporting data points for the insight
recommendations:
type: array
items:
type: string
description: Recommended actions based on the insight
created_at:
type: string
format: date-time
description: When the insight was created
deleted_at:
type: string
format: date-time
description: When the insight was deleted
metadata:
$ref: '#/components/schemas/Metadata'
required:
- insight_id
- insight_type
- category
- title
- description
- severity
- created_at
AnalyticsAlert:
name: AnalyticsAlert
title: Analytics Alert Message
summary: Message for analytics alerts and notifications
contentType: application/json
payload:
type: object
properties:
alert_id:
type: string
format: uuid
description: Unique identifier for the alert
alert_type:
type: string
enum: [anomaly_detected, threshold_exceeded, trend_change, system_issue]
description: Type of alert
severity:
type: string
enum: [low, medium, high, critical]
description: Severity level of the alert
title:
type: string
description: Alert title
description:
type: string
description: Detailed description of the alert
metric:
type: string
description: Metric that triggered the alert
threshold:
type: number
description: Threshold value that was exceeded
current_value:
type: number
description: Current value of the metric
time_window:
type: string
description: Time window for the alert
affected_services:
type: array
items:
type: string
enum: [user_service, notification_service, campaign_service]
description: Services affected by the alert
actions:
type: array
items:
type: string
description: Recommended actions to address the alert
created_at:
type: string
format: date-time
description: When the alert was created
metadata:
$ref: '#/components/schemas/Metadata'
required:
- alert_id
- alert_type
- severity
- title
- description
- created_at
schemas:
TimeRange:
type: object
properties:
start:
type: string
format: date-time
description: Start time for the report period
end:
type: string
format: date-time
description: End time for the report period
granularity:
type: string
enum: [minute, hour, day, week, month]
default: day
description: Time granularity for the report
required:
- start
- end
ReportSummary:
type: object
properties:
total_events:
type: integer
description: Total number of events in the report period
unique_users:
type: integer
description: Number of unique users in the report period
event_types:
type: object
additionalProperties:
type: integer
description: Count of events by type
top_metrics:
type: object
properties:
conversion_rate:
type: number
format: float
minimum: 0
maximum: 1
engagement_rate:
type: number
format: float
minimum: 0
maximum: 1
response_time_avg:
type: number
format: float
error_rate:
type: number
format: float
minimum: 0
maximum: 1
description: Key performance metrics
required:
- total_events
- unique_users
Insight:
type: object
properties:
type:
type: string
enum: [trend, anomaly, correlation, recommendation]
description: Type of insight
title:
type: string
description: Insight title
description:
type: string
description: Insight description
confidence:
type: number
format: float
minimum: 0
maximum: 1
description: Confidence level of the insight
impact:
type: string
enum: [low, medium, high]
description: Impact level of the insight
data_points:
type: array
items:
type: object
description: Supporting data for the insight
required:
- type
- title
- description
Metadata:
type: object
properties:
source:
type: string
enum: [mobile, web, api]
default: api
platform:
type: string
enum: [ios, android, web]
version:
type: string
pattern: '^\d+\.\d+\.\d+$'
environment:
type: string
enum: [development, staging, production]
default: production
required:
- source
- environment