Skip to content

feat: add openteletry metrics support for each backend #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2025

Conversation

leoparente
Copy link
Contributor

This pull request introduces support for OpenTelemetry (OTLP) metrics endpoints across multiple backend components (deviceDiscoveryBackend, networkDiscoveryBackend, workerBackend, and pktvisorBackend). It replaces the previous host/port configuration for OTLP with HTTP and gRPC endpoint URLs, ensuring more flexibility and consistency in configuration. Key changes include adding new fields for OTLP endpoints, updating configuration logic, and modifying startup commands to include OTLP-related options.

OpenTelemetry (OTLP) Integration:

  • Added a new diodeOtelEndpoint field to the deviceDiscoveryBackend, networkDiscoveryBackend, and workerBackend structs to store the gRPC OTLP endpoint. Updated their Configure methods to set this field based on the common.Otel.Grpc configuration and log the endpoint being used. Modified the Start methods to append the --otel-endpoint option to the startup arguments if the endpoint is configured. (device_discovery.go: [1] [2] [3]; network_discovery.go: [4] [5] [6]; worker.go: [7] [8] [9]

  • Updated the pktvisorBackend to parse and validate the OTLP HTTP endpoint URL (common.Otel.HTTP) instead of using separate host and port fields. Extracted and logged the host and port from the URL during configuration. (pktvisor.go: [1] [2]

Configuration Schema Updates:

  • Replaced the host and port fields in the BackendCommons.Otel configuration with grpc and http fields to support full endpoint URLs for OTLP metrics. (types.go: agent/config/types.goL71-R72)

@leoparente leoparente self-assigned this May 1, 2025
Copy link

github-actions bot commented May 1, 2025

Go test coverage

STATUS ELAPSED PACKAGE COVER PASS FAIL SKIP
🟢 PASS 0.24s github.com/netboxlabs/orb-agent/agent 0.0% 0 0 0
🟢 PASS 0.24s github.com/netboxlabs/orb-agent/agent/backend 0.0% 0 0 0
🟢 PASS 4.03s github.com/netboxlabs/orb-agent/agent/backend/devicediscovery 76.5% 2 0 0
🟢 PASS 0.01s github.com/netboxlabs/orb-agent/agent/backend/mocks 0.0% 0 0 0
🟢 PASS 4.03s github.com/netboxlabs/orb-agent/agent/backend/networkdiscovery 76.3% 2 0 0
🟢 PASS 4.02s github.com/netboxlabs/orb-agent/agent/backend/otel 76.4% 2 0 0
🟢 PASS 3.02s github.com/netboxlabs/orb-agent/agent/backend/pktvisor 65.6% 2 0 0
🟢 PASS 4.03s github.com/netboxlabs/orb-agent/agent/backend/worker 72.8% 2 0 0
🟢 PASS 1.01s github.com/netboxlabs/orb-agent/agent/config 100.0% 6 0 0
🟢 PASS 1.05s github.com/netboxlabs/orb-agent/agent/configmgr 49.4% 9 0 0
🟢 PASS 1.01s github.com/netboxlabs/orb-agent/agent/policies 100.0% 15 0 0
🟢 PASS 1.02s github.com/netboxlabs/orb-agent/agent/policymgr 70.3% 10 0 0
🟢 PASS 2.49s github.com/netboxlabs/orb-agent/agent/secretsmgr 45.7% 45 0 0
🟢 PASS 1.01s github.com/netboxlabs/orb-agent/agent/version 100.0% 1 0 0

Total coverage: 59.7%

Copy link
Contributor

@jajeffries jajeffries left a comment

Choose a reason for hiding this comment

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

Looks good!

@leoparente leoparente merged commit a654a6f into develop May 6, 2025
5 checks passed
@leoparente leoparente deleted the feat/OBS-579-metrics-support branch May 6, 2025 14:11
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.

2 participants