spring-cloud-sleuth | Distributed tracing for spring cloud | Microservice library

 by   spring-cloud Java Version: 3.1.9 License: Apache-2.0

kandi X-RAY | spring-cloud-sleuth Summary

kandi X-RAY | spring-cloud-sleuth Summary

spring-cloud-sleuth is a Java library typically used in Architecture, Microservice, Spring Boot, Spring applications. spring-cloud-sleuth has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has high support. You can download it from GitHub, Maven.

Spring Cloud Sleuth provides Spring Boot auto-configuration for distributed tracing. Sleuth configures everything you need to get started. This includes where trace data (spans) are reported to, how many traces to keep (sampling), if remote fields (baggage) are sent, and which libraries are traced.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              spring-cloud-sleuth has a highly active ecosystem.
              It has 1692 star(s) with 776 fork(s). There are 134 watchers for this library.
              There were 2 major release(s) in the last 12 months.
              There are 37 open issues and 1499 have been closed. On average issues are closed in 34 days. There are no pull requests.
              It has a positive sentiment in the developer community.
              The latest version of spring-cloud-sleuth is 3.1.9

            kandi-Quality Quality

              spring-cloud-sleuth has 0 bugs and 0 code smells.

            kandi-Security Security

              spring-cloud-sleuth has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              spring-cloud-sleuth code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              spring-cloud-sleuth is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              spring-cloud-sleuth releases are available to install and integrate.
              Deployable package is available in Maven.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi has reviewed spring-cloud-sleuth and discovered the below as its top functions. This is intended to give you an instant insight into spring-cloud-sleuth implemented functionality, and help decide if they suit your requirements.
            • Creates a queue from the trace context .
            • Post process bean factory .
            • Lazily creates a BiFunction from the Spring Context .
            • Wrap the input message .
            • Filter incoming request .
            • The http tracing bean .
            • Sets before result set next .
            • Triggers a command started event .
            • Extracts the span context from the trace parent .
            • Instrument a bean .
            Get all kandi verified functions for this library.

            spring-cloud-sleuth Key Features

            No Key Features are available at this moment for spring-cloud-sleuth.

            spring-cloud-sleuth Examples and Code Snippets

            Issues with Upgrading Spring boot from 2.2.2.Release to 2.4.2 Rlease
            Lines of Code : 26dot img1License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            Importing spring-cloud-sleuth as a BOM for dependency management is very suspect.
            
            
                    
                        
                            org.springframework.cloud
                            spring-cloud-sleuth
                            3.0.0
                     

            Community Discussions

            QUESTION

            Building Docker image from spring maven project for arm64 platform
            Asked 2022-Mar-24 at 00:10

            I'm in a Spring course, and I have a maven application (downloaded from the course resources) built from spring initializr. I can build a local Docker image with mvn spring-boot:build-image (no Dockerfile in the project). By default a Docker image is built as linux/amd64, but I am working with a M1 Apple Silicon chip (arm64). I've been looking many workarounds but with no success. Lastly, I found that maybe adding a Dockerfile and specifying the platform it would build the image accordingly.

            My goal is to build a docker image for arm64 architecture.

            So, I created a Dockerfile:

            ...

            ANSWER

            Answered 2022-Mar-24 at 00:10

            Building an ARM-based image is not currently possible with mvn spring-boot:build-image, because the Cloud Native Buildpacks builders that Spring Boot integrates with do not support this. This is one of the possible items of focus on the Paketo buildpacks 2022 roadmap, which you can cast votes for.

            CNB documents a work-around for this, but it's not simple to set up and run.

            RUN mvn -f /home/path_to_app/pom.xml spring-boot:build-image -DskipTests

            You would need Docker-in-Docker to make something like this work, since the CNB builder processes that would run inside the Docker container need to talk to the Docker daemon. Regardless, this would not allow you to build an ARM image for the reasons stated above.

            Source https://stackoverflow.com/questions/71581008

            QUESTION

            How do I increase the default timeout in the Cassandra Java driver using the DriverConfigLoader?
            Asked 2022-Mar-05 at 23:29

            Small question regarding a Spring Webflux Reactive Cassandra application please.

            On a setup Spring Boot 2.6.4 with Webflux and reactive Cassandra, I am using the app to insert some data in Cassandra tables.

            Things works fine, until when there is a higher load, I am seeing an issue (stack trace attached)

            The thing is, reading some documentation, I thought this piece of code would help solve the issue:

            ...

            ANSWER

            Answered 2022-Mar-05 at 23:29

            You have configured the wrong option on the driver. METADATA_SCHEMA_REQUEST_TIMEOUT is the timeout for the requests to retrieve the schema.

            The default request timeout for the Java driver is basic.request.timeout (see reference configuration):

            Source https://stackoverflow.com/questions/71366348

            QUESTION

            Importing OpenTelemetry trace data from Spring Boot application to Elastic APM - views are missing data
            Asked 2022-Feb-17 at 16:26

            I have a Spring Boot application with Spring Cloud Sleuth, OpenTelemetry instrumentation and OpenTelemetry exporter OTLP.

            This is a gist of dependencies:

            • spring-cloud-starter-sleuth without Brave, because we are using OpenTelemetry instrumentation

            • spring-cloud-sleuth-otel-autoconfigure which introduces OpenTelemetry instrumentation libs and provides Spring autoconfiguration

            • opentelemetry-exporter-otlp for sending data to apm server

              ...

            ANSWER

            Answered 2022-Feb-17 at 16:26

            To me, it looks like span and transaction names are missing (I only see HTTP GET instead of a name)

            No, they are not missing. The reason you are seeing name as HTTP GET is due to preference for less cardinal names and the semantic conventions for tracing data. There is a detailed explanation about the naming conventions for the HTTP spans here https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/http.md#name. Any data generated by auto-instrumentation libraries will adhere to the semantic conventions specification. I am guessing the visualisation from the linked vendor is coming from manual instrumentation where you as an end user can give any name (although it is recommended everyone uses less cardinal values but there is not enforcement there). I don't think there is anything you can "fix" here.

            Source https://stackoverflow.com/questions/71161461

            QUESTION

            SpringBoot 3.0.0-M1 + SpringCloud 2022.0.0-M1 [ERROR] 'dependency.version' for org.springframework.cloud:spring-cloud-starter-sleuth:jar is missing
            Asked 2022-Feb-11 at 21:29

            With the exciting releases of both SpringBoot 3.0.0-M1 and SpringCloud 2022.0.0-M1, I went ahead to bump the versions up.

            https://spring.io/blog/2022/01/20/spring-boot-3-0-0-m1-is-now-available

            https://spring.io/blog/2022/01/27/spring-cloud-2022-0-0-m1-codename-kilburn-has-been-released

            While things worked perfectly fine on my SpringBoot 2.6.3 + Jubilee, the exact same code, with just the version change on the pom file to the new pair SpringBoot 3.0.0-M1 + SpringCloud 2022.0.0-M1, the following error is observed.

            ...

            ANSWER

            Answered 2022-Feb-11 at 21:29

            I am having a hard time understanding. Does it mean from 3.0/2022.0 onward, there is no Sleuth anymore? We need to use Micrometer instead?

            Yes

            How to keep existing features offered by Sleuth please?

            We will be providing support for those via Micrometer & Micrometer Tracing.

            does it means we can just remove the Sleuth dependency from the pom file, and instead add/replace with the micrometer one, and things will be the same, still be working?

            If you don't have any custom Sleuth configuration then there should be nothing that you should do for observability to work. If you had custom Sleuth configuration you will need to port it to Micrometer Tracing which essentially is a copy of Sleuth so that should be mostly a package change. If you were doing Brave customizations then most likely you'll have nothing to change.

            Source https://stackoverflow.com/questions/70965480

            QUESTION

            How to get rid of warning "Creating EvaluationContext with no beanFactory"?
            Asked 2022-Feb-08 at 14:57

            I'm trying to setup a dynamic IntegrationFlow to read files from a local directory. Therefore I've created the following parameterizable class:

            ...

            ANSWER

            Answered 2022-Feb-08 at 14:57

            The error means that TransactionSynchronizationFactory must be declared as a bean and therefore its BeanFactory requirements would be fulfilled.

            Please, revise all your volatile objects and consider to make some of them as global singleton beans.

            I believe all of these could go to the main configuration, not dynamic: PollerMetadata, TransactionInterceptor, TransactionManager and TransactionSynchronizationFactory. The dynamic part in your solution is really just that FileReadingMessageSource.

            It is better to use as less dynamic as possible for better performance and proper reusability. You also would avoid duplications whenever they are not needed.

            I would even move that .handle(message -> System.out.println(message)) to the separate global singleton IntegrationFlow and use only a channel reference from this one to avoid extra duplication.

            Source https://stackoverflow.com/questions/71035818

            QUESTION

            Create a new trace id everytime a scheduled runnable task is invoked
            Asked 2022-Feb-03 at 09:29

            In my code I have scheduled a runnable task using the schedule method of task schedular. I went through this link - https://docs.spring.io/spring-cloud-sleuth/docs/current-SNAPSHOT/reference/html/integrations.html#sleuth-runnablecallable-integration. I implemented this way. The current state is - for any schedule a trace is created, and the same trace id is being used for all the runs invoked by this schedule, though spans are new. But I want that each run should have it's own unique trace id. There is a method of tracer which creates a new trace, but is there any way to do this in sleuth by which I can avoid manual creation of a new trace? I am using the 2.0.x version.

            ...

            ANSWER

            Answered 2022-Feb-03 at 09:29
            1. I created a new trace using newtrace method of tracer which returns a span.
            2. Started this span.
            3. Then added this span in the currentscope using withspaninscope method.
            4. Started scoped span for the runnable task and finished both of these spans.

            It worked.

            Source https://stackoverflow.com/questions/70874095

            QUESTION

            How to send and consume sleuth traceId in SQS
            Asked 2021-Nov-18 at 19:14

            I'm using spring-cloud-sleuth.version:3.0.4 and spring-cloud-aws-messaging:2.2.6.RELEASE

            It correctly propogates trace id with HTTP requests.

            However, it seems that it doesn't work with SQS.

            Is there any way to automatically send and consume sleuth traceId with SQS communication.

            ...

            ANSWER

            Answered 2021-Nov-18 at 19:14

            Spring Cloud AWS is now a community project, see: https://awspring.io/ The current release train of Spring Cloud (2020.x), where you can find Sleuth 3.x does not include/support it.

            You should use io.awspring.cloud:spring-cloud-aws-messaging:2.3.x instead of org.springframework.cloud:spring-cloud-aws-messaging:2.2.x with the current release train of Spring Cloud (2020.x).

            Because of these, Sleuth does not instrument Spring AWS Messaging directly but if you can use SQS in a way that integrates with Spring Integration/Messaging/Stream/something that is already instrumented, this could work; i.e.: I would try using QueueMessageChannel and the annotations, I don't think QueueMessagingTemplate will work.

            Another thing you can do is manually instrument it and propagate tracing information in the headers, see: TraceSpringMessagingAutoConfiguration

            Source https://stackoverflow.com/questions/70018184

            QUESTION

            bean 'spring.sleuth.baggage-keys' already defined
            Asked 2021-Nov-16 at 19:35

            I'm in the midst of upgrading an app from Spring Boot 1.x to Spring Boot 2.x. When I attempted to run an existing (and previously working) unit test, I saw the following output:

            ...

            ANSWER

            Answered 2021-Nov-16 at 19:35

            Check the compatibility matrix, you should use Spring Cloud 2020.0.x aka Ilford (Sleuth 3.x) with Spring Boot 2.4 (or 2.5).

            Sleuth 2.2.8 is Spring Cloud Hoxton, it is not compatible with Boot 2.4.

            Source https://stackoverflow.com/questions/69994509

            QUESTION

            Sample rate issue
            Asked 2021-Nov-16 at 18:57

            If the service has a lot of traffic, tracing each invocation and saving the corresponding link log costs a lot, but once the sample rate is set, some trace with errors may be missed. If I want to keep some rate collection, and the trace with errors must be traced, is this possible in spring-cloud-sleuth? If not, is there a solution?

            ...

            ANSWER

            Answered 2021-Nov-16 at 18:57

            Spring Cloud Sleuth pushes the sampling decision down to the tracer implementation, you need to create either a SamplerFunction or a Sampler to do this, please see the docs:

            Update: Sampling is an early decision because tracing has some overhead and early sampling can save your app from that. If you want to filter out your spans at the end, you can setup an always sampler and a SpanHandler where you can access the Span (error, tags, etc.) and you can also keep/drop them based on this (you can inject a sampler to your handler and apply its logic to the rest of your spans).

            Source https://stackoverflow.com/questions/69951263

            QUESTION

            Spring boot sleuth no traces in zipkin
            Asked 2021-Oct-08 at 10:22

            we are trying to use sleuth to send logs to zipkin. We are using spring boot '2.2.6.RELEASE' and cloud version Hoxton.RELEASE. I have added below dependencies

            ...

            ANSWER

            Answered 2021-Oct-08 at 10:22

            Please upgrade the project to the latest version of Spring Boot and Spring Cloud. Also use the BOM as the source of versions - do not set them manually. Please do not set the default properties manually cause as defaults they are already set.

            Source https://stackoverflow.com/questions/69477010

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install spring-cloud-sleuth

            Add Spring Cloud Sleuth to the classpath of a Spring Boot application (together with a Tracer implementation) and you will see trace IDs in logs. Example of Sleuth with Brave tracer:.
            In order to setup Intellij you should import our coding conventions, inspection profiles and set up the checkstyle plugin. The following files can be found in the Spring Cloud Build project. Go to File → Settings → Editor → Code style. There click on the icon next to the Scheme section. There, click on the Import Scheme value and pick the Intellij IDEA code style XML option. Import the spring-cloud-build-tools/src/main/resources/intellij/Intellij_Spring_Boot_Java_Conventions.xml file. Go to File → Settings → Editor → Inspections. There click on the icon next to the Profile section. There, click on the Import Profile and import the spring-cloud-build-tools/src/main/resources/intellij/Intellij_Project_Defaults.xml file. To have Intellij work with Checkstyle, you have to install the Checkstyle plugin. It’s advisable to also install the Assertions2Assertj to automatically convert the JUnit assertions.
            Default Checkstyle rules
            File header setup
            Default suppression rules
            Project defaults for Intellij that apply most of Checkstyle rules
            Project style conventions for Intellij that apply most of Checkstyle rules
            checkstyle.header.file - please point it to the Spring Cloud Build’s, spring-cloud-build-tools/src/main/resources/checkstyle-header.txt file either in your cloned repo or via the https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle-header.txt URL.
            checkstyle.suppressions.file - default suppressions. Please point it to the Spring Cloud Build’s, spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml file either in your cloned repo or via the https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml URL.
            checkstyle.additional.suppressions.file - this variable corresponds to suppressions in your local project. E.g. you’re working on spring-cloud-contract. Then point to the project-root/src/checkstyle/checkstyle-suppressions.xml folder. Example for spring-cloud-contract would be: /home/username/spring-cloud-contract/src/checkstyle/checkstyle-suppressions.xml.

            Support

            Please visit the documentation page to read more about the project.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
            Maven
            Gradle
            CLONE
          • HTTPS

            https://github.com/spring-cloud/spring-cloud-sleuth.git

          • CLI

            gh repo clone spring-cloud/spring-cloud-sleuth

          • sshUrl

            git@github.com:spring-cloud/spring-cloud-sleuth.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link