Class InMemoryStorage

  • All Implemented Interfaces:
    Closeable, AutoCloseable, AutocompleteTags, ServiceAndSpanNames, SpanConsumer, SpanStore, Traces

    public final class InMemoryStorage
    extends StorageComponent
    implements SpanStore, SpanConsumer, AutocompleteTags, ServiceAndSpanNames, Traces
    Test storage component that keeps all spans in memory, accepting them on the calling thread.

    Internally, spans are indexed on 64-bit trace ID

    Here's an example of some traces in memory:

    
     spansByTraceIdTimeStamp:
        <aaaa,July 4> --> ( spanA(time:July 4, traceId:aaaa, service:foo, name:GET),
                            spanB(time:July 4, traceId:aaaa, service:bar, name:GET) )
        <cccc,July 4> --> ( spanC(time:July 4, traceId:aaaa, service:foo, name:GET) )
        <bbbb,July 5> --> ( spanD(time:July 5, traceId:bbbb, service:biz, name:GET) )
        <bbbb,July 6> --> ( spanE(time:July 6, traceId:bbbb) service:foo, name:POST )
    
     traceIdToTraceIdTimeStamps:
        aaaa --> [ <aaaa,July 4> ]
        bbbb --> [ <bbbb,July 5>, <bbbb,July 6> ]
        cccc --> [ <cccc,July 4> ]
    
     serviceToTraceIds:
        foo --> [ <aaaa>, <cccc>, <bbbb> ]
        bar --> [ <aaaa> ]
        biz --> [ <bbbb> ]
    
     serviceToSpanNames:
        bar --> ( GET )
        biz --> ( GET )
        foo --> ( GET, POST )