Class ITDependencies<T extends StorageComponent>


  • @TestInstance(PER_CLASS)
    public abstract class ITDependencies<T extends StorageComponent>
    extends ITStorage<T>
    Base test for SpanStore implementations that support dependency aggregation. Subtypes should create a connection to a real backend, even if that backend is in-process.

    This is a replacement for zipkin.storage.DependenciesTest. There is some redundancy as zipkin2.internal.DependencyLinkerTest also defines many of these tests. The redundancy helps ensure integrated storage doesn't fail due to mismapping of data, for example.

    • Constructor Detail

      • ITDependencies

        public ITDependencies()
    • Method Detail

      • processDependencies

        protected void processDependencies​(List<Span> spans)
                                    throws Exception
        Override if dependency processing is a separate job: it should complete before returning from this method.
        Throws:
        Exception
      • getDependencies

        @Test
        protected void getDependencies​(org.junit.jupiter.api.TestInfo testInfo)
                                throws Exception
        Normally, the root-span is where trace id == span id and parent id == null. The default is to look back one day from today.
        Throws:
        Exception
      • getDependencies_linksMixedTraceId

        @Test
        protected void getDependencies_linksMixedTraceId​(org.junit.jupiter.api.TestInfo testInfo)
                                                  throws Exception
        This tests that dependency linking ignores the high-bits of the trace ID when grouping spans for dependency links. This allows environments with 64-bit instrumentation to participate in the same trace as 128-bit instrumentation.
        Throws:
        Exception
      • replayOverwrites

        @Test
        protected void replayOverwrites​(org.junit.jupiter.api.TestInfo testInfo)
                                 throws Exception
        It should be safe to run dependency link jobs twice
        Throws:
        Exception
      • empty

        @Test
        protected void empty()
                      throws Exception
        Edge-case when there are no spans, or instrumentation isn't logging annotations properly.
        Throws:
        Exception
      • getDependenciesAllInstrumented

        @Test
        protected void getDependenciesAllInstrumented​(org.junit.jupiter.api.TestInfo testInfo)
                                               throws Exception
        When all servers are instrumented, they all record Span.Kind.SERVER and the Span.localEndpoint() indicates the service.
        Throws:
        Exception
      • dependencies_loopback

        @Test
        protected void dependencies_loopback​(org.junit.jupiter.api.TestInfo testInfo)
                                      throws Exception
        Throws:
        Exception
      • dependencies_headlessTrace

        @Test
        protected void dependencies_headlessTrace​(org.junit.jupiter.api.TestInfo testInfo)
                                           throws Exception
        Some systems log a different trace id than the root span. This seems "headless", as we won't see a span whose id is the same as the trace id.
        Throws:
        Exception
      • looksBackIndefinitely

        @Test
        protected void looksBackIndefinitely​(org.junit.jupiter.api.TestInfo testInfo)
                                      throws Exception
        Throws:
        Exception
      • endTsInsideTheTrace

        @Test
        protected void endTsInsideTheTrace​(org.junit.jupiter.api.TestInfo testInfo)
                                    throws Exception
        Ensure complete traces are aggregated, even if they complete after endTs
        Throws:
        Exception
      • endTimeBeforeData

        @Test
        protected void endTimeBeforeData​(org.junit.jupiter.api.TestInfo testInfo)
                                  throws Exception
        Throws:
        Exception
      • lookbackAfterData

        @Test
        protected void lookbackAfterData​(org.junit.jupiter.api.TestInfo testInfo)
                                  throws Exception
        Throws:
        Exception
      • notInstrumentedClientAndServer

        @Test
        protected void notInstrumentedClientAndServer​(org.junit.jupiter.api.TestInfo testInfo)
                                               throws Exception
        This test confirms that the span store can detect dependency indicated by local and remote endpoint. Specifically, this detects an uninstrumented client before the trace and an uninstrumented server at the end of it.
        Throws:
        Exception
      • endTsAndLookbackMustBePositive

        @Test
        protected void endTsAndLookbackMustBePositive()
        This tests we error prior to executing the call.
      • instrumentedClientAndServer

        @Test
        protected void instrumentedClientAndServer​(org.junit.jupiter.api.TestInfo testInfo)
                                            throws Exception
        Throws:
        Exception
      • instrumentedProducerAndConsumer

        @Test
        protected void instrumentedProducerAndConsumer​(org.junit.jupiter.api.TestInfo testInfo)
                                                throws Exception
        Throws:
        Exception
      • missingIntermediateSpan

        @Test
        protected void missingIntermediateSpan​(org.junit.jupiter.api.TestInfo testInfo)
                                        throws Exception
        This shows a missing parent still results in a dependency link when local endpoints change
        Throws:
        Exception
      • canSearchForIntervalsBesidesToday

        @Test
        protected void canSearchForIntervalsBesidesToday​(org.junit.jupiter.api.TestInfo testInfo)
                                                  throws Exception
        This test shows that dependency links can be filtered at daily granularity. This allows the UI to look for dependency intervals besides TODAY.
        Throws:
        Exception
      • spanKindIsNotRequiredWhenEndpointsArePresent

        @Test
        protected void spanKindIsNotRequiredWhenEndpointsArePresent​(org.junit.jupiter.api.TestInfo testInfo)
                                                             throws Exception
        Throws:
        Exception
      • unnamedEndpointsAreSkipped

        @Test
        protected void unnamedEndpointsAreSkipped​(org.junit.jupiter.api.TestInfo testInfo)
                                           throws Exception
        Throws:
        Exception
      • intermediateSpans

        @Test
        protected void intermediateSpans​(org.junit.jupiter.api.TestInfo testInfo)
                                  throws Exception
        This test confirms that the span store can process trace with intermediate spans like the below properly.

        span1: SR SS span2: intermediate call span3: CS SR SS CR: Dependency 1

        Throws:
        Exception
      • duplicateAddress

        @Test
        protected void duplicateAddress​(org.junit.jupiter.api.TestInfo testInfo)
                                 throws Exception
        This test confirms that the span store can process trace with intermediate spans like the below properly.

        span1: SR SS span2: intermediate call span3: CS SR SS CR: Dependency 1

        Throws:
        Exception
      • oneway

        @Test
        protected void oneway​(org.junit.jupiter.api.TestInfo testInfo)
                       throws Exception
        Span starts on one host and ends on the other. In both cases, a response is neither sent nor received.
        Throws:
        Exception
      • annotationNamedErrorIsntError

        @Test
        protected void annotationNamedErrorIsntError​(org.junit.jupiter.api.TestInfo testInfo)
                                              throws Exception
        A timeline annotation named error is not a failed span. A tag/binary annotation is.
        Throws:
        Exception
      • oneway_noClient

        @Test
        protected void oneway_noClient​(org.junit.jupiter.api.TestInfo testInfo)
                                throws Exception
        Async span starts from an uninstrumented source.
        Throws:
        Exception