Class LoggingMcpTracer

java.lang.Object
com.tnsai.mcp.observability.LoggingMcpTracer
All Implemented Interfaces:
McpTracer

public class LoggingMcpTracer extends Object implements McpTracer
SLF4J-based implementation of McpTracer that logs span lifecycle events.

Logs span start, end, attributes, status, and exceptions using the com.tnsai.mcp.observability.McpTracing logger. Useful for development and debugging without requiring a full tracing backend.

Log levels used:

  • DEBUG - Span start, attribute setting, span end with duration
  • WARN - Span errors and exceptions
See Also:
  • Constructor Details

    • LoggingMcpTracer

      public LoggingMcpTracer()
  • Method Details

    • startSpan

      public McpSpan startSpan(String operationName)
      Description copied from interface: McpTracer
      Starts a new root span with the given operation name.
      Specified by:
      startSpan in interface McpTracer
      Parameters:
      operationName - the name of the operation being traced
      Returns:
      a new span that must be ended via McpSpan.end()
    • startSpan

      public McpSpan startSpan(String operationName, McpSpan parent)
      Description copied from interface: McpTracer
      Starts a new child span with the given operation name and parent.
      Specified by:
      startSpan in interface McpTracer
      Parameters:
      operationName - the name of the operation being traced
      parent - the parent span
      Returns:
      a new child span that must be ended via McpSpan.end()