-
Notifications
You must be signed in to change notification settings - Fork 761
Expand file tree
/
Copy pathTelemetryEventBase.cs
More file actions
67 lines (50 loc) · 1.74 KB
/
TelemetryEventBase.cs
File metadata and controls
67 lines (50 loc) · 1.74 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
using System.Text.Json.Serialization;
namespace UniGetUI.Interface.Telemetry;
/// <summary>
/// Common fields shared by all UniGetUI telemetry events.
/// Mirrors the field names expected by the Devolutions OpenSearch schema.
/// </summary>
public abstract class TelemetryEventBase
{
protected TelemetryEventBase()
{
EventID = Guid.NewGuid().ToString();
EventDate = DateTime.UtcNow;
}
[JsonPropertyName("eventID")]
public string EventID { get; set; }
[JsonPropertyName("eventDate")]
public DateTime EventDate { get; set; }
[JsonPropertyName("installID")]
public required string InstallID { get; set; }
[JsonPropertyName("locale")]
public string? Locale { get; set; }
[JsonPropertyName("application")]
public required TelemetryApplicationInfo Application { get; set; }
[JsonPropertyName("platform")]
public TelemetryPlatformInfo? Platform { get; set; }
}
public sealed class TelemetryApplicationInfo
{
[JsonPropertyName("name")]
public required string Name { get; set; }
[JsonPropertyName("version")]
public required string Version { get; set; }
[JsonPropertyName("dataSource")]
public required string DataSource { get; set; }
[JsonPropertyName("pricing")]
public required string Pricing { get; set; }
[JsonPropertyName("language")]
public string? Language { get; set; }
[JsonPropertyName("architectureType")]
public string? ArchitectureType { get; set; }
}
public sealed class TelemetryPlatformInfo
{
[JsonPropertyName("name")]
public required string Name { get; set; }
[JsonPropertyName("version")]
public string? Version { get; set; }
[JsonPropertyName("architecture")]
public string? Architecture { get; set; }
}