Skip to content

feat(inputs.system): Add operating-system information#18834

Merged
skartikey merged 13 commits into
influxdata:masterfrom
bilkoua:master
May 7, 2026
Merged

feat(inputs.system): Add operating-system information#18834
skartikey merged 13 commits into
influxdata:masterfrom
bilkoua:master

Conversation

@bilkoua
Copy link
Copy Markdown
Contributor

@bilkoua bilkoua commented May 4, 2026

Summary

This is the second step of the plan agreed in #18533: add an os value
to the include option of inputs.system that emits a separate
system_os measurement with operating system release and uname
information.

The data is gathered through gopsutil for cross-platform support and
is read with the granular host.PlatformInformation(),
host.KernelVersion() and host.KernelArch() calls instead of
host.Info() to avoid unrelated probes for virtualization, boot time
and process counts.

The result is cached for os_cache_ttl (default 5m) between gathers
since these values are effectively static at runtime; setting
os_cache_ttl = "0s" keeps the cache for the lifetime of the
process, while a tiny positive value such as "1ns" effectively
disables the cache and forces a fresh read on every gather. The TTL
handling matches the convention used by inputs.sqlserver,
inputs.logql, inputs.promql, outputs.iotdb and
outputs.parquet where a zero duration disables the time bound.

Fields emitted by the system_os measurement

Field Type Source
os string runtime.GOOS
platform string /etc/os-release etc.
platform_family string /etc/os-release etc.
platform_version string /etc/os-release etc.
kernel_version string uname -r
kernel_arch string uname -m

On platforms where gopsutil cannot provide a particular value (e.g.
parts of FreeBSD/OpenBSD/Solaris) the corresponding field is left
empty; if no field can be gathered the metric is skipped entirely.

Backward compatibility

The default include set is unchanged, so existing deployments keep
emitting only the system measurement and do not see the new
system_os metric until they opt in.

Example output

system_os,host=worker-01 os="linux",platform="ubuntu",platform_family="debian",platform_version="26.04",kernel_version="7.0.0-7-generic",kernel_arch="x86_64" 1748000000000000000

Checklist

@telegraf-tiger telegraf-tiger Bot added area/system feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels May 4, 2026
@bilkoua
Copy link
Copy Markdown
Contributor Author

bilkoua commented May 4, 2026

@skartikey @srebhan @Hipska Hi, could you take a look at this PR when you have a moment?

Copy link
Copy Markdown
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Thanks @bilkoua for the follow-up PR! Please find my comments below...

Comment thread plugins/inputs/system/README.md Outdated
Comment thread plugins/inputs/system/system.go Outdated
Comment thread plugins/inputs/system/system.go Outdated
Comment thread plugins/inputs/system/system.go Outdated
Comment thread plugins/inputs/system/system.go Outdated
Comment thread plugins/inputs/system/system_os_linux_test.go Outdated
Comment thread plugins/inputs/system/system_os_linux_test.go Outdated
Comment thread plugins/inputs/system/system_os_linux_test.go Outdated
Comment thread plugins/inputs/system/system_os_linux_test.go Outdated
Comment thread plugins/inputs/system/system_os_other_test.go Outdated
@srebhan srebhan changed the title feat(inputs.system): Add 'os' include group with platform and kernel information feat(inputs.system): Add operating-system information May 4, 2026
@srebhan srebhan self-assigned this May 4, 2026
bilkoua and others added 2 commits May 5, 2026 10:31
Co-authored-by: Sven Rebhan <36194019+srebhan@users.noreply.github.com>
@bilkoua
Copy link
Copy Markdown
Contributor Author

bilkoua commented May 5, 2026

@srebhan @Hipska Thanks for the review!
Could you take another look?

Copy link
Copy Markdown
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Thanks @bilkoua! Some minor comments...

Comment thread plugins/inputs/system/system.go Outdated
Comment thread plugins/inputs/system/system.go Outdated
Comment thread plugins/inputs/system/system_os_linux_test.go Outdated
bilkoua and others added 4 commits May 5, 2026 18:32
Co-authored-by: Sven Rebhan <36194019+srebhan@users.noreply.github.com>
Co-authored-by: Sven Rebhan <36194019+srebhan@users.noreply.github.com>
Copy link
Copy Markdown
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

One more thing I noticed. Sorry for the initial noise. :-(

Comment thread plugins/inputs/system/system.go Outdated
Copy link
Copy Markdown
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Thanks a lot @bilkoua!

@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label May 6, 2026
@srebhan srebhan assigned skartikey and unassigned srebhan May 6, 2026
Copy link
Copy Markdown
Contributor

@skartikey skartikey left a comment

Choose a reason for hiding this comment

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

@bilkoua Thanks! A couple of comments to look at.

Comment thread plugins/inputs/system/system_test.go Outdated
Comment thread plugins/inputs/system/README.md Outdated
@telegraf-tiger
Copy link
Copy Markdown
Contributor

telegraf-tiger Bot commented May 7, 2026

@bilkoua
Copy link
Copy Markdown
Contributor Author

bilkoua commented May 7, 2026

@skartikey Thanks for the review!

Addressed both comments. Not 100% sure the test approach is exactly what you had in mind. I went with IgnoreFields for arch/kernel_version (uname-based, host-dependent) and assert them non-empty separately, while the os-release-parsed values are compared literally. Similar pattern is used in inputs.statsd and inputs.sip.
Could you take another look?

Copy link
Copy Markdown
Contributor

@skartikey skartikey left a comment

Choose a reason for hiding this comment

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

@bilkoua Thanks for the contribution!

@skartikey
Copy link
Copy Markdown
Contributor

@skartikey Thanks for the review!

Addressed both comments. Not 100% sure the test approach is exactly what you had in mind. I went with IgnoreFields for arch/kernel_version (uname-based, host-dependent) and assert them non-empty separately, while the os-release-parsed values are compared literally. Similar pattern is used in inputs.statsd and inputs.sip. Could you take another look?

That works for me. The os-release-parsed values are now actually verified, which was the main concern, and the separate non-empty checks for arch/kernel_version cover the host-dependent fields. Thanks for the quick turnaround. Approved.

@skartikey skartikey merged commit 285d130 into influxdata:master May 7, 2026
27 checks passed
@github-actions github-actions Bot added this to the v1.39.0 milestone May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/system feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants