Skip to content

CBG-5525: configure reporting interval for fleet manager#8456

Merged
gregns1 merged 5 commits into
mainfrom
CBG-5525
Jul 15, 2026
Merged

CBG-5525: configure reporting interval for fleet manager#8456
gregns1 merged 5 commits into
mainfrom
CBG-5525

Conversation

@gregns1

@gregns1 gregns1 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

CBG-5525

  • Align our reporting interval for fleet manager metrics to match what is configured on server for the collector
  • Have the reporting only send our metrics when it is enabled collector side
  • If we get a non 404 error for getting the settings we will default to our default report interval of 1 hour and enabled true
    • Our function sendFleetManagerMetrics is tolerant to 404 errors in any case
  • Some improved logging around this for when interval or enabled changes.

Pre-review checklist

  • Removed debug logging (fmt.Print, log.Print, ...)
  • Logging sensitive data? Make sure it's tagged (e.g. base.UD(docID), base.MD(dbName))
  • Updated relevant information in the API specifications (such as endpoint descriptions, schemas, ...) in docs/api

Dependencies (if applicable)

  • Link upstream PRs
  • Update Go module dependencies when merged

Integration Tests

Copilot AI review requested due to automatic review settings July 14, 2026 16:36
@gregns1 gregns1 self-assigned this Jul 14, 2026

Copilot AI left a comment

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.

Pull request overview

Updates Sync Gateway’s fleet manager metrics reporter to align its reporting behavior with Couchbase Server’s fleet manager collector settings, so metrics are only sent when the collector is enabled and at the server-configured interval.

Changes:

  • Add management-API settings fetch (/internal/settings/telemetry) and use it to gate reporting + drive the ticker interval (with safe defaults on transient failures).
  • Centralize telemetry endpoint/URI construction in base and add safe conversion from “hours” to time.Duration with overflow protection.
  • Move/expand fleet manager reporter tests into a dedicated test file and add unit tests for interval conversion.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
rest/server_context_test.go Removes fleet manager reporter-related tests from this larger test file.
rest/fleet_manager_reporter.go Implements collector settings fetch + enabled/interval-driven reporting loop; factors mgmt endpoint validation.
rest/fleet_manager_reporter_test.go Adds dedicated reporter tests for settings, ingest behavior, and RBAC scenario.
base/fleet_manager_collector.go Adds telemetry settings endpoint const, ingest URI builder, and settings interval conversion helper.
base/fleet_manager_collector_test.go Adds unit coverage for FleetManagerCollectorSettings.Interval() fallback/overflow behavior.

Comment thread rest/fleet_manager_reporter_test.go Outdated
Comment on lines +34 to +37
report := func(settings base.FleetManagerCollectorSettings) {
if !settings.Enabled {
return
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@gregns1 gregns1 requested a review from bbrks July 15, 2026 11:20
@gregns1 gregns1 assigned bbrks and unassigned gregns1 Jul 15, 2026

@bbrks bbrks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

one suggestion to avoid potential -race issues w/ test otherwise looks good

Comment thread rest/fleet_manager_reporter.go Outdated
@bbrks bbrks assigned gregns1 and unassigned bbrks Jul 15, 2026
@gregns1 gregns1 assigned bbrks and unassigned gregns1 Jul 15, 2026
@gregns1 gregns1 merged commit e1683ae into main Jul 15, 2026
67 of 68 checks passed
@gregns1 gregns1 deleted the CBG-5525 branch July 15, 2026 15:36
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