If you rename the ExecuteScript processor to something more specific like "CountMyStuff", the Counters table will use that name, rather than strictly the processor type.
The aggregate values for "All ExecuteScripts" are likely to be meaningless, however. Thanks, James On Fri, Dec 9, 2016 at 8:54 AM, Russell Bateman <[email protected]> wrote: > Ah, okay. The NiFi Counters summary lists the particulars including > individual passage of flowfiles in a processor that adjusts the count and > also totals for all flowfiles through a processor that calls > adjustCounter(). It's less confusing for what my guys want if the processor > doing this only occurs once in the flow, but this is good. We can probably > make use of this via a property they can use to name their counter. > > Great, thank you! > > Russ > > On 12/09/2016 09:15 AM, James Wing wrote: > >> You can add a custom counter very easily using ExecuteScript: >> >> /* ECMAScript */ >> flowFile = session.get(); >> if (flowFile != null) { >> session.adjustCounter("SampleScriptCounter", 1, false); >> session.transfer(flowFile, REL_SUCCESS); >> } >> >> The performance may not be optimal, but you can experiment with counters >> immediately. >> >> Thanks, >> >> James >> >> On Fri, Dec 9, 2016 at 7:56 AM, Russell Bateman <[email protected]> >> wrote: >> >> Aldrin, >>> >>> Forgive me for commandeering this thread. >>> >>> My down-streamers are asking for a custom "counting" processor because of >>> what from their point of view is an unreliable volatility in the counts >>> that the UI displays. In particular, they want to know how many documents >>> they're feeding into our ETL flow and how many they're getting out (at >>> least, in places where there is a one-to-one expectation which isn't all >>> of >>> our flows of course). The delta, which they are pretty sure to be >>> non-zero, >>> would be tantamount to lost/dropped documents. (So, they want me to >>> manufacture the pistol they intend aiming at my head. ;-) ) >>> >>> Are you saying that ProcessSession provides me, as a custom processor >>> writer, the ability to do this (ostensibly in already existing custom >>> processors I've written) in preference to adding yet another dedicated, >>> custom processor? >>> >>> As new as NiFi is, great functionality is still hidden behind the fact >>> that no one's using it and no one's writing about it, giving examples, >>> etc. >>> I was surprised to read this thread just now and wondered if it's another >>> cool thing I've missed. >>> >>> Thanks for any confirmation, other comments, etc. >>> >>> Russ >>> >>> On 12/09/2016 08:42 AM, Aldrin Piri wrote: >>> >>> Hello, >>>> >>>> Counters are a framework level item that allows processors to provide >>>> counts on things whilst processing. This functionality must be >>>> exercised >>>> via the ProcessSession[1] within a processor's code. To add one, you >>>> would >>>> need to invoke the adjustCounter method in your processor. >>>> >>>> [1] >>>> https://github.com/apache/nifi/blob/master/nifi-api/src/main >>>> /java/org/apache/nifi/processor/ProcessSession.java#L161 >>>> >>>> On Fri, Dec 9, 2016 at 3:40 AM, bingogo1986 <[email protected]> >>>> wrote: >>>> >>>> hi >>>> >>>>> I noticed 'Counter' button on top right of Nifi UI ,how to aad a >>>>> specified >>>>> counter ,thanks. >>>>> Best regards. >>>>> >>>>> >
