Jens, I think you should be able to use a query like:
SELECT COUNT( (queuedBytes*100/backPressureBytesThreshold) > 60) AS overSixtyPercentBytes, COUNT( (queuedCount*100/backPressureObjectThreshold) > 60) AS overSixtyPercentObjects, COUNT( (queuedBytes*100/backPressureBytesThreshold) > 75) AS overSeventyFivePercentBytes, COUNT( (queuedCount*100/backPressureObjectThreshold) > 75) AS overSeventyFivePercentObjects FROM FLOWFILE Unless I’m misunderstanding what you’re after? Thanks -Mark > On Mar 2, 2021, at 2:40 AM, Jens M. Kofoed <[email protected]> wrote: > > Hi > > I'm using the SiteToSiteStatusReportingTask to monitor NIFI flows and I would > like to calculate how many connections has BackPressure Enabled and a bunch > more calculations. The end results of all the statistics has to be in one > final flowfile so a final result can be sent to another system. > > First I use a PartitionRecord, to split the records by componentType so I > gets all Connections in one flowfile. Using a CalculateRecordStats with a > property with the value of "/isBackPressureEnabled" will give 2 resuts: > recordStats.isBackPressureEnabled.false = 2451 > recordStats.isBackPressureEnabled.true = 2 > > But I can't figure out how to make calculations based on specific fields > where values has to match a criteria. > Using a QueryRecords I have added 2 more fields to the records. > SELECT *, (queuedBytes*100/backPressureBytesThreshold) AS queuedBytesProcent, > (queuedCount*100/backPressureObjectThreshold) AS queuedCountProcent FROM > FLOWFILE > > I would like to calculate how many connections has a queuedBytesProcent > 60 > and how many has a queuedCountProcent > 75. > And later on I would like to make calculation based on different "parentPath". > > I can use the QueryRecords to make multiple outputs depending of different > statements and next use a CalculateRecordStats to calculate the result. But > here I will end up with multiple flowfiles and not one final result. > > Is it possible to do it in one straight flow? > > kind regards > Jens M. Kofoed
