private MetricEvent TryGetMetricEvent(AirlockEvent <byte[]> airlockEvent)
 {
     if (RoutingKey.LastSuffixMatches(airlockEvent.RoutingKey, RoutingKey.AppEventsSuffix))
     {
         return(metricEventSerializer.Deserialize(new ByteBufferAirlockSource(airlockEvent.Payload)));
     }
     if (RoutingKey.LastSuffixMatches(airlockEvent.RoutingKey, RoutingKey.TracesSuffix))
     {
         var span = spanAirlockSerializer.Deserialize(new ByteBufferAirlockSource(airlockEvent.Payload));
         if (span.EndTimestamp.HasValue && span.Annotations.TryGetValue(TracingAnnotationNames.Kind, out var kind) && kind == "http-server")
         {
             return(span.ToMetricEvent());
         }
         return(null);
     }
     throw new InvalidOperationException($"Payload type is not recognized for routingKey: {airlockEvent.RoutingKey}");
 }
Example #2
0
 public bool Matches(string routingKey)
 {
     return(RoutingKey.LastSuffixMatches(routingKey, RoutingKey.AppEventsSuffix) ||
            RoutingKey.LastSuffixMatches(routingKey, RoutingKey.TracesSuffix));
 }
 public void LastSuffixMatches_False(string routingKey, string lastSuffix)
 {
     RoutingKey.LastSuffixMatches(routingKey, lastSuffix).Should().BeFalse();
 }
 public bool Matches(string routingKey) => RoutingKey.LastSuffixMatches(routingKey, lastRoutingKeySuffix);