[Solved] TICKscript error: Missing value

Hello,

I am new to the TICK stack and still getting familiar with the DSL syntax / figuring out how it all works. I’m currently writing a simple stream script that…

  • Takes two key values from two different measurements and rewrites them (with a new name) into a new measurement
  • Creates a new key value based on a mathematical operation of the two measurements

I created a simple TICKscript to do this, referencing the JoinNode documentation as I went.

TICKscript

// Get inodes_total
var inodes_total = stream
    |from()
        .database(db)
        .retentionPolicy(rp)
        .measurement('container_fs_inodes_total')
        .where(lambda: "sr" == 'k8s')

// Get inodes_free
var inodes_free = stream
    |from()
        .database(db)
        .retentionPolicy(rp)
        .measurement('container_fs_inodes_free')
        .where(lambda: "sr" == 'k8s')

// Calculate difference, aggregate metrics
inodes_total
    |join(inodes_free)
        .as('inodes_total', 'inodes_free')
        .tolerance(1s)
        .fill('null')
    |eval(lambda: "inodes_total.gauge")
        .as('inodes_total')
    |eval(lambda: "inodes_free.gauge")
        .as('inodes_free')
    |eval(lambda: "inodes_total.gauge" - "inodes_free.gauge")
        .as('inodes_used')
    |influxDBOut()
        .database(db)
        .retentionPolicy(rp)
        .measurement('container_fs_inodes')
        .precision('s')

Problem

I’ve gone through a couple revisions of this script – the most success I had was with creating the new measurement with the new key value (from the mathematical operation). However, I was unable to rewrite the two existing key values from the two measurements into the new measurement.

To resolve this, I thought I would try creating an eval statement to reference the original key value and then rewrite into the new measurement. This last attempt is reflected in the TICKscript above. However, the error I get in my Influx shell is…

[task_name:eval6] 2017/07/19 23:39:21 E! missing value: "inodes_free.gauge"

Looking through this, I’m not sure where I’m going wrong or why the script isn’t able to read in the value (like it does when it performs the subtraction operation, which does work).

Does anyone know what the issue might be or why this is the case? Even if the script is wrong, I’m still curious to know why the value is unable to be read in when it does work when I use both of the values together. I am pretty new to all of this and working with time-series databases in general, so I hope this isn’t too dumb of a question, but I’m totally stuck!

Thanks!

The eval node by default drops all fields except for the new computed fields. This means that after the first eval node the only field on the data is the inodes_total field. Use EvalNode | InfluxData Documentation Archive to keep all or a certain list of fields.

Or even better the eval node can perform multiple operations at once so you could do something like this:


// Calculate difference, aggregate metrics
inodes_total
    |join(inodes_free)
        .as('inodes_total', 'inodes_free')
        .tolerance(1s)
        .fill('null')
    |eval(
        lambda: "inodes_total.gauge",
        lambda: "inodes_free.gauge",
        lambda: "inodes_total.gauge" - "inodes_free.gauge",
)
        .as('inodes_total', 'inodes_free', 'inodes_used')
    |influxDBOut()
        .database(db)
        .retentionPolicy(rp)
        .measurement('container_fs_inodes')
        .precision('s')
1 Like

That makes a lot more sense then. Didn’t know that data was dropped after evaluation and that there is a Keep node. Nice! Makes a lot more sense knowing this now.

Yeah, this is the most simple way of doing it! Also didn’t know you could do multiple operations in one eval node. Just tested it out and it worked like a charm in my environment. Thanks so much!