public <T extends IMetric> T registerMetric(String name, T metric, int timeBucketSizeInSecs) { return _topoContext.registerMetric(name, metric, timeBucketSizeInSecs); }
public static void registerMetric(String name, IMetric metric, Map<String, Object> topoConf, TopologyContext context) { int bucketSize = ((Number) topoConf.get(Config.TOPOLOGY_BUILTIN_METRICS_BUCKET_SIZE_SECS)).intValue(); context.registerMetric(name, metric, bucketSize); } }
@Override public void registerMetrics(TopologyContext topoContext, Map<String, Object> topoConf) { int bucketSize = ((Number) topoConf.get(Config.TOPOLOGY_BUILTIN_METRICS_BUCKET_SIZE_SECS)).intValue(); topoContext.registerMetric("TGT-TimeToExpiryMsecs", () -> getMsecsUntilExpiration(), bucketSize); } }
public OutputStreamEngineWithHisto(OutputStream stats, TopologyContext context) { super(stats); histogram = new HistogramMetric(3600000000000L, 3); //TODO perhaps we can adjust the frequency later... context.registerMetric("comp-lat-histo-" + stats.id, histogram, 10); } }
private void registerMetrics(TopologyContext context, Map<String, String> metrics, int bucketSize, Map<String, Object> conf) { if (metrics == null) { return; } for (Map.Entry<String, String> metric : metrics.entrySet()) { try { context.registerMetric(metric.getKey(), (IMetric) ReflectionUtils.newInstance(metric.getValue(), conf), bucketSize); } catch (Exception e) { throw new RuntimeException(e); } } }
@Deprecated public CombinedMetric registerMetric(String name, ICombiner combiner, int timeBucketSizeInSecs) { return registerMetric(name, new CombinedMetric(combiner), timeBucketSizeInSecs); }
@Deprecated public ReducedMetric registerMetric(String name, IReducer reducer, int timeBucketSizeInSecs) { return registerMetric(name, new ReducedMetric(reducer), timeBucketSizeInSecs); }
public CombinedMetric registerMetric(String name, ICombiner combiner, int timeBucketSizeInSecs) { return _topoContext.registerMetric(name, new CombinedMetric(combiner), timeBucketSizeInSecs); } }
public ReducedMetric registerMetric(String name, IReducer reducer, int timeBucketSizeInSecs) { return _topoContext.registerMetric(name, new ReducedMetric(reducer), timeBucketSizeInSecs); }
private void registerMetric() { LOG.info("Registering Spout Metrics"); kafkaOffsetMetric = new KafkaOffsetMetric<>(() -> Collections.unmodifiableMap(offsetManagers), () -> consumer); context.registerMetric("kafkaOffset", kafkaOffsetMetric, kafkaSpoutConfig.getMetricsTimeBucketSizeInSecs()); }
context.registerMetric("uptimeSecs", () -> jvmRT.getUptime() / 1000.0, bucketSize); context.registerMetric("startTimeSecs", () -> jvmRT.getStartTime() / 1000.0, bucketSize); context.registerMetric("threadCount", threadBean::getThreadCount, bucketSize); context.registerMetric("newWorkerEvent", new IMetric() { boolean doEvent = true; context.registerMetric("memory/heap", new MemoryUsageMetric(jvmMemRT::getHeapMemoryUsage), bucketSize); context.registerMetric("memory/nonHeap", new MemoryUsageMetric(jvmMemRT::getNonHeapMemoryUsage), bucketSize); context.registerMetric("GC/" + b.getName().replaceAll("\\W", ""), new GarbageCollectorMetric(b), bucketSize);
@Override public void open(Map<String, Object> conf, TopologyContext context, SpoutOutputCollector collector) { super.open(conf, context, collector); CountShellMetric cMetric = new CountShellMetric(); context.registerMetric("my-custom-shellspout-metric", cMetric, 5); }
public void prepare(Map<String, Object> topoConf, TopologyContext context, OutputCollector collector) { super.prepare(topoConf, context, collector); CountShellMetric cMetric = new CountShellMetric(); context.registerMetric("my-custom-shell-metric", cMetric, 5); }
context.registerMetric("EventHubReceiver", new IMetric() { @Override public Object getValueAndReset() {
private <T extends IMetric> T registerMetric(T metric, String name, TopologyContext context) { Number interval = metricsIntervalMapping.getOrDefault(name, metricsIntervalMapping.get(DEFAULT_BUILT_IN_METRICS_INTERVAL_KEY)); log.info("Registered metric: {} with interval {}", name, interval); return context.registerMetric(name, metric, interval.intValue()); } }
@Deprecated public ReducedMetric registerMetric(String name, IReducer reducer, int timeBucketSizeInSecs) { return registerMetric(name, new ReducedMetric(reducer), timeBucketSizeInSecs); } /*
private void registerMetrics(TopologyContext context, Map<String, String> metrics, int bucketSize) { if (metrics == null) return; for (Map.Entry<String, String> metric: metrics.entrySet()) { try { context.registerMetric(metric.getKey(), (IMetric)Utils.newInstance(metric.getValue()), bucketSize); } catch (Exception e) { throw new RuntimeException(e); } } }
public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) { super.prepare(stormConf, context, collector); CountShellMetric cMetric = new CountShellMetric(); context.registerMetric("my-custom-shell-metric", cMetric, 5); }
public static TopologyContext getMockedTopologyContext() { TopologyContext context = mock(TopologyContext.class); when(context.registerMetric(anyString(), any(IMetric.class), anyInt())) .thenAnswer(new Answer<IMetric>() { @Override public IMetric answer(InvocationOnMock invocation) throws Throwable { return invocation.getArgumentAt(1, IMetric.class); } }); return context; }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void prepare(Map conf, TopologyContext context, OutputCollector collector) { super.prepare(conf, context, collector); _collector = collector; this.eventCounter = context.registerMetric("SQLIndexer", new MultiCountMetric(), 10); this.tableName = ConfUtils.getString(conf, SQL_INDEX_TABLE_PARAM_NAME); this.conf = conf; }