Skip to content

eclipse-osgi-technology/opentelemetry

OpenTelemetry for OSGi

Integrates OpenTelemetry with OSGi, providing traces, metrics, and logs for OSGi applications.

Overview

This project publishes the OpenTelemetry SDK as an OSGi service and bridges various OSGi subsystems into OpenTelemetry telemetry signals. It also provides zero-code bytecode instrumentation via the OSGi WeavingHook mechanism.

  • Maven GroupId: org.eclipse.osgi-technology.opentelemetry
  • Package namespace: org.eclipse.osgi.technology.opentelemetry
  • Java: 21
  • OpenTelemetry: 1.60.0
  • License: EPL-2.0

Repository Structure

opentelemetry/
├── pom.xml                          # Parent POM with dependency management
├── repack/                          # OpenTelemetry SDK repackaged as OSGi bundle
├── core/                            # Core runtime
│   ├── commons/                     # Shared base classes and provider registration
│   ├── sender.http/                 # OTLP/HTTP exporter
│   └── sender.logging/                  # Logging (stdout) exporter
├── integration/                     # OSGi subsystem bridges
│   ├── framework/                   # Bundle/service counts, events, inventory
│   ├── scr/                         # Declarative Services component metrics
│   ├── log/                         # Log Service → OpenTelemetry bridge
│   ├── cm/                          # Configuration Admin events and inventory
│   ├── mxbeans/                     # JVM runtime metrics (memory, CPU, threads, GC)
│   ├── felix.healthcheck/           # Felix Health Check metrics and tracing
│   ├── typedevent/                  # Typed Event bus observation
│   ├── jakarta.servlet/             # HTTP Whiteboard runtime introspection
│   └── jakarta.rest/                # JAX-RS Whiteboard runtime introspection
├── weaving/                         # OSGi WeavingHook bytecode instrumentation
│   ├── hook/                        # Host bundle: WeavingHook, ASM embedded
│   ├── jakarta.servlet/             # HttpServlet request tracing
│   ├── jakarta.rest/                # JAX-RS endpoint tracing
│   ├── jdbc/                        # JDBC operation tracing
│   └── scr/                         # DS lifecycle method tracing
├── examples/                        # Example application
│   └── app/                         # Demo servlets, JAX-RS resources, telemetry producers
└── container/                       # Observability stack (Podman pod)

Modules

Core

Module Description
commons Shared base classes, provider registration for TracerProvider, MeterProvider, LoggerProvider, ContextPropagators
sender.http OTLP/HTTP exporter with batch processing, compression, mTLS support
sender.logging Logging exporter (stdout via java.util.logging) for development/debugging

The core modules publish io.opentelemetry.api.OpenTelemetry and individual provider interfaces (TracerProvider, MeterProvider, LoggerProvider, ContextPropagators) to the OSGi service registry.

Integration

Module Description
framework Bundle/service counts, state distribution, event tracing, live inventory
scr DS component state metrics, inventory, and health traces
log Log Service bridge forwarding LogEntry records to OTel
cm Configuration Admin change events, config counts, and inventory
mxbeans JVM runtime metrics (memory, CPU, threads, GC, class loading, pools)
felix.healthcheck Felix Health Check execution metrics, tracing, and inventory
typedevent Typed Event bus observation with per-topic metrics and trace spans
jakarta.servlet HTTP Whiteboard runtime introspection (servlet contexts, servlets, filters)
jakarta.rest JAX-RS Whiteboard runtime introspection (applications, resources, extensions)

Each integration module consumes the OpenTelemetry service from the core runtime and produces domain-specific traces, metrics, and logs.

Weaving

Module Description
hook Host bundle: WeavingHook, WeaverRegistry, OpenTelemetryProxy, ASM embedded
jakarta.servlet HttpServlet subclasses — HTTP request tracing and metrics
jakarta.rest @Path-annotated JAX-RS resources — REST endpoint tracing
jdbc JDBC Statement implementations — database operation tracing
scr DS component lifecycle methods — activate/deactivate/modified tracing

The weaving system uses a host bundle + fragment bundle architecture. Fragment bundles share the host's classloader, so plain Java ServiceLoader discovers weaver implementations without SPI Fly.

Build

# Full build
mvn clean verify

# Build a single module
mvn clean verify -pl core/commons

Requires Java 21 and Maven 3.9+.

License

Eclipse Public License 2.0

About

Open Telemetry for OSGi

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors