Giter VIP home page Giter VIP logo

otel-java-manual-instrumentation's Introduction

otel-java-manual-instrumentation

  • Pre-requiste Elastic and APM Server Java Application(src: Hello World) Opentelentry Agent java Docker

Note: We are integrating the OpenTelemetry agent directly with the Java application during the Docker build process.

Step 1 - You will need to copy the following environment variables from Elastic APM.

   OTEL_EXPORTER_OTLP_ENDPOINT
   OTEL_EXPORTER_OTLP_HEADERS

Step 2 - Edit Docker file and add below configuration to attach Opentelementry Java Agent after mvn clean install.

   USER root
   RUN apt-get update && apt-get install -y zip curl
   RUN mkdir /otel
   RUN curl -L -o /otel/opentelemetry-javaagent.jar https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.28.0/opentelemetry-javaagent.jar

Step 3 - Build the Docker image or you can download docker from  docker pull navynyx/java-otel-manual-image:latest.

   docker build -t java-otel-manual-image .
   docker login
   docker push java-otel-manual-image:latest

                 or 

   docker pull navynyx/java-otel-manual-image:latest

Step 4 - Run the Docker image.

   ```
   docker run \
          -e OTEL_EXPORTER_OTLP_ENDPOINT="https://xxxxxxxxxxxxxxxxx.com:443" \
          -e ELASTIC_APM_SECRET_TOKEN="999999999999999" \
          -e OTEL_RESOURCE_ATTRIBUTES="service.version=1.0,deployment.environment=production" \
          -e OTEL_SERVICE_NAME="java-favorite-otel-manual" \
          -p 5000:5000 \
          java-otel-manual-image
   ```

Step 5 - You can now issue a few requests in order to generate trace data.

   ```
   curl localhost:5000/favorites

   # or alternatively issue a request every 2 second

   while true; do curl "localhost:5000/favorites"; sleep 2; done;

   ```

Step 6 - Explore traces and logs in Elastic APM

alt Output

otel-java-manual-instrumentation's People

Contributors

navneettoppo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.