initial commit

This commit is contained in:
Jo 2025-01-07 02:06:59 +01:00
parent 6715289efe
commit 788c3389af
37645 changed files with 2526849 additions and 80 deletions

View file

@ -0,0 +1,17 @@
using System;
namespace Unity.Services.Core.Telemetry.Internal
{
[Serializable]
class CachedPayload<TPayload>
where TPayload : ITelemetryPayload
{
/// <summary>
/// Time, in ticks, the first event of this payload was recorded.
/// It uses <see cref="DateTime.UtcNow"/>.
/// </summary>
public long TimeOfOccurenceTicks;
public TPayload Payload;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fc7e0d4e3660a3f45b604bde5c573b9f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b8945d067bb7acc4c9f86ddea96250c0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Unity.Services.Core.Telemetry.Internal
{
[Serializable]
struct Diagnostic : ITelemetryEvent
{
[JsonProperty("content")]
public IDictionary<string, string> Content;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 91622ad6ca234524d8b947037f9de9db
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Unity.Services.Core.Telemetry.Internal
{
[Serializable]
struct DiagnosticsPayload : ITelemetryPayload
{
[JsonProperty("diagnostics")]
public List<Diagnostic> Diagnostics;
[JsonProperty("commonTags")]
public Dictionary<string, string> CommonTags;
[JsonProperty("diagnosticsCommonTags")]
public Dictionary<string, string> DiagnosticsCommonTags;
Dictionary<string, string> ITelemetryPayload.CommonTags => CommonTags;
int ITelemetryPayload.Count => Diagnostics?.Count ?? 0;
void ITelemetryPayload.Add(ITelemetryEvent telemetryEvent)
{
if (!(telemetryEvent is Diagnostic diagnostic))
throw new ArgumentException("This payload accepts only Diagnostic events.");
if (Diagnostics is null)
{
Diagnostics = new List<Diagnostic>(1);
}
Diagnostics.Add(diagnostic);
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2f5bfa82bdb60974380529c55084671a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6b2d91503ff1f2c4e8eff2862ece88d0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,4 @@
namespace Unity.Services.Core.Telemetry.Internal
{
interface ITelemetryEvent {}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 81d320e0845023f44a8dfd79a7df2cfd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,13 @@
using System.Collections.Generic;
namespace Unity.Services.Core.Telemetry.Internal
{
interface ITelemetryPayload
{
Dictionary<string, string> CommonTags { get; }
int Count { get; }
void Add(ITelemetryEvent telemetryEvent);
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3c9dbeab193d6ad45bd9270d4100d511
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: abd0b6db8e602174d9e7f217e0571399
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace Unity.Services.Core.Telemetry.Internal
{
[Serializable]
struct Metric : ITelemetryEvent
{
[JsonProperty("name")]
public string Name;
[JsonProperty("value")]
public double Value;
[JsonProperty("type")]
[JsonConverter(typeof(StringEnumConverter))]
public MetricType Type;
[JsonProperty("tags")]
public IDictionary<string, string> Tags;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a272eaf5ec4f30441854ab3a7b0a1bb6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,14 @@
using System.Runtime.Serialization;
namespace Unity.Services.Core.Telemetry.Internal
{
enum MetricType
{
[EnumMember(Value = "GAUGE")]
Gauge = 0,
[EnumMember(Value = "SUM")]
Sum = 1,
[EnumMember(Value = "HISTOGRAM")]
Histogram = 2,
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 743e8642b43bf094d8dd50e2b9ddfb6c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Unity.Services.Core.Telemetry.Internal
{
[Serializable]
struct MetricsPayload : ITelemetryPayload
{
[JsonProperty("metrics")]
public List<Metric> Metrics;
[JsonProperty("commonTags")]
public Dictionary<string, string> CommonTags;
[JsonProperty("metricsCommonTags")]
public Dictionary<string, string> MetricsCommonTags;
Dictionary<string, string> ITelemetryPayload.CommonTags => CommonTags;
int ITelemetryPayload.Count => Metrics?.Count ?? 0;
void ITelemetryPayload.Add(ITelemetryEvent telemetryEvent)
{
if (!(telemetryEvent is Metric metric))
throw new ArgumentException("This payload accepts only Metric events.");
if (Metrics is null)
{
Metrics = new List<Metric>(1);
}
Metrics.Add(metric);
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d80ee8c7b400fc04797b6c579538d686
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: