Class ITDependencies

  • Direct Known Subclasses:
    ITInMemoryStorage.ITDependencies

    public abstract class ITDependencies
    extends java.lang.Object
    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

      • storage

        protected abstract StorageComponent storage()
        Should maintain state between multiple calls within a test.
      • clear

        public abstract void clear()
                            throws java.lang.Exception
        Clears store between tests.
        Throws:
        java.lang.Exception
      • processDependencies

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

        public void getDependencies()
                             throws java.lang.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:
        java.lang.Exception
      • getDependencies_strictTraceId

        public void getDependencies_strictTraceId()
                                           throws java.lang.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:
        java.lang.Exception
      • replayOverwrites

        public void replayOverwrites()
                              throws java.lang.Exception
        It should be safe to run dependency link jobs twice
        Throws:
        java.lang.Exception
      • empty

        public void empty()
                   throws java.lang.Exception
        Edge-case when there are no spans, or instrumentation isn't logging annotations properly.
        Throws:
        java.lang.Exception
      • traceIdIsOpaque

        public void traceIdIsOpaque()
                             throws java.lang.Exception
        Trace id is not required to be a span id. For example, some instrumentation may create separate trace ids to help with collisions, or to encode information about the origin. This test makes sure we don't rely on the trace id = root span id convention.
        Throws:
        java.lang.Exception
      • getDependenciesAllInstrumented

        public void getDependenciesAllInstrumented()
                                            throws java.lang.Exception
        When all servers are instrumented, they all record Span.Kind.SERVER and the Span.localEndpoint() indicates the service.
        Throws:
        java.lang.Exception
      • dependencies_loopback

        public void dependencies_loopback()
                                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • dependencies_headlessTrace

        public void dependencies_headlessTrace()
                                        throws java.lang.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:
        java.lang.Exception
      • looksBackIndefinitely

        public void looksBackIndefinitely()
                                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • endTsInsideTheTrace

        public void endTsInsideTheTrace()
                                 throws java.lang.Exception
        Ensure complete traces are aggregated, even if they complete after endTs
        Throws:
        java.lang.Exception
      • endTimeBeforeData

        public void endTimeBeforeData()
                               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • lookbackAfterData

        public void lookbackAfterData()
                               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • notInstrumentedClientAndServer

        public void notInstrumentedClientAndServer()
                                            throws java.lang.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:
        java.lang.Exception
      • endTsAndLookbackMustBePositive

        public void endTsAndLookbackMustBePositive()
                                            throws java.io.IOException
        Throws:
        java.io.IOException
      • instrumentedClientAndServer

        public void instrumentedClientAndServer()
                                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • instrumentedProducerAndConsumer

        public void instrumentedProducerAndConsumer()
                                             throws java.lang.Exception
        Throws:
        java.lang.Exception
      • manyLinks

        public void manyLinks()
                       throws java.lang.Exception
        Ensure there's no query limit problem around links
        Throws:
        java.lang.Exception
      • missingIntermediateSpan

        public void missingIntermediateSpan()
                                     throws java.lang.Exception
        This shows a missing parent still results in a dependency link when local endpoints change
        Throws:
        java.lang.Exception
      • canSearchForIntervalsBesidesToday

        public void canSearchForIntervalsBesidesToday()
                                               throws java.lang.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:
        java.lang.Exception
      • spanKindIsNotRequiredWhenEndpointsArePresent

        public void spanKindIsNotRequiredWhenEndpointsArePresent()
                                                          throws java.lang.Exception
        Throws:
        java.lang.Exception
      • unnamedEndpointsAreSkipped

        public void unnamedEndpointsAreSkipped()
                                        throws java.lang.Exception
        Throws:
        java.lang.Exception
      • intermediateSpans

        public void intermediateSpans()
                               throws java.lang.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:
        java.lang.Exception
      • duplicateAddress

        public void duplicateAddress()
                              throws java.lang.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:
        java.lang.Exception
      • oneway

        public void oneway()
                    throws java.lang.Exception
        Span starts on one host and ends on the other. In both cases, a response is neither sent nor received.
        Throws:
        java.lang.Exception
      • annotationNamedErrorIsntError

        public void annotationNamedErrorIsntError()
                                           throws java.lang.Exception
        A timeline annotation named error is not a failed span. A tag/binary annotation is.
        Throws:
        java.lang.Exception
      • oneway_noClient

        public void oneway_noClient()
                             throws java.lang.Exception
        Async span starts from an uninstrumented source.
        Throws:
        java.lang.Exception
      • aggregateLinks

        protected java.util.Map<java.lang.Long,​java.util.List<DependencyLink>> aggregateLinks​(java.util.List<Span> spans)
        Returns links aggregated by midnight