@@ -184,15 +184,16 @@ public static Span CreateSpan(string traceId, string spanId, DateTime startTime,
184
184
return span ;
185
185
}
186
186
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 )
188
189
{
189
190
attributes ??= [ new KeyValuePair < string , string > ( "{OriginalFormat}" , "Test {Log}" ) , new KeyValuePair < string , string > ( "Log" , "Value!" ) ] ;
190
191
191
192
var logRecord = new LogRecord
192
193
{
193
194
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" ) ) ,
196
197
TimeUnixNano = time != null ? DateTimeToUnixNanoseconds ( time . Value ) : 1000 ,
197
198
ObservedTimeUnixNano = observedTime != null ? DateTimeToUnixNanoseconds ( observedTime . Value ) : 1000 ,
198
199
SeverityNumber = severity ?? SeverityNumber . Info
@@ -303,13 +304,13 @@ public static OtlpContext CreateContext(TelemetryLimitOptions? options = null, I
303
304
304
305
public static OtlpSpan CreateOtlpSpan ( OtlpApplication app , OtlpTrace trace , OtlpScope scope , string spanId , string ? parentSpanId , DateTime startDate ,
305
306
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 )
307
308
{
308
309
return new OtlpSpan ( app . GetView ( [ ] ) , trace , scope )
309
310
{
310
311
Attributes = attributes ?? [ ] ,
311
312
BackLinks = [ ] ,
312
- EndTime = DateTime . MaxValue ,
313
+ EndTime = endDate ?? DateTime . MaxValue ,
313
314
Events = [ ] ,
314
315
Kind = kind ,
315
316
Links = [ ] ,
0 commit comments