-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.rd
More file actions
130 lines (84 loc) · 3.65 KB
/
example.rd
File metadata and controls
130 lines (84 loc) · 3.65 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
# Example API Requests (curl)
This file contains example curl commands to test the API end-to-end.
------------------------------------------------------------------------
## ⚠️ IMPORTANT --- Replace These Values
Before running commands, replace:
- **APP_ID** → Application ID returned from create app request
- **INGEST_KEY** → Ingest key returned from create app request
Example: If create app returns:
{ "id": 1, "name": "test-app", "ingest_key": "abc123" }
Then use: APP_ID = 1\
INGEST_KEY = abc123
------------------------------------------------------------------------
## 1️⃣ Create Application
``` bash
curl -X POST http://localhost:8000/apps/test-app
```
✔ Copy from response: - id → APP_ID - ingest_key → INGEST_KEY
------------------------------------------------------------------------
## 2️⃣ Send Events
Replace APP_ID and INGEST_KEY before running.
### Event 1 --- ERROR
``` bash
curl -X POST http://localhost:8000/apps/APP_ID/events -H "X-INGEST-KEY: INGEST_KEY" -H "Content-Type: application/json" -d '{
"occurred_at": "2026-02-10T10:00:00Z",
"level": "ERROR",
"message": "TimeoutError: request timed out",
"tags": {"env": "prod"}
}'
```
------------------------------------------------------------------------
### Event 2 --- ERROR
``` bash
curl -X POST http://localhost:8000/apps/APP_ID/events -H "X-INGEST-KEY: INGEST_KEY" -H "Content-Type: application/json" -d '{
"occurred_at": "2026-02-10T10:05:00Z",
"level": "ERROR",
"message": "TimeoutError: request timed out"
}'
```
------------------------------------------------------------------------
### Event 3 --- INFO
``` bash
curl -X POST http://localhost:8000/apps/APP_ID/events -H "X-INGEST-KEY: INGEST_KEY" -H "Content-Type: application/json" -d '{
"occurred_at": "2026-02-10T11:00:00Z",
"level": "INFO",
"message": "User logged in"
}'
```
------------------------------------------------------------------------
## 3️⃣ List Events
``` bash
curl "http://localhost:8000/apps/APP_ID/events?limit=50&offset=0"
```
------------------------------------------------------------------------
## 4️⃣ Timeseries Stats
⚠ interval must be lowercase: hour or day
``` bash
curl "http://localhost:8000/apps/APP_ID/stats/timeseries?since=2026-02-10T09:00:00Z&until=2026-02-10T12:00:00Z&interval=hour"
```
------------------------------------------------------------------------
## 5️⃣ Timeseries Stats (Filtered by Level)
``` bash
curl "http://localhost:8000/apps/APP_ID/stats/timeseries?since=2026-02-10T09:00:00Z&until=2026-02-10T12:00:00Z&interval=hour&level=ERROR"
```
------------------------------------------------------------------------
## 6️⃣ By Level Stats
``` bash
curl "http://localhost:8000/apps/APP_ID/stats/by-level?since=2026-02-10T09:00:00Z&until=2026-02-10T12:00:00Z"
```
------------------------------------------------------------------------
## 7️⃣ Top Messages
``` bash
curl "http://localhost:8000/apps/APP_ID/stats/top-messages?since=2026-02-10T09:00:00Z&until=2026-02-10T12:00:00Z&limit=10"
```
------------------------------------------------------------------------
## 8️⃣ Top Messages (Filtered by Level)
``` bash
curl "http://localhost:8000/apps/APP_ID/stats/top-messages?since=2026-02-10T09:00:00Z&until=2026-02-10T12:00:00Z&limit=10&level=ERROR"
```
------------------------------------------------------------------------
## ✔ Expected Result
After sending events: - Timeseries → should show counts per hour -
By-level → should show ERROR, INFO, etc counts - Top messages → should
show most common messages
------------------------------------------------------------------------