@Override protected TProcessor createProcessor() { return new THBaseService.Processor<>(HbaseHandlerMetricsProxy .newInstance((THBaseService.Iface) hbaseServiceHandler, metrics, conf)); }
public static THBaseService.Iface newInstance(THBaseService.Iface handler, ThriftMetrics metrics, Configuration conf) { return (THBaseService.Iface) Proxy.newProxyInstance( handler.getClass().getClassLoader(), new Class[]{THBaseService.Iface.class}, new HbaseHandlerMetricsProxy(handler, metrics, conf)); }
@Override public Object invoke(Object proxy, Method m, Object[] args) throws Throwable { Object result; long start = now(); try { result = m.invoke(handler, args); } catch (InvocationTargetException e) { metrics.exception(e.getCause()); throw e.getTargetException(); } catch (Exception e) { metrics.exception(e); throw new RuntimeException( "unexpected invocation exception: " + e.getMessage()); } finally { long processTime = now() - start; metrics.incMethodTime(m.getName(), processTime); } return result; }
protected TProcessor createProcessor() { return new Hbase.Processor<>( HbaseHandlerMetricsProxy.newInstance((Hbase.Iface) hbaseServiceHandler, metrics, conf)); }
public static Hbase.Iface newInstance(Hbase.Iface handler, ThriftMetrics metrics, Configuration conf) { return (Hbase.Iface) Proxy.newProxyInstance( handler.getClass().getClassLoader(), new Class[]{Hbase.Iface.class}, new HbaseHandlerMetricsProxy(handler, metrics, conf)); }
@Override public Object invoke(Object proxy, Method m, Object[] args) throws Throwable { Object result; try { long start = now(); result = m.invoke(handler, args); int processTime = (int)(now() - start); metrics.incMethodTime(m.getName(), processTime); } catch (InvocationTargetException e) { throw e.getTargetException(); } catch (Exception e) { throw new RuntimeException( "unexpected invocation exception: " + e.getMessage()); } return result; }
private static Hbase.Iface getHandlerForMetricsTest(ThriftMetrics metrics, Configuration conf) throws Exception { Hbase.Iface handler = new MySlowHBaseHandler(conf); return HbaseHandlerMetricsProxy.newInstance((ThriftHBaseServiceHandler)handler, metrics, conf); }
public static Hbase.Iface newInstance(Hbase.Iface handler, ThriftMetrics metrics, Configuration conf) { return (Hbase.Iface) Proxy.newProxyInstance( handler.getClass().getClassLoader(), new Class[]{Hbase.Iface.class}, new HbaseHandlerMetricsProxy(handler, metrics, conf)); }
@Override public Object invoke(Object proxy, Method m, Object[] args) throws Throwable { Object result; long start = now(); try { result = m.invoke(handler, args); } catch (InvocationTargetException e) { metrics.exception(e.getCause()); throw e.getTargetException(); } catch (Exception e) { metrics.exception(e); throw new RuntimeException( "unexpected invocation exception: " + e.getMessage()); } finally { long processTime = now() - start; metrics.incMethodTime(m.getName(), processTime); } return result; }
@Test public void testMetrics() throws Exception { Configuration conf = UTIL.getConfiguration(); ThriftMetrics metrics = getMetrics(conf); ThriftHBaseServiceHandler hbaseHandler = createHandler(); THBaseService.Iface handler = HbaseHandlerMetricsProxy.newInstance(hbaseHandler, metrics, conf); byte[] rowName = Bytes.toBytes("testMetrics"); ByteBuffer table = wrap(tableAname); TGet get = new TGet(wrap(rowName)); assertFalse(handler.exists(table, get)); List<TColumnValue> columnValues = new ArrayList<>(2); columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname))); columnValues.add(new TColumnValue(wrap(familyBname), wrap(qualifierBname), wrap(valueBname))); TPut put = new TPut(wrap(rowName), columnValues); put.setColumnValues(columnValues); handler.put(table, put); assertTrue(handler.exists(table, get)); metricsHelper.assertCounter("put_num_ops", 1, metrics.getSource()); metricsHelper.assertCounter("exists_num_ops", 2, metrics.getSource()); }
public static Hbase.Iface newInstance(Hbase.Iface handler, ThriftMetrics metrics, Configuration conf) { return (Hbase.Iface) Proxy.newProxyInstance( handler.getClass().getClassLoader(), new Class[]{Hbase.Iface.class}, new HbaseHandlerMetricsProxy(handler, metrics, conf)); }
@Override public Object invoke(Object proxy, Method m, Object[] args) throws Throwable { Object result; long start = now(); try { result = m.invoke(handler, args); } catch (InvocationTargetException e) { metrics.exception(e.getCause()); throw e.getTargetException(); } catch (Exception e) { metrics.exception(e); throw new RuntimeException( "unexpected invocation exception: " + e.getMessage()); } finally { long processTime = now() - start; metrics.incMethodTime(m.getName(), processTime); } return result; }
ThriftMetrics metrics = getMetrics(UTIL.getConfiguration()); THBaseService.Iface handler = HbaseHandlerMetricsProxy.newInstance(hbaseHandler, metrics, null); ByteBuffer tTableName = wrap(tableName.getName());
public static Hbase.Iface newInstance(Hbase.Iface handler, ThriftMetrics metrics, Configuration conf) { return (Hbase.Iface) Proxy.newProxyInstance( handler.getClass().getClassLoader(), new Class[]{Hbase.Iface.class}, new HbaseHandlerMetricsProxy(handler, metrics, conf)); }
ThriftMetrics metrics = getMetrics(UTIL.getConfiguration()); THBaseService.Iface handler = HbaseHandlerMetricsProxy.newInstance(hbaseHandler, metrics, null); ByteBuffer tTableName = wrap(tableName.getName());
new ThriftHBaseServiceHandler(UTIL.getConfiguration(), UserProvider.instantiate(UTIL.getConfiguration())); Hbase.Iface handler = HbaseHandlerMetricsProxy.newInstance(hbaseHandler, metrics, conf);
public ThriftServerRunner(Configuration conf, HBaseHandler handler) { this.conf = HBaseConfiguration.create(conf); this.listenPort = conf.getInt(PORT_CONF_KEY, DEFAULT_LISTEN_PORT); this.metrics = new ThriftMetrics(listenPort, conf, Hbase.Iface.class); handler.initMetrics(metrics); this.handler = HbaseHandlerMetricsProxy.newInstance(handler, metrics, conf); }
private static Hbase.Iface getHandlerForMetricsTest(ThriftMetrics metrics, Configuration conf) throws Exception { Hbase.Iface handler = new MySlowHBaseHandler(conf); return HbaseHandlerMetricsProxy.newInstance(handler, metrics, conf); }
private static Hbase.Iface getHandlerForMetricsTest(ThriftMetrics metrics, Configuration conf) throws Exception { Hbase.Iface handler = new MySlowHBaseHandler(conf); return HbaseHandlerMetricsProxy.newInstance(handler, metrics, conf); }
this.hbaseHandler = new HBaseHandler(conf, userProvider); this.hbaseHandler.initMetrics(metrics); this.handler = HbaseHandlerMetricsProxy.newInstance(hbaseHandler, metrics, conf);