Skip to content

A small nitpick and a redundant method call in func parseStat() #845

Description

@vak-rashu

A small nitpick:

At line 181, https://github.com/prometheus/procfs/blob/master/stat.go#L181, the comment is passed as:
// parseStat parses the metrics from /proc/[pid]/stat.

however, parseStat parses the system-wide /proc/stat file rather than /proc/[pid]/stat, so the comment appears to be inaccurate.

Repetitive method calling:
In the same function:

buf := make([]byte, 0, 8*1024)
	scanner.Buffer(buf, 1024*1024)

	for scanner.Scan() {
		line := scanner.Text()
		parts := strings.Fields(scanner.Text())

(Line https://github.com/prometheus/procfs/blob/master/stat.go#L197)
Since line already contains the current scanner text, this could instead be:
parts := strings.Fields(line)

They both are very small issues but worth noting.

If accepted I would like to make a PR for these changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions