Skip to content

fix: Skip extra header columns in iostat parsing#4676

Open
InoMurko wants to merge 4 commits into
OffchainLabs:masterfrom
InoMurko:patch-1
Open

fix: Skip extra header columns in iostat parsing#4676
InoMurko wants to merge 4 commits into
OffchainLabs:masterfrom
InoMurko:patch-1

Conversation

@InoMurko
Copy link
Copy Markdown

Skip parsing when a stats row has fewer fields than the last Device header row.

It breaks when i >= len(data), i.e. when this data row has fewer whitespace-separated fields than the header has columns (or than we’ve consumed so far).

{
        "@timestamp": "2026-04-25 16:36:53.602",
        "@message": {
            "time": "2026-04-25T16:36:53.602931801Z",
            "stream": "stderr",
            "_p": "F",
            "log": "panic: runtime error: index out of range [7] with length 7",
            "kubernetes": {
                "pod_name": "sequencer-00-6bb98c996d-9npgf",
                "container_name": "nitro-sequencer-00"
            }
        },
        "kubernetes.pod_name": "sequencer-00-6bb98c996d-9npgf"
    },
    {
        "@timestamp": "2026-04-25 16:36:53.635",
        "@message": {
            "time": "2026-04-25T16:36:53.635989261Z",
            "stream": "stderr",
            "_p": "F",
            "log": "",
            "kubernetes": {
                "pod_name": "sequencer-00-6bb98c996d-9npgf",
                "container_name": "nitro-sequencer-00"
            }
        },
        "kubernetes.pod_name": "sequencer-00-6bb98c996d-9npgf"
    },
    {
        "@timestamp": "2026-04-25 16:36:53.636",
        "@message": {
            "time": "2026-04-25T16:36:53.636010651Z",
            "stream": "stderr",
            "_p": "F",
            "log": "goroutine 68 [running]:",
            "kubernetes": {
                "pod_name": "sequencer-00-6bb98c996d-9npgf",
                "container_name": "nitro-sequencer-00"
            }
        },
        "kubernetes.pod_name": "sequencer-00-6bb98c996d-9npgf"
    },
    {
        "@timestamp": "2026-04-25 16:36:53.695",
        "@message": {
            "time": "2026-04-25T16:36:53.695956669Z",
            "stream": "stderr",
            "_p": "F",
            "log": "github.com/offchainlabs/nitro/util/iostat.Run({0x373bce8, 0xc0005595e0}, 0x162e9a5?, 0xc0000a4f50)",
            "kubernetes": {
                "pod_name": "sequencer-00-6bb98c996d-9npgf",
                "container_name": "nitro-sequencer-00"
            }
        },
        "kubernetes.pod_name": "sequencer-00-6bb98c996d-9npgf"
    },
    {
        "@timestamp": "2026-04-25 16:36:53.696",
        "@message": {
            "time": "2026-04-25T16:36:53.696583445Z",
            "stream": "stderr",
            "_p": "F",
            "log": "\t/workspace/util/iostat/iostat.go:91 +0xa06",
            "kubernetes": {
                "pod_name": "sequencer-00-6bb98c996d-9npgf",
                "container_name": "nitro-sequencer-00"
            }
        },
        "kubernetes.pod_name": "sequencer-00-6bb98c996d-9npgf"
    },
    {
        "@timestamp": "2026-04-25 16:36:53.733",
        "@message": {
            "time": "2026-04-25T16:36:53.733730975Z",
            "stream": "stderr",
            "_p": "F",
            "log": "created by github.com/offchainlabs/nitro/util/iostat.RegisterAndPopulateMetrics in goroutine 59",
            "kubernetes": {
                "pod_name": "sequencer-00-6bb98c996d-9npgf",
                "container_name": "nitro-sequencer-00"
            }
        },
        "kubernetes.pod_name": "sequencer-00-6bb98c996d-9npgf"
    },
    {
        "@timestamp": "2026-04-25 16:36:53.733",
        "@message": {
            "time": "2026-04-25T16:36:53.733827792Z",
            "stream": "stderr",
            "_p": "F",
            "log": "\t/workspace/util/iostat/iostat.go:23 +0x12c",
            "kubernetes": {
                "pod_name": "sequencer-00-6bb98c996d-9npgf",
                "container_name": "nitro-sequencer-00"
            }
        },
        "kubernetes.pod_name": "sequencer-00-6bb98c996d-9npgf"
    },

Handle cases where header has extra columns in iostat.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 27, 2026

CLA assistant check
All committers have signed the CLA.

@bragaigor bragaigor self-assigned this May 6, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 6, 2026

Codecov Report

❌ Patch coverage is 0% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 34.37%. Comparing base (6dce8d1) to head (c45da41).

❗ There is a different number of reports uploaded between BASE (6dce8d1) and HEAD (c45da41). Click for more details.

HEAD has 29 uploads less than BASE
Flag BASE (6dce8d1) HEAD (c45da41)
36 7
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #4676       +/-   ##
===========================================
- Coverage   52.38%   34.37%   -18.02%     
===========================================
  Files         506      506               
  Lines       73739    60420    -13319     
===========================================
- Hits        38630    20767    -17863     
- Misses      29951    35950     +5999     
+ Partials     5158     3703     -1455     

Copy link
Copy Markdown
Contributor

@bragaigor bragaigor left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! Left a few comments to make it even more robust. Please let me know if you have any questions or need help with any of it. Ah you're also missing a changelog file :)

Comment thread util/iostat/iostat.go
Comment thread util/iostat/iostat.go
Comment thread util/iostat/iostat.go Outdated
InoMurko and others added 2 commits May 8, 2026 13:33
Co-authored-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@bragaigor bragaigor left a comment

Choose a reason for hiding this comment

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

It's looking great! Just a nitpick whitespace suggestion and you're missing a changelog file. You can base that off this one:

### Fixed
- Re-enable erc20 test

where the bullet point becomes Skip extra header columns in iostat parsing

Comment thread util/iostat/iostat_test.go Outdated
Comment thread util/iostat/iostat_test.go Outdated
Comment thread util/iostat/iostat_test.go Outdated
@InoMurko
Copy link
Copy Markdown
Author

InoMurko commented May 8, 2026

It's looking great! Just a nitpick whitespace suggestion and you're missing a changelog file. You can base that off this one:

### Fixed
- Re-enable erc20 test

where the bullet point becomes Skip extra header columns in iostat parsing

Thanks @bragaigor. Didn't notice the bad indentation at all! Also, added the changelog file - I don't have a issue ticket so I kept it short in the filename. Hope that's ok.

@InoMurko InoMurko requested a review from bragaigor May 8, 2026 12:27
Copy link
Copy Markdown
Contributor

@bragaigor bragaigor left a comment

Choose a reason for hiding this comment

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

Thanks for the fix and for iterating on the comments, much appreciated. The PR looks great from my side.

Quick heads-up: We recently changed our internal process around merging PRs, so this may take a bit longer than usual to land. Please bear with us, and thanks again for the contribution!

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