Skip to content

Conversation

@barvhaim
Copy link
Member

@barvhaim barvhaim commented Dec 2, 2025

🧱 New Plugin

Tools Telemetry Exporter

🚀 Summary

Export comprehensive tool invocation telemetry to OpenTelemetry

🧪 Checks

  • Plugin was bootstrapped with the CLI (native or external template) - Manually created based on existing plugins!!!!
  • Unit tests created for the new plugin
  • make lint plugins passes
  • make test passes
  • CHANGELOG updated (if user-facing)
  • README documentation was created for the plugin
  • New plugin added to the documentation linking to the README above

@barvhaim barvhaim force-pushed the plugin/tools_with_additional_telemetry branch from c789de6 to cca9d69 Compare December 2, 2025 12:45
@barvhaim barvhaim changed the title Plugin/tools with additional telemetry Tools Telemetry Exporter plugin Dec 2, 2025
@barvhaim barvhaim marked this pull request as ready for review December 2, 2025 13:13
@araujof araujof self-requested a review December 8, 2025 14:38
Copy link
Member

@araujof araujof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@barvhaim thanks for the PR. My recommendation is to add OpenTelemetry tracers for ContextForge hooks directly in the plugin framework, rather than implementing them inside individual plugins. A few reasons:

  • A tracer implemented as a plugin hook only has visibility into the context passed to that specific plugin — meaning the tool name would appear as the telemetry plugin itself. It also limits your ability to enforce global context propagation or observe other plugins’ execution. Plugins shouldn’t need awareness of other plugins to function correctly.
  • Relying on plugin priority to ensure this plugin runs first is unreliable. Other plugins may also define the lowest priority, creating ordering conflicts.
  • Implementing tracing within the framework is more robust. The framework is already trusted, and the plugin manager has full control and mediation over plugin execution. This makes it possible to implement complete, consistent tracing with lower risk of circumvention or misconfiguration.

I suggest we close this PR and coordinate with @terylt to address any observability gaps directly in the Plugin Framework.

@barvhaim
Copy link
Member Author

barvhaim commented Dec 8, 2025

@araujof thanks for your response, let's discuss before closing,
the current Telemetry data sent for tool invocation returns the following data, which is not so useful (for example, we want to observe the tool input and output), let's call it the "existing span":
image

The current plugin is only adding to the existing tool invocation span additional information about the tool invocation for as sub-span for the "existing span"

the input arguments from the pre-invoke
image

and the output from the post-invoke
image

Adding it as plugin was the fastest way I found to do so without changing the framework

Add new plugin that exports comprehensive tool invocation telemetry
to OpenTelemetry for observability and monitoring.

Features:
- Pre-invocation telemetry: request context, tool metadata, target
  MCP server details, and tool arguments
- Post-invocation telemetry: request context, tool results (optional),
  and error status
- Automatic payload truncation to respect size limits
- Graceful degradation when OpenTelemetry is not available

Configuration options:
- export_full_payload: Export full tool results in post-invocation
- max_payload_bytes_size: Maximum payload size before truncation

The plugin is disabled by default and requires OpenTelemetry to be
enabled on the gateway.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
@crivetimihai crivetimihai force-pushed the plugin/tools_with_additional_telemetry branch from e56d9de to 51bc251 Compare December 13, 2025 00:36
Copy link
Member

@crivetimihai crivetimihai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Rebased and tested.

@crivetimihai crivetimihai merged commit e997513 into IBM:main Dec 13, 2025
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants