Skip to content
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

APP-6990 consume debug level from cloud config #50

Merged
merged 3 commits into from
Dec 4, 2024
Merged

Conversation

abe-winter
Copy link
Member

What changed

  • consume debug field from cloud config, instead of only from CLI switch

Why

It's difficult to set this currently.

Notes

Where is the right place for this? I put it in the attributes for the viam-agent subsystem, but the map[string]DeviceSubsystemConfig approach seems less ergonomic post unification.

Manual test

With debug set to true:

2024-12-04T08:51:22.774Z INFO viam-agent viamserver/viamserver.go:183 viam-server started
2024-12-04T08:51:22.774Z DEBUG viam-agent agent/manager.go:277 starting background checks
2024-12-04T08:51:22.774Z DEBUG viam-agent agent/manager.go:185 Checking cloud for update
2024-12-04T08:51:22.882Z INFO rdk.package_manager packages/deferred_package_manager.go:143 cloud package manager created asyncronously

With debug set to false (second restart):

2024-12-04T08:51:28.572Z INFO viam-agent viamserver/viamserver.go:183 viam-server started
2024-12-04T08:51:28.654Z INFO rdk.package_manager packages/deferred_package_manager.go:143 cloud package manager created asyncronously

Sample config

{
  "agent": {
    "viam-agent": {
      "attributes": {"debug": true}
    }
}

@abe-winter abe-winter marked this pull request as ready for review December 4, 2024 16:38
Copy link
Member

@ale7714 ale7714 left a comment

Choose a reason for hiding this comment

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

the logs around provisioning/network management will also be affected by this?

I think so bc we have globalLogger but making sure

manager.go Outdated Show resolved Hide resolved
@abe-winter
Copy link
Member Author

the logs around provisioning/network management will also be affected by this?

yup, they showed up in my test:

2024-12-04T08:51:20.968Z DEBUG viam-agent provisioning/provisioning.go:73 Provisioning Config: &{Manufacturer:viam Model:custom FragmentID: HotspotInterface: HotspotPrefix:**** HotspotPassword:**** DisableDNSRedirect:false OfflineTimeout:120000000000 UserTimeout:300000000000 FallbackTimeout:600000000000 RoamingMode:false Networks:[] hotspotSSID: WifiPowerSave:}

@abe-winter
Copy link
Member Author

abe-winter commented Dec 4, 2024

(unless something is copying globalLogger before it sets debug, but it looks from grepping like this isn't happening)

Copy link
Member

@Otterverse Otterverse left a comment

Choose a reason for hiding this comment

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

One small nit, but otherwise looks fine!

manager.go Show resolved Hide resolved
manager.go Outdated Show resolved Hide resolved
@abe-winter abe-winter merged commit ed72f69 into main Dec 4, 2024
2 checks passed
@abe-winter abe-winter deleted the aw-debug-config branch December 4, 2024 19:50
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