Skip to content

Add OTel tracing to MCP server feature #34230

@Azquelt

Description

@Azquelt

Background

Liberty has several observability features, designed to help administrators see how the application is running, diagnose issues and drive automated alerts and responses.

  • Metrics are covered in Add metrics integration for the MCP Server feature #34031
  • Distributed tracing records when particular operations on the server begin and end. Trace records are gathered into a trace server for analysis. Headers can be used to link traces across different microservices so that the trace server gets a complete view of how a single request is handled, even when the processing is split across multiple services.
    • features: mpTelemetry-x.x

Note: in this context, "traces" and "tracing" refer to distributed tracing as described above, rather than to Liberty's trace.log.

Note: the mpTelemetry features implement MicroProfile Telemetry, which is an API for using OpenTelemetry (OTel) to export metrics, traces and logs from Jakarta EE applications.

Requirements

We need to add appropriate tracing to mcpServer

  • tracing needs to be added using mpTelemetry only
    • trace span names and attributes must follow OpenTelemetry recommendations
    • we should follow the Semantic Conventions for MCP traces
    • we should read context information from the MCP request if present (and from the servlet request if not)

Note that this should probably be done after #34031 since we can likely use the same hook points etc. to start and stop spans that we use for collecting metrics.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions