Skip to content

Conversation

@jajeffries
Copy link
Contributor

@jajeffries jajeffries commented Nov 10, 2025

This pull request introduces support for a new Fleet MQTT telemetry topic and enhances the Fleet config manager's OTLP bridge integration. The changes ensure that when the Fleet config manager is active, the agent auto-configures the OTLP gRPC endpoint, and the bridge now uses JSON encoding and is bound to both ingest and telemetry topics. Comprehensive tests have been added to verify these behaviors and the new topic handling.

Fleet MQTT topic and bridge integration:

  • Added a new telemetry topic to the Fleet MQTT topic templates and TokenResponseTopics struct, ensuring telemetry data can be routed separately from ingest data. [1] [2] [3]
  • Updated the Fleet config manager to bind the OTLP bridge to both ingest and telemetry topics, and improved logging to reflect both topics. [1] [2]

OTLP bridge configuration and encoding:

  • The OTLP bridge is now auto-configured to use the gRPC endpoint grpc://localhost:4317 when the Fleet config manager is active, overriding any existing configuration, and falls back to creating missing config sections as needed.
  • Changed the OTLP bridge encoding from protobuf to json for improved compatibility.

Testing improvements:

  • Added and updated tests to verify correct topic generation, bridge initialization, and OTLP configuration overrides, including scenarios for missing topics and backends. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]

Miscellaneous:

  • Added require import for improved test assertions and introduced mock managers for policy and secrets to support new tests. [1] [2]

Internal constants:

  • Introduced a new constant diodePolicyNameAttributeKey in the OTLP bridge handlers for future policy metadata handling.

@github-actions
Copy link

github-actions bot commented Nov 10, 2025

Go test coverage

STATUS ELAPSED PACKAGE COVER PASS FAIL SKIP
🟢 PASS 1.05s github.com/netboxlabs/orb-agent/agent 43.5% 5 0 0
🟢 PASS 1.10s github.com/netboxlabs/orb-agent/agent/backend 33.3% 30 0 0
🟢 PASS 5.03s github.com/netboxlabs/orb-agent/agent/backend/devicediscovery 68.7% 3 0 0
🟢 PASS 0.68s github.com/netboxlabs/orb-agent/agent/backend/mocks 0.0% 0 0 0
🟢 PASS 5.03s github.com/netboxlabs/orb-agent/agent/backend/networkdiscovery 59.9% 3 0 0
🟢 PASS 4.02s github.com/netboxlabs/orb-agent/agent/backend/opentelemetryinfinity 46.3% 2 0 0
🟢 PASS 4.03s github.com/netboxlabs/orb-agent/agent/backend/pktvisor 67.0% 2 0 0
🟢 PASS 5.03s github.com/netboxlabs/orb-agent/agent/backend/snmpdiscovery 59.9% 3 0 0
🟢 PASS 6.04s github.com/netboxlabs/orb-agent/agent/backend/worker 69.6% 4 0 0
🟢 PASS 1.02s github.com/netboxlabs/orb-agent/agent/config 100.0% 6 0 0
🟢 PASS 1.34s github.com/netboxlabs/orb-agent/agent/configmgr 47.9% 28 0 0
🟢 PASS 2.70s github.com/netboxlabs/orb-agent/agent/configmgr/fleet 65.0% 137 0 0
🟢 PASS 1.02s github.com/netboxlabs/orb-agent/agent/otlpbridge 28.9% 5 0 0
🟢 PASS 1.01s github.com/netboxlabs/orb-agent/agent/policies 100.0% 15 0 0
🟢 PASS 1.03s github.com/netboxlabs/orb-agent/agent/policymgr 71.6% 11 0 0
🟢 PASS 19.34s github.com/netboxlabs/orb-agent/agent/secretsmgr 48.9% 54 0 0
🟢 PASS 1.03s github.com/netboxlabs/orb-agent/agent/telemetry 81.7% 19 0 0
🟢 PASS 1.02s github.com/netboxlabs/orb-agent/agent/version 100.0% 1 0 0

Total coverage: 57.1%

@jajeffries jajeffries force-pushed the feat/OBS-1621-telemetry-over-mqtt branch from 7c48cf0 to a9f7b53 Compare November 24, 2025 16:00
@jajeffries jajeffries changed the title feat: send agent telemetry over MQTT feat: send diode data over MQTT Nov 25, 2025
@jajeffries jajeffries marked this pull request as ready for review November 27, 2025 13:34
Copy link
Contributor

@leoparente leoparente left a comment

Choose a reason for hiding this comment

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

Great! LGTM

@leoparente leoparente requested a review from Copilot November 27, 2025 13:38
Copilot finished reviewing on behalf of leoparente November 27, 2025 13:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request introduces support for a new Fleet MQTT telemetry topic and enhances the OTLP bridge to route telemetry data separately from ingest data. The changes include automatic OTLP gRPC endpoint configuration for fleet-managed agents and updates the bridge to use JSON encoding while binding to both ingest and telemetry topics.

  • Added telemetry topic support to Fleet MQTT topics structure for separate routing of telemetry data
  • Implemented routing logic in OTLP bridge to distinguish between ingest and telemetry requests based on policy name attributes
  • Auto-configured OTLP gRPC endpoint for fleet-managed agents with fallback creation of missing configuration sections

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
agent/otlpbridge/server.go Added getter/setter methods for telemetry topic management
agent/otlpbridge/handlers.go Implemented request routing logic to distinguish ingest vs telemetry and route to appropriate topics
agent/otlpbridge/handlers_test.go Updated test to use telemetry topic instead of ingest topic for logs handler
agent/configmgr/fleet.go Updated bridge initialization to bind to both ingest and telemetry topics with JSON encoding
agent/configmgr/fleet_test.go Updated tests to verify telemetry topic binding and configuration
agent/configmgr/fleet/topics.go Added telemetry topic template and field to TokenResponseTopics struct
agent/configmgr/fleet/topics_test.go Added test to verify telemetry topic generation
agent/configmgr/fleet/jwt_claims_test.go Updated test fixtures to include ingest and telemetry topics
agent/configmgr/fleet/connection_hooks_test.go Updated test data to include telemetry topic
agent/agent.go Added auto-configuration logic for OTLP gRPC endpoint when fleet config manager is active
agent/agent_test.go Added comprehensive tests for OTLP auto-configuration scenarios

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jajeffries jajeffries merged commit 3e3f37a into develop Nov 27, 2025
5 checks passed
@jajeffries jajeffries deleted the feat/OBS-1621-telemetry-over-mqtt branch November 27, 2025 19:41
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