Skip to content

Conversation

@ajanikow
Copy link
Collaborator

No description provided.

@cursor
Copy link

cursor bot commented Oct 30, 2025

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on November 28.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@cla-bot cla-bot bot added the cla-signed label Oct 30, 2025
@ajanikow ajanikow requested a review from Copilot October 30, 2025 14:49
Copy link

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 PR adds the ability for users to opt out of telemetry collection when generating license inventories. A new --telemetry flag is introduced (enabled by default) that allows users to control whether telemetry data is collected during inventory operations.

  • Added a new --telemetry flag to the license inventory and activate commands
  • Introduced a Configuration struct to pass telemetry settings through the inventory fetching pipeline
  • Refactored AQL execution functions to support telemetry-conditional execution

Reviewed Changes

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

Show a summary per file
File Description
pkg/platform/flags.go Defines the new flagTelemetry boolean flag with default value true
pkg/platform/license_inventory.go Registers the telemetry flag for the inventory command
pkg/platform/license_activate.go Registers the telemetry flag for the activate command
pkg/platform/license.go Reads the telemetry flag value and passes it through the configuration
pkg/platform/inventory/configuration.go New file defining the Configuration struct with telemetry settings
pkg/platform/inventory/inventory.go Updates function signatures to accept and propagate the Configuration
pkg/platform/inventory/aql.go Refactors AQL execution to support telemetry-conditional logic
pkg/platform/inventory/fetcher.*.go Updates fetcher function signatures to accept Configuration parameter
docs/cli/arangodb_operator_platform.md Documents the new telemetry flag in CLI documentation
CHANGELOG.md Records the new feature addition

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


var cfg inventory.Configuration

if v, err := flagTelemetry.Get(cmd); !v || err != nil {
Copy link

Copilot AI Oct 30, 2025

Choose a reason for hiding this comment

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

The logic incorrectly sets telemetry to false when the flag value is true OR when there's an error. The condition !v || err != nil means telemetry will be disabled if the flag is true (since !true evaluates to false, but the intent seems inverted). Additionally, if there's an error reading the flag, it silently defaults to disabled. The correct logic should be if err != nil || !v { cfg.Telemetry = util.NewType(false) } to handle the error case first and then check if telemetry is explicitly disabled.

Suggested change
if v, err := flagTelemetry.Get(cmd); !v || err != nil {
if v, err := flagTelemetry.Get(cmd); err != nil || !v {

Copilot uses AI. Check for mistakes.
log.Info("Telemetry disabled")
return nil
} else {
log.Info("Collecting Telemetry details")
Copy link

Copilot AI Oct 30, 2025

Choose a reason for hiding this comment

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

The log message 'Collecting Telemetry details' is misleading because it's shown for all AQL queries, not just telemetry-related ones. When telemetry=false (for basic AQL queries), this message still appears. Consider moving the logging inside the conditional branches or making the message more accurate, e.g., 'Executing AQL query' for non-telemetry queries.

Suggested change
log.Info("Collecting Telemetry details")
if telemetry {
log.Info("Collecting Telemetry details")
} else {
log.Info("Executing AQL query")
}

Copilot uses AI. Check for mistakes.
@ajanikow ajanikow requested a review from Copilot October 31, 2025 09:19
Copy link

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

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


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

Comment on lines +78 to +80
if v, err := flagTelemetry.Get(cmd); err != nil || !v {
cfg.Telemetry = util.NewType(false)
}
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

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

The logic for setting cfg.Telemetry is inverted and unclear. When telemetry is enabled (v == true), the field remains nil, but when disabled (!v) or on error, it's explicitly set to false. This makes the nil state ambiguous. Consider always setting the value explicitly: cfg.Telemetry = util.NewType(v) when no error occurs, or handle the error case separately.

Suggested change
if v, err := flagTelemetry.Get(cmd); err != nil || !v {
cfg.Telemetry = util.NewType(false)
}
v, err := flagTelemetry.Get(cmd)
if err != nil {
return nil, err
}
cfg.Telemetry = util.NewType(v)

Copilot uses AI. Check for mistakes.
Comment on lines +27 to +32
func (c *Configuration) WithTelemetry() bool {
if c == nil || c.Telemetry == nil {
return true
}
return *c.Telemetry
}
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

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

The WithTelemetry method lacks a docstring explaining that it returns true by default when configuration is nil or telemetry is unset. This default behavior is important for understanding the opt-out nature of the feature and should be documented.

Copilot uses AI. Check for mistakes.
@ajanikow ajanikow merged commit 9106a3f into master Oct 31, 2025
8 of 9 checks passed
@ajanikow ajanikow deleted the feature/platform/inventory_telemetry_optout branch October 31, 2025 09:40
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