// Copyright Epic Games, Inc. All Rights Reserved. using EpicGames.Horde.Telemetry; namespace HordeServer.Telemetry { /// /// Interface for writing telemetry events from the server /// public interface ITelemetryWriter { /// /// Whether the writer is enabled. Can be used to shortcut construction of event data. /// bool Enabled { get; } /// /// Writes a telemetry event using the server's metadata /// /// The telemetry store to write to /// Event data to write void WriteEvent(TelemetryStoreId telemetryStoreId, object payload); /// /// Writes a telemetry event /// /// The telemetry store to write to /// Metadata for the event /// Event data to write void WriteEvent(TelemetryStoreId telemetryStoreId, TelemetryRecordMeta metadata, object payload); } /// /// Additional metadata associated with a telemetry event /// /// Identifier of the application sending the event /// Version number of the application /// Name of the environment that the sending application is running in /// Unique identifier for the current session public record class TelemetryRecordMeta(string? AppId = null, string? AppVersion = null, string? AppEnvironment = null, string? SessionId = null) { /// /// App id for events originating from Horde itself /// public const string HordeAppId = "Horde"; } /// /// Inactive implementation of /// public class NullTelemetryWriter : ITelemetryWriter { /// public bool Enabled { get; } = false; /// public void WriteEvent(TelemetryStoreId telemetryStoreId, object payload) { } /// public void WriteEvent(TelemetryStoreId telemetryStoreId, TelemetryRecordMeta metadata, object payload) { } } }