private static OtlpTrace.Span.Types.Event ToOtlpEvent(ActivityEvent activityEvent)
        {
            var otlpEvent = new OtlpTrace.Span.Types.Event
            {
                Name         = activityEvent.Name,
                TimeUnixNano = (ulong)activityEvent.Timestamp.ToUnixTimeNanoseconds(),
            };

            otlpEvent.Attributes.AddRange(activityEvent.Attributes.Select(ToOtlpAttribute));

            return(otlpEvent);
        }
Exemple #2
0
        private static OtlpTrace.Span.Types.Event ToOtlpEvent(Event source)
        {
            var otlpEvent = new OtlpTrace.Span.Types.Event
            {
                Name         = source.Name,
                TimeUnixNano = (ulong)source.Timestamp.ToUnixTimeNanoseconds(),
            };

            if (!ReferenceEquals(source.Attributes, EmptySpanDataAttributes))
            {
                otlpEvent.Attributes.AddRange(source.Attributes.Select(ToOtlpAttribute));
            }

            return(otlpEvent);
        }
        private static OtlpTrace.Span.Types.Event ToOtlpEvent(ActivityEvent activityEvent)
        {
            var otlpEvent = new OtlpTrace.Span.Types.Event
            {
                Name         = activityEvent.Name,
                TimeUnixNano = (ulong)activityEvent.Timestamp.ToUnixTimeNanoseconds(),
            };

            foreach (var attribute in from tag in activityEvent.Tags
                     let attribute = ToOtlpAttributes(tag)
                                     where attribute != null && attribute.Any()
                                     select attribute)
            {
                otlpEvent.Attributes.AddRange(attribute);
            }

            return(otlpEvent);
        }