/// <summary> /// Initializes a new instance of the <see cref="Telemetry"/> class. /// </summary> /// <param name="source">The source.</param> /// <param name="level">The level.</param> /// <param name="body">The body.</param> /// <param name="arbitraryKeyValuePairs">The arbitrary key value pairs.</param> public Telemetry( TelemetrySource source , TelemetryLevel level , TelemetryBody body , IDictionary <string, object?>?arbitraryKeyValuePairs ) : base(arbitraryKeyValuePairs) { Assumption.AssertNotNull(body, nameof(body)); this.Timestamp = DateTimeUtil.ConvertToUnixTimestampInMilliseconds(DateTime.UtcNow); this.Source = source; this.Level = level; this.Type = body.Type; this.Body = body; Validate(); }
/// <summary> /// Initializes a new instance of the <see cref="Telemetry"/> class. /// </summary> /// <param name="source">The source.</param> /// <param name="level">The level.</param> /// <param name="body">The body.</param> /// <param name="arbitraryKeyValuePairs">The arbitrary key value pairs.</param> public Telemetry( TelemetrySource source , TelemetryLevel level , TelemetryBody body , IDictionary <string, object> arbitraryKeyValuePairs = null ) : base(arbitraryKeyValuePairs) { Assumption.AssertNotNull(body, nameof(body)); this.Timestamp = (long)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds; this.Source = source; this.Level = level; this.Type = body.Type; this.Body = body; Validate(); }