Skip to content

open-telemetry/opentelemetry-java-examples

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

76d14b2 · Jun 13, 2023
May 24, 2023
Apr 25, 2022
May 25, 2023
Sep 8, 2022
Dec 5, 2022
Mar 2, 2023
Apr 14, 2023
May 11, 2022
Jan 9, 2022
Dec 5, 2022
Feb 14, 2023
Feb 14, 2023
Jun 17, 2022
Jun 13, 2023
Jan 12, 2023
Jan 9, 2022
Jan 5, 2022
Jan 5, 2022
Nov 12, 2021
Jun 11, 2023
May 18, 2023
Jan 5, 2022
May 25, 2023
Jan 10, 2023
Jun 11, 2023

Repository files navigation

Java OpenTelemetry Examples

This module contains a set of fully-functional, working examples of using the OpenTelemetry Java APIs and SDK that should all be able to be run locally. Some of them assume you have docker running on your local machine.

Example modules:

  • Using the SDK AutoConfiguration module
    • This module contains a fully-functional example of using the autoconfigure SDK extension module to configure the SDK using only environment variables (or system properties).
    • Note: the opentelemetry-sdk-extension-autoconfigure module is still experimental at this time.
  • Manual instrumentation of HTTP
    • This module provides an example of writing manual instrumentation for HTTP, both client and server.
    • Note more production-ready instrumentation for HTTP is provided as a part of the OpenTelemetry Java Instrumentation project.
  • Configuring the Jaeger Exporter
    • This module contains a fully-functional example of configuring the OpenTelemetry SDK to use a Jaeger exporter, and send some spans to it using the OpenTelemetry API.
    • Note: this example requires having docker installed to run the example.
  • Using the OpenTelemetry Java Agent
    • This module demonstrates using the OpenTelemetry Java Agent with a simple spring boot application. Traces, metrics, and logs are exported to a collector via OTLP.
  • Spring native image telemetry with OpenTelemetry Spring Starter
    • This module demonstrates using the OpenTelemetry Spring Boot starter with a Graal VM native image. Traces and metrics are exported to a collector via OTLP.
  • Configuring Log Appenders
    • This module demonstrates how to configure the Log4j and Logback appenders to bridge logs into the OpenTelemetry Log SDK.
  • Configuring the Logging Exporters
    • This module contains a fully-functional example of configuring the OpenTelemetry SDK to use a logging exporter.
  • Using the OpenTelemetry metrics API
    • This module contains examples of using the OpenTelemetry metrics APIs.
  • Using OpenTelemetry Micrometer shim
    • This module contains an example of a typical micrometer setup (spring boot with spring boot actuator) configured to bridge metrics to OpenTelemetry with the micrometer shim.
    • Note: the micrometer shim is still experimental at this time.
  • Setting up OTLP exporters
    • OTLP is the OpenTelemetry Protocol. This module will demonstrate how to configure the OTLP exporters, and send data to the OpenTelemetry collector using them.
    • Note: this example requires having docker installed to run the example.
  • Setting up the Prometheus exporter
    • The module shows how to configure the OpenTelemetry SDK to expose an endpoint that can be scraped by Prometheus.
    • Note: the prometheus metric reader is still experimental at this time.
  • Manually Configuring the SDK
    • This module shows some concrete examples of manually configuring the Java OpenTelemetry SDK for Tracing.
  • Telemetry Testing
    • This module demonstrates how to test OpenTelemetry instrumentation with a MockServer.
  • Setting up the Zipkin exporter
    • This module contains a fully-functional example of configuring the OpenTelemetry SDK to use a Zipkin exporter, and send some spans to a zipkin backend using the OpenTelemetry API.
    • Note: this example requires having docker installed to run the example.