Skip to content

[disk] Add include_all_devices option and improve error logs#7378

Merged
mx-psi merged 8 commits intomasterfrom
mx-psi/disk-warning
Aug 21, 2020
Merged

[disk] Add include_all_devices option and improve error logs#7378
mx-psi merged 8 commits intomasterfrom
mx-psi/disk-warning

Conversation

@mx-psi
Copy link
Copy Markdown
Member

@mx-psi mx-psi commented Aug 17, 2020

What does this PR do?

  • Add option to exclude non-physical devices.
  • Improve logging about failing devices and nudge users towards using the settings to disable them if needed.
  • Remove debug log which was consistently confusing to support engineers.

Motivation

  • Address common pain points of users of the check and support engineers.

Additional Notes

  • See all argument for disk_partitions.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • PR title must be written as a CHANGELOG entry (see why)
  • Files changes must correspond to the primary purpose of the PR as described in the title (small unrelated changes should have their own PR)
  • PR must have changelog/ and integration/ labels attached

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 17, 2020

@mx-psi mx-psi force-pushed the mx-psi/disk-warning branch from dc85436 to 5c679fe Compare August 17, 2020 11:06
@mx-psi mx-psi force-pushed the mx-psi/disk-warning branch 2 times, most recently from 79b1843 to 53a6257 Compare August 17, 2020 14:46
@mx-psi mx-psi force-pushed the mx-psi/disk-warning branch from 53a6257 to ef53636 Compare August 17, 2020 15:13
@mx-psi mx-psi marked this pull request as ready for review August 17, 2020 15:27
@mx-psi mx-psi requested review from a team as code owners August 17, 2020 15:27
Comment thread disk/datadog_checks/disk/disk.py Outdated
mx-psi added 3 commits August 18, 2020 12:09
It makes no sense to use  `file_system_whitelist` in the way previously
mentioned, if users want to have more fine grained control they can just
specify the lists themselves
@mx-psi mx-psi requested a review from KSerrania August 18, 2020 10:50
KSerrania
KSerrania previously approved these changes Aug 18, 2020
Copy link
Copy Markdown
Contributor

@KSerrania KSerrania left a comment

Choose a reason for hiding this comment

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

LGTM, I see that an empty disk/log/.lock file got added, which can probably be removed.

KSerrania
KSerrania previously approved these changes Aug 18, 2020
Comment thread disk/assets/configuration/spec.yaml Outdated
This does the same that this PR intended but supporting all operating systems
and by checking (on Linux) if the file system is backed by a block device.
@mx-psi mx-psi requested a review from KSerrania August 19, 2020 14:27
KSerrania
KSerrania previously approved these changes Aug 19, 2020
Copy link
Copy Markdown
Contributor

@KSerrania KSerrania left a comment

Choose a reason for hiding this comment

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

LGTM, left a comment about the check documentation.

# - /dev/sde
# - '[FJ]:'

## @param include_all_devices - boolean - optional - default: True
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.

Why is there an uppercase T in True here, whereas it's lowercase in the spec & in all other config options?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

🤔 I am not sure why, the conf.yaml.default file is generated automatically by ddev validate config -s using the spec.yaml file.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's how the config validator works since I added both a default and an example value:

if 'default' in value:
default = value['default']
if default is not None:
if type(default) is str:
writer.write(' - default: ', default)
else:
writer.write(' - default: ', repr(default))
else:
if example_type is bool:
writer.write(' - default: ', 'true' if example else 'false')

It prints the repr of the object (which is True since that's how it is written in Python) instead of true or false, which it does when there is no default config.

I am going to change it though, since it seems like elsewhere the example and default values always match and it can be confusing.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I opened #7405 to make the behavior consistent.

@mx-psi mx-psi changed the title [disk] Improve excluded devices messages and defaults [disk] Add include_all_devices option and improve error logs Aug 20, 2020
This way it is more consistent with the rest of options
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