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

Fetch stats from folder mounted volumes #1534

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dloucasfx
Copy link

This fixes #1245 and open-telemetry/opentelemetry-collector-contrib#27203

The test from OpenTelemetry

Steps to reproduce

  • Add a new disk to a windows VM
  • from Disk Management tool, right-click the new volume, and select Change drive letter and paths.
  • From there, add “Mount in the following empty NTFS folder” and select an empty dir on the C:\ drive and make sure there is NO assigned drive letter

Before the fix:

Resource SchemaURL: https://opentelemetry.io/schemas/1.9.0
Resource attributes:
     -> host.name: Str(wintestswatsplunk)
     -> os.type: Str(windows)
     -> cloud.provider: Str(azure)
     -> cloud.platform: Str(azure_vm)
     -> cloud.region: Str(eastus)
     -> host.id: Str(09f0d80d-d5a7-4082-953a-bfd10cb77cbf)
     -> cloud.account.id: Str(5db89e2c-2127-4418-9a31-dac67b04e87b)
     -> azure.vm.name: Str(win2016-swat-2021)
     -> azure.vm.size: Str(Standard_D2as_v4)
     -> azure.vm.scaleset.name: Str()
     -> azure.resourcegroup.name: Str(win2016-swat)
ScopeMetrics #0
ScopeMetrics SchemaURL:
InstrumentationScope otelcol/hostmetricsreceiver/filesystem 0.85.0-dev
Metric #0
Descriptor:
     -> Name: system.filesystem.usage
     -> Description: Filesystem bytes used.
     -> Unit: By
     -> DataType: Sum
     -> IsMonotonic: false
     -> AggregationTemporality: Cumulative
NumberDataPoints #0
Data point attributes:
     -> device: Str(C:)
     -> mode: Str(rw)
     -> mountpoint: Str(C:)
     -> type: Str(NTFS)
     -> state: Str(used)
StartTimestamp: 2023-09-26 14:11:00 +0000 UTC
Timestamp: 2023-10-03 21:22:58.5265249 +0000 UTC
Value: 19619004416
NumberDataPoints #1
Data point attributes:
     -> device: Str(C:)
     -> mode: Str(rw)
     -> mountpoint: Str(C:)
     -> type: Str(NTFS)
     -> state: Str(free)
StartTimestamp: 2023-09-26 14:11:00 +0000 UTC
Timestamp: 2023-10-03 21:22:58.5265249 +0000 UTC
Value: 116220866560
NumberDataPoints #2
Data point attributes:
     -> device: Str(D:)
     -> mode: Str(rw)
     -> mountpoint: Str(D:)
     -> type: Str(NTFS)
     -> state: Str(used)
StartTimestamp: 2023-09-26 14:11:00 +0000 UTC
Timestamp: 2023-10-03 21:22:58.5265249 +0000 UTC
Value: 1418309632
NumberDataPoints #3
Data point attributes:
     -> device: Str(D:)
     -> mode: Str(rw)
     -> mountpoint: Str(D:)
     -> type: Str(NTFS)
     -> state: Str(free)
StartTimestamp: 2023-09-26 14:11:00 +0000 UTC
Timestamp: 2023-10-03 21:22:58.5265249 +0000 UTC
Value: 15759458304

With the fix, notice the folder mounted volumes stats C:\mount4 :

2023-10-03T21:14:24.922Z        info    ResourceMetrics #0
Resource SchemaURL: https://opentelemetry.io/schemas/1.9.0
Resource attributes:
     -> host.name: Str(wintestswatsplunk)
     -> os.type: Str(windows)
     -> cloud.provider: Str(azure)
     -> cloud.platform: Str(azure_vm)
     -> cloud.region: Str(eastus)
     -> host.id: Str(09f0d80d-d5a7-4082-953a-bfd10cb77cbf)
     -> cloud.account.id: Str(5db89e2c-2127-4418-9a31-dac67b04e87b)
     -> azure.vm.name: Str(win2016-swat-2021)
     -> azure.vm.size: Str(Standard_D2as_v4)
     -> azure.vm.scaleset.name: Str()
     -> azure.resourcegroup.name: Str(win2016-swat)
