private QueryMetrics<? super Query<T>> acquireResponseMetrics() { if (queryMetrics == null) { queryMetrics = toolChest.makeMetrics(query); queryMetrics.server(host); } return queryMetrics; }
@Override public QueryMetrics makeMetrics(Query query) { Query realQuery = getRealQuery(query); return warehouse.getToolChest(realQuery).makeMetrics(realQuery); }
/** * Returns the same QueryPlus object, if it already has {@link QueryMetrics} ({@link #getQueryMetrics()} returns not * null), or returns a new QueryPlus object with {@link Query} from this QueryPlus and QueryMetrics created using the * given {@link QueryToolChest}, via {@link QueryToolChest#makeMetrics(Query)} method. * * By convention, callers of {@code withQueryMetrics()} must also call .getQueryMetrics().emit() on the returned * QueryMetrics object, regardless if this object is the same as the object on which .withQueryMetrics() was initially * called (i. e. it already had non-null QueryMetrics), or if it is a new QueryPlus object. See {@link * MetricsEmittingQueryRunner} for example. */ public QueryPlus<T> withQueryMetrics(QueryToolChest<T, ? extends Query<T>> queryToolChest) { if (queryMetrics != null) { return this; } else { final QueryMetrics metrics = ((QueryToolChest) queryToolChest).makeMetrics(query); if (identity != null) { metrics.identity(identity); } return new QueryPlus<>(query, metrics, identity); } }
public static <T> QueryMetrics<?> makeRequestMetrics( final GenericQueryMetricsFactory queryMetricsFactory, final QueryToolChest<T, Query<T>> toolChest, final Query<T> query, final String remoteAddr ) { QueryMetrics<? super Query<T>> queryMetrics; if (toolChest != null) { queryMetrics = toolChest.makeMetrics(query); } else { queryMetrics = queryMetricsFactory.makeMetrics(query); } queryMetrics.context(query); queryMetrics.remoteAddress(remoteAddr); return queryMetrics; } }
private QueryMetrics<? super Query<T>> acquireResponseMetrics() { if (queryMetrics == null) { queryMetrics = toolChest.makeMetrics(query); queryMetrics.server(host); } return queryMetrics; }
/** * Returns the same QueryPlus object, if it already has {@link QueryMetrics} ({@link #getQueryMetrics()} returns not * null), or returns a new QueryPlus object with {@link Query} from this QueryPlus and QueryMetrics created using the * given {@link QueryToolChest}, via {@link QueryToolChest#makeMetrics(Query)} method. * * By convention, callers of {@code withQueryMetrics()} must also call .getQueryMetrics().emit() on the returned * QueryMetrics object, regardless if this object is the same as the object on which .withQueryMetrics() was initially * called (i. e. it already had non-null QueryMetrics), or if it is a new QueryPlus object. See {@link * MetricsEmittingQueryRunner} for example. */ public QueryPlus<T> withQueryMetrics(QueryToolChest<T, ? extends Query<T>> queryToolChest) { if (queryMetrics != null) { return this; } else { final QueryMetrics metrics = ((QueryToolChest) queryToolChest).makeMetrics(query); if (identity != null) { metrics.identity(identity); } return new QueryPlus<>(query, metrics, identity); } }
public static <T> QueryMetrics<?> makeRequestMetrics( final GenericQueryMetricsFactory queryMetricsFactory, final QueryToolChest<T, Query<T>> toolChest, final Query<T> query, final String remoteAddr ) { QueryMetrics<? super Query<T>> queryMetrics; if (toolChest != null) { queryMetrics = toolChest.makeMetrics(query); } else { queryMetrics = queryMetricsFactory.makeMetrics(query); } queryMetrics.context(query); queryMetrics.remoteAddress(remoteAddr); return queryMetrics; } }