@@ -184,15 +184,16 @@ public static Span CreateSpan(string traceId, string spanId, DateTime startTime,
184184 return span ;
185185 }
186186
187- public static LogRecord CreateLogRecord ( DateTime ? time = null , DateTime ? observedTime = null , string ? message = null , SeverityNumber ? severity = null , IEnumerable < KeyValuePair < string , string > > ? attributes = null , bool ? skipBody = null )
187+ public static LogRecord CreateLogRecord ( DateTime ? time = null , DateTime ? observedTime = null , string ? message = null , SeverityNumber ? severity = null , IEnumerable < KeyValuePair < string , string > > ? attributes = null ,
188+ bool ? skipBody = null , string ? traceId = null , string ? spanId = null )
188189 {
189190 attributes ??= [ new KeyValuePair < string , string > ( "{OriginalFormat}" , "Test {Log}" ) , new KeyValuePair < string , string > ( "Log" , "Value!" ) ] ;
190191
191192 var logRecord = new LogRecord
192193 {
193194 Body = ( skipBody ?? false ) ? null : new AnyValue { StringValue = message ?? "Test Value!" } ,
194- TraceId = ByteString . CopyFrom ( Convert . FromHexString ( "5465737454726163654964" ) ) ,
195- SpanId = ByteString . CopyFrom ( Convert . FromHexString ( "546573745370616e4964" ) ) ,
195+ TraceId = ( traceId != null ) ? ByteString . CopyFrom ( Encoding . UTF8 . GetBytes ( traceId ) ) : ByteString . CopyFrom ( Convert . FromHexString ( "5465737454726163654964" ) ) ,
196+ SpanId = ( spanId != null ) ? ByteString . CopyFrom ( Encoding . UTF8 . GetBytes ( spanId ) ) : ByteString . CopyFrom ( Convert . FromHexString ( "546573745370616e4964" ) ) ,
196197 TimeUnixNano = time != null ? DateTimeToUnixNanoseconds ( time . Value ) : 1000 ,
197198 ObservedTimeUnixNano = observedTime != null ? DateTimeToUnixNanoseconds ( observedTime . Value ) : 1000 ,
198199 SeverityNumber = severity ?? SeverityNumber . Info
@@ -303,13 +304,13 @@ public static OtlpContext CreateContext(TelemetryLimitOptions? options = null, I
303304
304305 public static OtlpSpan CreateOtlpSpan ( OtlpApplication app , OtlpTrace trace , OtlpScope scope , string spanId , string ? parentSpanId , DateTime startDate ,
305306 KeyValuePair < string , string > [ ] ? attributes = null , OtlpSpanStatusCode ? statusCode = null , string ? statusMessage = null , OtlpSpanKind kind = OtlpSpanKind . Unspecified ,
306- OtlpApplication ? uninstrumentedPeer = null )
307+ OtlpApplication ? uninstrumentedPeer = null , DateTime ? endDate = null )
307308 {
308309 return new OtlpSpan ( app . GetView ( [ ] ) , trace , scope )
309310 {
310311 Attributes = attributes ?? [ ] ,
311312 BackLinks = [ ] ,
312- EndTime = DateTime . MaxValue ,
313+ EndTime = endDate ?? DateTime . MaxValue ,
313314 Events = [ ] ,
314315 Kind = kind ,
315316 Links = [ ] ,
0 commit comments