Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpringBoot 3 + micrometer integration with Lightstep support #152

Open
patpatpat123 opened this issue Feb 2, 2023 · 0 comments
Open

SpringBoot 3 + micrometer integration with Lightstep support #152

patpatpat123 opened this issue Feb 2, 2023 · 0 comments

Comments

@patpatpat123
Copy link

patpatpat123 commented Feb 2, 2023

Hello team,

This is my first post in this repo, if not anything else, just wanted to say thanks for the project.
It is very interesting, the concepts are easy to follow.

Wanted to reach out with a small issue/feature request please.

First, please have a look at the code, I am going to make my point with just three files:

code (not important)

package org.example;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
public class Main {
    public static void main(String[] args) {
        SpringApplication.run(Main.class, args);
    }

    private static final Logger logger = LoggerFactory.getLogger(Main.class);

    @GetMapping("/test")
    public String test() {
        logger.info("<===== look on the left to see traces");
        return "how to connect to lightstep with a springboot app + micrometer";
    }

}

pom file (please note the dependencies to open telemetry)

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>springbootlightstep</artifactId>
    <version>1.0-SNAPSHOT</version>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.0.2</version>
        <relativePath/>
    </parent>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>2022.0.1</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-registry-otlp</artifactId>
        </dependency>
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-tracing-bridge-otel</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

configuration file (please note the configuration to lightstep)

management.endpoints.web.exposure.include=*
management.otlp.metrics.export.url=https://ingest.lightstep.com:443
server.port=8080
management.tracing.sampling.probability=1.0
debug=true
logging.pattern.level="%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]"
spring.application.name=lightstep

When running this app, the traces are properly generated (you should see log like this:)

2023-02-02T13:54:13.097+08:00 " INFO [lightstep,beb7255bf90616747ae9bc2f66ae1a45,ede3ac9cd903d2aa]" 29364 --- [nio-8080-exec-1] org.example.Main                         : <===== look on the left to see traces

Our company is considering using lightstep in production.
However, our applications, thousands of microservices, are currently lightstep agnostic, the dependency does not have anything related to lightstep (and we would like to keep it that way) just to micrometer.

Our expectation is those kind of SpringBoot + micrometer app, which already generates traces, should easily be exported to lightstep via open telemetry. I signed up with a test account + got my app key, and I am expecting this to work and see my trace there.

Actual, unfortunately, we are not able to see our traces.

Could you please provide a simple springboot + micrometer open telemetry app, without dependency to lightstep, which will validate our poc prior to an official onbaroding to lightstep please?

https://docs.lightstep.com/changelog/java-springboot

Other online product offers this ability (just some configuration to confugure in SpringBoot application.properties, and traces + metrics are successfully published)

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant