Skip to content

Add OpenTelemetry collector MCP#77

Draft
pavolloffay wants to merge 3 commits intorhobs:mainfrom
pavolloffay:otelcol
Draft

Add OpenTelemetry collector MCP#77
pavolloffay wants to merge 3 commits intorhobs:mainfrom
pavolloffay:otelcol

Conversation

@pavolloffay
Copy link
Copy Markdown
Member

@pavolloffay pavolloffay commented Apr 24, 2026

Add OpenTelemetry collector MCP.

The toolset enables users to configure the collector and upgrade across versions. The MCP exposes the available configuration for the Red Hat build of OpenTelemetry. The MCP does not communicate with the collector; it only provides and validates the configuration.

> get_otelcol_versions
> list_otelcol_components
> get_otelcol_component_schema
> validate_otelcol_config

TODOs

Depends on: os-observability/redhat-opentelemetry-collector#135

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Apr 24, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Apr 24, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: pavolloffay
Once this PR has been reviewed and has the lgtm label, please assign rexagod for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
@slashpai
Copy link
Copy Markdown
Member

Haven't looked deep, can take a look on Monday. Will e2e setup and tests will be added too?

@pavolloffay
Copy link
Copy Markdown
Member Author

The otelcol tools don't require external infrastructure (they use embedded schemas), so there's no e2e setup needed. We have:

  • Unit tests in pkg/otelcol/handlers_test.go
  • mcpchecker evals in evals/mcpchecker/tasks/otelcol/

I can add basic e2e tests that verify the tools work via MCP HTTP calls if you'd like, but they'd be simpler than metrics tests since no backend setup is required.

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
@slashpai
Copy link
Copy Markdown
Member

@pavolloffay Can you rebase when you get chance, we enabled coderabbit today so wanted to see if it works :)

Comment thread pkg/otelcol/toolset.go
// DefaultVersion is the default OpenTelemetry Collector version to use when
// version is not explicitly specified in tool calls. If not set, the latest
// available version is used.
DefaultVersion string `toml:"default_version,omitempty"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this used anywhere?

Comment thread pkg/otelcol/toolset.go
type Config struct {
// SchemaDir is an optional path to a directory containing component schemas.
// If not specified, embedded schemas from the collectorschema package are used.
SchemaDir string `toml:"schema_dir,omitempty"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a way to set config option when using obs-mcp directly, i.e. without using openshift-mcp-server?

Comment thread pkg/otelcol/prompt.go
package otelcol

const (
ServerPrompt = `You are an expert OpenTelemetry Collector configuration assistant with direct access to component schemas, documentation, and validation through this MCP server.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

afaics this variable is not referenced anywhere

Comment thread pkg/tools/prompt.go
1. **Discover components**: Use list_otelcol_components to see available receivers, processors, exporters, extensions, and connectors
2. **Get component schema**: Use get_otelcol_component_schema to understand configuration options
3. **Validate configurations**: Use validate_otelcol_config to check configurations before deployment
4. **Version management**: Use get_otelcol_versions and get_otelcol_changelog when planning upgrades`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The tool get_otelcol_changelog doesn't exist in the PR

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 7, 2026

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

Important

Review skipped

Auto reviews are limited based on label configuration.

🚫 Review skipped — only excluded labels are configured. (1)
  • work-in-progress

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: d24a311e-127f-40c1-ad14-e57d21340699

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants