JOINing multiple streams

The documentation for the JoinNode says “Joins the data from any number of nodes,” but I’m stumped on how to join more than once. Wherever I put the a second join() method, I end up with missing values.

Are there any examples that show how to do this?

We have a measurement that includes values for execution time (duration) and a Boolean on whether it’s an error. We’re successfully creating a totalRecords variable with the total count, and joining that a total errors variable that gets the totalErrors, which we can then use to compute the rate. That works, but we also want to alert on whether the average response time exceeds a value. How would we join that in, too?

var data = stream
        |where(lambda: "api" == targetApi)
        |log().prefix('initial stream: ').level('DEBUG')
// Don't have a way to reference this...        
var totalDuration = data
		|log().prefix('totalDuration: ').level('DEBUG') 			

var totalRecords = data
        |log().prefix('totalRecords: ').level('DEBUG')

var totalErrors = data
        |where(lambda: "error" == 'true')
        |log().prefix('totalErrors (pre-count): ').level('DEBUG')
        |log().prefix('totalErrors (post-count): ').level('DEBUG')

        |log().prefix('pre-join: ').level('DEBUG')
        |eval(lambda: float("totalErrors.count") / float("totals.count" + 1)  )
        |log().prefix('pre-alert: ').level('DEBUG')
                .id('{{ .Name }}')
                .message('Count: {{ index .Fields "totals.count" }}; Errors: {{ index .Fields "totalErrors.count" }} Rate: {{ index .Fields "rate" }} ')
                //.crit(lambda: TRUE)
                .crit(lambda: "rate" > errorPercentage OR "totalErrors.count" > errorAbsolute)
                // Whenever we get an alert write it to a file.

If you are trying to join all three total vars do something along these lines:

        |join(totalRecords, totalDurations)
                .as('totalErrors','totals', 'totalDurations')

Thanks. That seems to do the trick.