Skip to content

Issue: Dropwizard 5 instrumentation does not collect HTTP metrics correctly #15511

@thiagohora

Description

@thiagohora

Describe the bug

After upgrading to Dropwizard 5, HTTP server metrics are not being collected or exposed correctly. The application starts without errors, but expected HTTP-related metrics (e.g., request counts, latency timers, request body size) are missing or incomplete.

Expected Behavior
Dropwizard’s built-in instrumentation should automatically register:

  • request duration timers
  • request/response size meters
  • per-endpoint and per-status-code metrics (e.g., io.dropwizard.jetty.MutableServletContextHandler.requests.)

Metrics should appear under the configured metrics backend (Prometheus, console, JMX, etc.).

Actual Behavior

  • No HTTP server metrics are reported.
  • Request/response metrics are missing.

Steps to reproduce

  • Create a minimal Dropwizard 5 application:
    • One simple resource, e.g. GET /ping returning "pong".
  • Configure the server in config.yml with virtual threads disabled:
server:
  type: default
  enableVirtualThreads: false
  • Start the application with the OpenTelemetry Java agent, for example:
java \
  -javaagent:/path/to/opentelemetry-javaagent.jar \
  -Dotel.service.name=dropwizard-test \
  -Dotel.exporter.otlp.endpoint=http://localhost:4317 \
  -jar target/app.jar server config.yml
  • Send some traffic to the app:
curl http://localhost:8080/ping
# repeat many times or run a small load test
  • Check the metrics/exported data in your backend (Prometheus / OTLP collector / logs):
    • You will see traces and some metrics, but expected HTTP server metrics are missing or not updated.
  • Now change the configuration to:
server:
  type: default
  enableVirtualThreads: true
  • Restart the app with the same OTEL agent configuration, send the same traffic, and check metrics again:
    • HTTP metrics appear to be collected correctly or at least more reliably than with enableVirtualThreads = false.

Expected behavior

Collect all metrics correctly

Actual behavior

The vast majority of the metrics are not collected.

Javaagent or library instrumentation version

2.21.0

Environment

JDK: 21.0.8 Correto
OS: amazon linux
DW 5.0.0

Additional context

No response

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds reproneeds triageNew issue that requires triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions