@Override public void gauge(String metricName, long value) { delegate.gauge(metricName, value); }
@Override public void gauge(String metricName, long value) { delegate.gauge(metricName, value); }
@Override public void gauge(String metricName, long value) { delegate.gauge(metricName, value); }
@Override public void gauge(String metricName, long value) { getMetrics().gauge(metricName, value); }
@Override public void gauge(String metricName, long value) { getMetrics().gauge(metricName, value); }
@Override public void gauge(String metricName, long value) { getMetrics().gauge(metricName, value); }
public void map(byte[] key, byte[] value, Context context) throws IOException, InterruptedException { metrics.gauge("test.metric", 10); context.write(key, value); } }
@Override protected void setup(Context context) throws IOException, InterruptedException { metrics.gauge("in.map.setup", 1); LOG.info("in mapper: setup()"); long mappersCount = counters.incrementAndGet(new Increment("mapper", "count", 1L)).getLong("count", 0); LOG.info("mappers started so far: " + mappersCount); metrics.gauge("in.map.setup", 1); }
@Override protected void setup(Reducer.Context context) throws IOException, InterruptedException { metrics.gauge("in.reduce.setup", 1); LOG.info("in reducer: setup()"); long reducersCount = counters.incrementAndGet(new Increment("reducer", "count", 1L)).getLong("count", 0); LOG.info("reducers started so far: " + reducersCount); metrics.gauge("in.reduce.setup", 1); }
@Override public void destroy() { metrics.gauge(String.format("destroy.%s", WORKFLOW), 1); WorkflowContext context = getContext(); KeyValueTable table = context.getDataset(WORKFLOW_TABLE); try { Object plugin = context.newPluginInstance("workflowplugin"); table.write("val", plugin.toString()); } catch (InstantiationException e) { Throwables.propagate(e); } } }
@Override public void run() { try { String inputPath = getContext().getRuntimeArguments().get("input.path"); FileSet fileSetDataset = getContext().getDataset(CSV_FILESET_DATASET); Location inputLocation = fileSetDataset.getLocation(inputPath); try (PrintWriter writer = new PrintWriter(inputLocation.getOutputStream())) { writer.write("this,text,has"); writer.println(); writer.write("two,words,text,inside"); metrics.gauge("num.lines", 2); } } catch (Throwable t) { LOG.error("Exception occurred while running custom action ", t); } } }
@Override public void run(DatasetContext context) throws Exception { int uniqueWordCount = 0; try (CloseableIterator<KeyValue<byte[], byte[]>> scanner = wordCount.scan(null, null)) { while (scanner.hasNext()) { scanner.next(); uniqueWordCount++; } } result.write("UniqueWordCount", String.valueOf(uniqueWordCount)); metrics.gauge("unique.words", uniqueWordCount); } });