ScopeMetrics #0
ScopeMetrics SchemaURL:
InstrumentationScope otelcol/hostmetricsreceiver/filesystem 0.85.0-dev
Metric #0
Descriptor:
     -> Name: system.filesystem.usage
     -> Description: Filesystem bytes used.
     -> Unit: By
     -> DataType: Sum
     -> IsMonotonic: false
     -> AggregationTemporality: Cumulative
NumberDataPoints #0
Data point attributes:
     -> device: Str(D:)
     -> mode: Str(rw)
     -> mountpoint: Str(D:)
     -> type: Str(NTFS)
     -> state: Str(used)
StartTimestamp: 2023-09-26 14:11:00 +0000 UTC
Timestamp: 2023-10-03 21:14:24.795121 +0000 UTC
Value: 1418309632
NumberDataPoints #1
Data point attributes:
     -> device: Str(D:)
     -> mode: Str(rw)
     -> mountpoint: Str(D:)
     -> type: Str(NTFS)
     -> state: Str(free)
StartTimestamp: 2023-09-26 14:11:00 +0000 UTC
Timestamp: 2023-10-03 21:14:24.795121 +0000 UTC
Value: 15759458304
NumberDataPoints #2
Data point attributes:
     -> device: Str(C:\mount4)
     -> mode: Str(rw)
     -> mountpoint: Str(C:\mount4)
     -> type: Str(NTFS)
     -> state: Str(used)
StartTimestamp: 2023-09-26 14:11:00 +0000 UTC
Timestamp: 2023-10-03 21:14:24.795121 +0000 UTC
Value: 189624320
NumberDataPoints #3
Data point attributes:
     -> device: Str(C:\mount4)
     -> mode: Str(rw)
     -> mountpoint: Str(C:\mount4)
     -> type: Str(NTFS)
     -> state: Str(free)
StartTimestamp: 2023-09-26 14:11:00 +0000 UTC
Timestamp: 2023-10-03 21:14:24.795121 +0000 UTC
Value: 4102193152
NumberDataPoints #4
Data point attributes:
     -> device: Str(C:)
     -> mode: Str(rw)
     -> mountpoint: Str(C:)
     -> type: Str(NTFS)
     -> state: Str(used)
StartTimestamp: 2023-09-26 14:11:00 +0000 UTC
Timestamp: 2023-10-03 21:14:24.795121 +0000 UTC
Value: 19642892288
NumberDataPoints #5
Data point attributes:
     -> device: Str(C:)
     -> mode: Str(rw)
     -> mountpoint: Str(C:)
     -> type: Str(NTFS)
     -> state: Str(free)
StartTimestamp: 2023-09-26 14:11:00 +0000 UTC
Timestamp: 2023-10-03 21:14:24.795121 +0000 UTC
Value: 116196978688
        {"kind": "exporter", "data_type": "metrics", "name": "logging"}

Copy link
Owner

@shirou shirou left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution and resolving this long remaining issue.

Could you rebase to latest master branch to solve the macOS test on GitHub (#1532)? And also, could you give us more simple test code, which does not use collector?

disk/disk_windows.go Outdated Show resolved Hide resolved
disk/disk_windows.go Outdated Show resolved Hide resolved
Signed-off-by: Dani Louca <dlouca@splunk.com>
Signed-off-by: Dani Louca <dlouca@splunk.com>
@dloucasfx
Copy link
Author

Updated the PR with the requested changes

@atoulme
Copy link
Contributor

atoulme commented Jan 26, 2024

@shirou would you please take a look?

Copy link
Owner

@shirou shirou left a comment

Choose a reason for hiding this comment

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

I don't have a much Windows knowledge, but when I run this PR, it seems that my SMB mounted folder(Z:) has disappeared because getVolumePaths() returns empty. Could you try this PR with an SMB mounted folder(s) in your environment?

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.

Add support for folder mounted Windows disks
4 participants