Skip to content

Commit e6aecca

Browse files
committed
Add Admin UI Analytics
1 parent 9bc8521 commit e6aecca

12 files changed

+231
-0
lines changed

MyApp/_pages/admin-ui-analytics.md

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
---
2+
title: Admin UI Analytics
3+
---
4+
5+
Comprehensive API Analytics is available to all ServiceStack Apps configured with [SQLite Request Logging[(/sqlite-request-logs).
6+
7+
### Benefits of API Analytics
8+
9+
They provide deep and invaluable insight into your System API Usage, device distribution, its Users, API Keys and the
10+
IPs where most traffic generates:
11+
12+
- **Visibility:** Provides a clear, visual summary of complex log data, making it easier to understand API usage and performance at a glance.
13+
- **Performance Monitoring:** Helps track key metrics like request volume and response times to ensure APIs are meeting performance expectations.
14+
- **User Understanding:** Offers insights into how users (and bots) are interacting with the APIs (devices, browsers).
15+
- **Troubleshooting:** Aids in quickly identifying trends, anomalies, or specific endpoints related to issues.
16+
- **Resource Planning:** Understanding usage patterns helps in scaling infrastructure appropriately.
17+
- **Security Insight:** Identifying bot traffic and unusual request patterns can be an early indicator of security concerns.
18+
19+
### Interactive Analytics
20+
21+
Analytics are also interactive where you're able to drill down to monitor the activity of individual APIs, Users, API Keys
22+
and IPs which have further links back to the request logs which the summary analytics are derived from.
23+
24+
As they offer significant and valuable insights they're now built into all ASP.NET Core IdentityAuth templates,
25+
existing .NET 8 IdentityAuth templates can enable it with:
26+
27+
:::sh
28+
x mix sqlitelogs
29+
:::
30+
31+
.NET 8 Templates that are not configured to use [Endpoint Routing[(/endpoint-routing)
32+
and [ASP.NET Core IOC[(/net-ioc) will need to explicitly register `SqliteRequestLogger`
33+
as a singleton dependency in addition to configuring it on the `RequestLogsFeature` plugin:
34+
35+
```csharp
36+
public class ConfigureRequestLogs : IHostingStartup
37+
{
38+
public void Configure(IWebHostBuilder builder) => builder
39+
.ConfigureServices((context, services) =>
40+
{
41+
var logger = new SqliteRequestLogger();
42+
services.AddSingleton<IRequestLogger>(logger);
43+
44+
services.AddPlugin(new RequestLogsFeature {
45+
RequestLogger = logger,
46+
EnableRequestBodyTracking = true,
47+
EnableErrorTracking = true
48+
});
49+
services.AddHostedService<RequestLogsHostedService>();
50+
51+
if (context.HostingEnvironment.IsDevelopment())
52+
{
53+
services.AddPlugin(new ProfilingFeature());
54+
}
55+
});
56+
}
57+
```
58+
59+
This will enable a more feature rich Request Logging Admin UI which utilizes the full queryability of an AutoQueryGrid
60+
to filter, sort and export Request Logs.
61+
62+
[![](/img/pages/admin-ui/sqlitelogs.webp)](/img/pages/admin-ui/sqlitelogs.webp)
63+
64+
## Analytics Overview
65+
66+
Utilizing an `SqliteRequestLogger` will also enable the new **Analytics** Admin UI in the sidebar which initially
67+
displays the API Analytics Dashboard:
68+
69+
[![](/img/pages/admin-ui/analytics-apis1.webp)](/img/pages/admin-ui/analytics-apis1.webp)
70+
71+
### Distribution Pie Charts
72+
73+
Lets you quickly understand the composition of your user base and traffic sources and the
74+
distribution of users across different web browsers, device types, and to identify the proportion of traffic coming from automated bots.
75+
76+
### Requests per day Line Chart
77+
78+
Lets you monitor API usage trends and performance over time. It tracks the total number of API requests and the average response
79+
time day-by-day. You can easily spot trends like peak usage hours/days, identify sudden spikes or drops in traffic,
80+
and correlate request volume with API performance which is crucial for capacity planning and performance troubleshooting.
81+
82+
### API tag groups Pie Chart
83+
84+
Lets you understand the usage patterns across different functional categories of your APIs.
85+
By grouping API requests based on assigned tags (like Security, Authentication, User Management, Tech, etc.), you get a
86+
high-level view of which *types* of functionalities are most frequently used or are generating the most load.
87+
88+
### API Requests Bar Chart
89+
90+
Lets you identify the most and least frequently used specific API endpoints which ranks individual API endpoints by
91+
the number of requests they receive. This helps pinpoint:
92+
93+
- **Critical Endpoints:** The most heavily used APIs that require robust performance and monitoring.
94+
- **Optimization Targets:** High-traffic endpoints that could benefit from performance optimization.
95+
- **Underutilized Endpoints:** APIs that might be candidates for deprecation or require promotion.
96+
- **Troubleshooting:** If performance issues arise (seen in the line chart), this helps narrow down which specific endpoint might be responsible.
97+
98+
[![](/img/pages/admin-ui/analytics-apis2.webp)](/img/pages/admin-ui/analytics-apis2.webp)
99+
100+
### Total Duration Bar Chart
101+
102+
Identifies which API endpoints consume the most *cumulative processing time* over the selected period.
103+
Even if an API endpoint is relatively fast per call, if it's called extremely frequently, it can contribute significantly to overall server load.
104+
Optimizing these can lead to significant savings in server resources (CPU, memory).
105+
106+
### Average Duration Bar Chart
107+
108+
Pinpoints which API endpoints are the slowest on a *per-request* basis. APIs at the top of this list are prime candidates
109+
for performance investigation and optimization, as they represent potential user-facing slowness or system bottlenecks.
110+
111+
### Requests by Duration Ranges Histogram
112+
113+
Provides an overview of the performance distribution for *all* API requests.
114+
This chart shows how many requests fall into different speed buckets and helps you understand the overall responsiveness of your API system at a glance.
115+
116+
## Individual API Analytics
117+
118+
Clicking on an API's bar chart displays a dedicated, detailed view of a single API endpoint's behavior, isolating its performance
119+
and usage patterns from the overall system metrics offering immediate insight into the endpoint's traffic volume and reliability.
120+
121+
[![](/img/pages/admin-ui/analytics-api.webp)](/img/pages/admin-ui/analytics-api.webp)
122+
123+
### Total Requests
124+
125+
Displays the total requests for an API during the selected month. It includes HTTP Status Breakdown which
126+
provide **direct access to the filtered request logs**. This is a major benefit for **rapid troubleshooting**, allowing
127+
you to instantly view the specific log entries corresponding to successful requests or particular error codes for this API.
128+
129+
### Last Request Information
130+
131+
Provides immediate context on the most recent activity for this endpoint with *when* the last request occurred,
132+
the source **IP address** and device information to help understand recent usage and check if the endpoint is still active,
133+
or quickly investigate the very last interaction if needed.
134+
135+
### Duration Summary Table (Total, Min, Max)
136+
137+
Quantifies the performance characteristics specifically for this endpoint with the cumulative (Total) processing load,
138+
the best-case performance (Min), and the worst-case performance (Max) which is useful for identifying performance outliers.
139+
140+
### Duration Requests Histogram
141+
142+
Visualizes the performance distribution for this API.
143+
144+
### Top Users Bar Chart
145+
146+
Identifies which authenticated users are most frequently calling this API and relies on this endpoint the most.
147+
This can be useful for identifying power users, potential API abuse by a specific user account, or understanding the impact of changes to this API on key users.
148+
149+
### Top IP Addresses Bar Chart
150+
151+
Shows which source IP addresses are generating the most traffic for this API.
152+
Useful for identifying high-volume clients, specific servers interacting with this endpoint, or potentially malicious IPs.
153+
154+
## Users
155+
156+
The **Users** tab will display the top 100 Users who make the most API Requests and lets you click on a Users bar chart
157+
to view their individual User analytics.
158+
159+
[![](/img/pages/admin-ui/analytics-users.webp)](/img/pages/admin-ui/analytics-users.webp)
160+
161+
### Individual User Analytics
162+
163+
Provides a comprehensive view of a single user's complete interaction history and behavior across all APIs they've accessed,
164+
shifting the focus from API performance to user experience and activity.
165+
166+
[![](/img/pages/admin-ui/analytics-user.webp)](/img/pages/admin-ui/analytics-user.webp)
167+
168+
### User Info & Total Requests
169+
170+
Identifies the user and quantifies their overall activity level. Clicking on their ID or Name will navigate to the Users Admin UI.
171+
It also shows their success/error rate via the clickable status code links. This helps gauge user engagement and baseline activity.
172+
173+
### Last Request Information
174+
175+
Offers a snapshot of the user's most recent interaction for immediate context.
176+
Knowing **when**, **what** API they called, from which **IP address**, using which **client** & **device** is valuable
177+
for support, identifying their last action or checking recent activity.
178+
179+
### HTTP Status Pie Chart
180+
181+
Visualizes the overall success and error rate specifically for this user's API requests.
182+
183+
### Performance & Request Body Summary Table
184+
185+
Quantifies the performance experienced by this user and the data they typically send.
186+
187+
### Duration Requests Histogram
188+
189+
Shows the distribution of response times for requests made by this user to help understand the typical performance this user experiences.
190+
191+
### Top APIs Bar Chart
192+
193+
Reveals which API endpoints this user interacts with most frequently and help understanding user behavior and which features they use most.
194+
195+
### Top IP Addresses Bar Chart
196+
197+
Identifies the primary network locations or devices the user connects from.
198+
199+
### User Admin UI Analytics
200+
201+
To assist in discoverability a snapshot of a Users Analytics is also visible in the Users Admin UI:
202+
203+
[![](/img/pages/admin-ui/analytics-user-adminui.webp)](/img/pages/admin-ui/analytics-user-adminui.webp)
204+
205+
Clicking on **View User Analytics** takes you to the Users Analytics page to access to the full Analytics features and navigation.
206+
207+
## API Keys
208+
209+
The **API Keys** tab will display the top 100 API Keys who make the most API Requests and lets you click on an API Key
210+
bar chart to view its individual API Key analytics.
211+
212+
[![](/img/pages/admin-ui/analytics-apikeys.webp)](/img/pages/admin-ui/analytics-apikeys.webp)
213+
214+
### Individual API Key Analytics
215+
216+
Provides comprehensive API Key analytics Similar to User Analytics but limited to the API Usage of a single API Key:
217+
218+
[![](/img/pages/admin-ui/analytics-apikey.webp)](/img/pages/admin-ui/analytics-apikey.webp)
219+
220+
## IPs
221+
222+
The **IP Addresses** tab will display the top 100 IPs that make the most API Requests. Click on an IP's
223+
bar chart to view its individual analytics made from that IP Address.
224+
225+
[![](/img/pages/admin-ui/analytics-ips.webp)](/img/pages/admin-ui/analytics-ips.webp)
226+
227+
### Individual IP Analytics
228+
229+
Provides comprehensive IP Address analytics Similar to User Analytics but limited to the API Usage from a single IP Address:
230+
231+
[![](/img/pages/admin-ui/analytics-ip.webp)](/img/pages/admin-ui/analytics-ip.webp)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)