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

It seems like flat is too eager to make arrays. #6

Closed
kvz opened this Issue Feb 16, 2014 · 2 comments

Comments

Projects
None yet
2 participants
@kvz
Copy link
Contributor

kvz commented Feb 16, 2014

Hi, first of all thanks a lot for making flat, it's exactly what I was looking for.

I think I might have found an issue. When being passed this object:

{ filename: '/Users/kevin/metriks/rrds/nslookup/kvz-imac-home-4.local-nslookup.rrd',
     rrd_version: '0003',
     step: 300,
     last_update: 1392592863,
     header_size: 1832,
     'ds.8_8_8_8.index': 0,
     'ds.8_8_8_8.type': 'GAUGE',
     'ds.8_8_8_8.minimal_heartbeat': 600,
     'ds.8_8_8_8.min': 'NaN',
     'ds.8_8_8_8.max': 'NaN',
     'ds.8_8_8_8.last_ds': '19',
     'ds.8_8_8_8.value': 209,
     'ds.8_8_8_8.unknown_sec': 52,
     'ds.8_8_4_4.index': 1,
     'ds.8_8_4_4.type': 'GAUGE',
     'ds.8_8_4_4.minimal_heartbeat': 600,
     'ds.8_8_4_4.min': 'NaN',
     'ds.8_8_4_4.max': 'NaN',
     'ds.8_8_4_4.last_ds': '20',
     'ds.8_8_4_4.value': 220,
     'ds.8_8_4_4.unknown_sec': 52,
     'ds.4_2_2_2.index': 2,
     'ds.4_2_2_2.type': 'GAUGE',
     'ds.4_2_2_2.minimal_heartbeat': 600,
     'ds.4_2_2_2.min': 'NaN',
     'ds.4_2_2_2.max': 'NaN',
     'ds.4_2_2_2.last_ds': '122',
     'ds.4_2_2_2.value': 1342,
     'ds.4_2_2_2.unknown_sec': 52,
     'ds.208_67_222_222.index': 3,
     'ds.208_67_222_222.type': 'GAUGE',
     'ds.208_67_222_222.minimal_heartbeat': 600,
     'ds.208_67_222_222.min': 'NaN',
     'ds.208_67_222_222.max': 'NaN',
     'ds.208_67_222_222.last_ds': '18',
     'ds.208_67_222_222.value': 198,
     'ds.208_67_222_222.unknown_sec': 52,
     'ds.172_16_0_23.index': 4,
     'ds.172_16_0_23.type': 'GAUGE',
     'ds.172_16_0_23.minimal_heartbeat': 600,
     'ds.172_16_0_23.min': 'NaN',
     'ds.172_16_0_23.max': 'NaN',
     'ds.172_16_0_23.last_ds': '-1',
     'ds.172_16_0_23.value': -11,
     'ds.172_16_0_23.unknown_sec': 52,
     'rra.0.cf': 'AVERAGE',
     'rra.0.rows': 300,
     'rra.0.cur_row': 215,
     'rra.0.pdp_per_row': 1,
     'rra.0.xff': 0.5,
     'rra.0.cdp_prep.0.value': 'NaN',
     'rra.0.cdp_prep.0.unknown_datapoints': 0,
     'rra.0.cdp_prep.1.value': 'NaN',
     'rra.0.cdp_prep.1.unknown_datapoints': 0,
     'rra.0.cdp_prep.2.value': 'NaN',
     'rra.0.cdp_prep.2.unknown_datapoints': 0,
     'rra.0.cdp_prep.3.value': 'NaN',
     'rra.0.cdp_prep.3.unknown_datapoints': 0,
     'rra.0.cdp_prep.4.value': 'NaN',
     'rra.0.cdp_prep.4.unknown_datapoints': 0,
     '': '' }

The resulting unflattened structure looks like this:

{ filename: '/Users/kevin/metriks/rrds/nslookup/kvz-imac-home-4.local-nslookup.rrd',
     rrd_version: '0003',
     step: 300,
     last_update: 1392592863,
     header_size: 1832,
     ds:
      [ ,
        ,
        ,
        ,
        [Object],
        ,
        ,
        ,
        [Object],
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        [Object],
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        [Object] ],
     rra: [ [Object] ],
     '': '' }

My guess is that flat too eagerly tries to look for numbers in keys as it wants to forge arrays for those.

Let me know if I'm overlooking something.

Best,
Kevin

kvz added a commit to kvz/metriks that referenced this issue Feb 16, 2014

@hughsk hughsk closed this in cd2c9cb Feb 17, 2014

@hughsk

This comment has been minimized.

Copy link
Owner

hughsk commented Feb 17, 2014

Ah thanks, good catch @kvz! Glad to hear flat was useful for you – have fixed this issue, the new version should be available at 1.2.0 :)

kvz added a commit to kvz/metriks that referenced this issue Feb 17, 2014

@kvz

This comment has been minimized.

Copy link
Contributor Author

kvz commented Feb 17, 2014

Awesome, works as expected now. Thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.