package com.hypnoticocelot.telemetry.example.sink;

import com.hypnoticocelot.telemetry.tracing.Span;
import com.hypnoticocelot.telemetry.tracing.SpanSink;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SLF4JSpanSink implements SpanSink {
    private static final Logger LOG = LoggerFactory.getLogger(SLF4JSpanSink.class);

    @Override
    public void record(Span span) {
        LOG.trace("[TELEMETRY id={}; pid={}; tid={}; name={}; start={}; end={}]",
                span.getId(),
                span.getParentId(),
                span.getTraceId(),
                span.getData().getName(),
                span.getStartTime(),
                span.getEndTime());
    }
}

@@ -45,16 +45,63 @@
 .sink;%0A%0A
+import com.google.common.collect.ImmutableMap;%0A
 import c
@@ -142,16 +142,16 @@
 g.Span;%0A
-
 import c
@@ -254,16 +254,39 @@
 ctory;%0A%0A
+import java.util.Map;%0A%0A
 public c
@@ -539,16 +539,32 @@
 ; end=%7B%7D
+; annotations=%7B%7D
 %5D%22,%0A    
@@ -735,24 +735,24 @@
 tartTime(),%0A
-
             
@@ -772,16 +772,500 @@
 ndTime()
+,%0A                renderAnnotations(span.getData().getAnnotations()));%0A    %7D%0A%0A    private String renderAnnotations(ImmutableMap%3CString, String%3E annotations) %7B%0A        final StringBuilder builder = new StringBuilder();%0A        builder.append(%22%7B%22);%0A        for (Map.Entry%3CString, String%3E entry : annotations.entrySet()) %7B%0A            builder.append(entry.getKey()).append(%22=%22).append(entry.getValue()).append(%22 %22);%0A        %7D%0A        builder.append(%22%7D%22);%0A        return builder.toString(
 );%0A    %7D

Include annotations in the SLF4J logged Spans.