Implement telemetry system with data collection and reporting
Signed-off-by: Dmitrii <computer@yawaflua.tech> Took 20 minutes
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
using MongoDB.Bson;
|
||||
|
||||
namespace SpMega.Backend.Persistent.Models.Telemetry;
|
||||
|
||||
public class BackendRequestTelemetryDocument
|
||||
{
|
||||
public ObjectId Id { get; set; }
|
||||
public string RequestId { get; set; } = string.Empty;
|
||||
public string Method { get; set; } = string.Empty;
|
||||
public string Path { get; set; } = string.Empty;
|
||||
public string Scheme { get; set; } = string.Empty;
|
||||
public string Host { get; set; } = string.Empty;
|
||||
public string? ClientIp { get; set; }
|
||||
public string? UserAgent { get; set; }
|
||||
public int StatusCode { get; set; }
|
||||
public long DurationMs { get; set; }
|
||||
public string? UserId { get; set; }
|
||||
public DateTimeOffset Timestamp { get; set; } = DateTimeOffset.UtcNow;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using MongoDB.Bson;
|
||||
|
||||
namespace SpMega.Backend.Persistent.Models.Telemetry;
|
||||
|
||||
public class ModTelemetryDocument
|
||||
{
|
||||
public ObjectId Id { get; set; }
|
||||
public string UserId { get; set; } = string.Empty;
|
||||
public string SessionId { get; set; } = string.Empty;
|
||||
public string ClientVersion { get; set; } = string.Empty;
|
||||
public DateTimeOffset SentAt { get; set; }
|
||||
public DateTimeOffset ReceivedAt { get; set; } = DateTimeOffset.UtcNow;
|
||||
public List<ModTelemetryEventDocument> Events { get; set; } = [];
|
||||
}
|
||||
|
||||
public class ModTelemetryEventDocument
|
||||
{
|
||||
public string EventType { get; set; } = string.Empty;
|
||||
public DateTimeOffset Timestamp { get; set; }
|
||||
public string PayloadJson { get; set; } = "{}";
|
||||
}
|
||||
Reference in New Issue
Block a user