-
1. Re: metrics configuration
cfang Oct 5, 2016 3:56 PM (in response to kk31)metrics are at step level. These are the metrics types collected (not configurable):
Metric.MetricType (Java(TM) EE 7 Specification APIs)
To get step metrics, call StepExecution.getMetrics():
-
2. Re: metrics configuration
kk31 Oct 14, 2016 12:40 PM (in response to cfang)Can we override these step metrics (or) are these read only properties?
I tried in my itemprocessor.process(), but the values are incorrect. Is it the right place to override step metrics?
StepExecutionImpl executionImpl = new StepExecutionImpl(stepContext.getStepName()); StepMetrics smetrics =executionImpl.getStepMetrics(); smetrics.set(MetricType.WRITE_COUNT, this.itemsWritten);
-
3. Re: metrics configuration
cfang Oct 14, 2016 1:49 PM (in response to kk31)step metrics are kept and owned by the batch runtime, and should not be modified by applications.
Applications should not instantiate JBeret internal classes like StepExecutionImpl. Any such instances created by applications are not known to JBeret.
You can get StepExecution from JobOperator.
YOu can also inject StepContext into your step-level batch artifacts, and get step metrics from stepContext.
If you really need to, your application can keep stats as part of application data, separate from the step metrics from JBeret.
-
4. Re: metrics configuration
kk31 Oct 14, 2016 3:01 PM (in response to cfang)Thanks for the suggestion.
our itemprocessor returns 707 rows from table and each row contains array of strings with default delimiter as ','
In our job.xml, beanIOItemWriter/beanmapping.xml, we gave delimiter values as '\n' , which shows the count as 7568.
Default stepmetrics gives write count as 707(ideally true), but since we are writing to a file as 7568 lines, we would like get the write count as 7568.
I wrote my stepListener which give me this number(7568) by using stepcontext.getTransientData(Object), but is there any settings out of the box that we can configure, so that after apply delimiter saying these many no of lines were written into file.
-
5. Re: metrics configuration
cfang Oct 14, 2016 4:21 PM (in response to kk31)there is no such configuration for step metrics. Step item reader, processor, and writer each counts the number of items it received, and so there is no other meansurement units like number of lines/words.