Several comments: 1. Are these metrics going to be available as MBean? 2. QueryDetailsMetrics -> QueryMetrics 3. getCompletions() -> getSuccesses() - to be consistent with getFailures() 4. Do we need an MBean for queryMetricsHIstor()?
D. On Mon, Oct 24, 2016 at 3:58 AM, Alexey Kuznetsov <[email protected]> wrote: > Igniters, > > I'm working on IGNITE-3443: Implement collecting what SQL statements > executed on cluster and their metrics [1]. (I also updated issue > description with text below.) > > And I would like that my changes of public API looks good. > > Please, give your feedback. > > So, I introduced interface org.apache.ignite.cache.query.QueryDetailsMetrics > with > metrics: > > /** > * Query metrics aggregated by query type and its textual representation. > */ > public interface QueryDetailsMetrics { > /** > * @return Query type. > */ > public String getQueryType(); > > /** > * @return Textual representation of query. > */ > public String getQuery(); > > /** > * @return Cache where query was executed. > */ > public String getCache(); > > /** > * Gets total number execution of query. > * > * @return Number of executions. > */ > public int getExecutions(); > > /** > * Gets number of completed execution of query. > * > * @return Number of completed executions. > */ > public int getCompletions(); > > /** > * Gets number of times a query execution failed. > * > * @return Number of times a query execution failed. > */ > public int getFailures(); > > /** > * Gets minimum execution time of query. > * > * @return Minimum execution time of query. > */ > public long getMinimumTime(); > > /** > * Gets maximum execution time of query. > * > * @return Maximum execution time of query. > */ > public long getMaximumTime(); > > /** > * Gets average execution time of query. > * > * @return Average execution time of query. > */ > public double getAverageTime(); > > /** > * Gets total time of all query executions. > * > * @return Total time of all query executions. > */ > public long getTotalTime(); > > /** > * Gets latest query start time. > * > * @return Latest time query was stared. > */ > public long getLastStartTime(); > } > > > And added method on org.apache.ignite.IgniteCache: > > /** > * Gets query metrics details. > * > * @return Metrics. > */ > public Collection<? extends QueryDetailsMetrics> queryMetricsHistory(); > > > And also I added new property on > org.apache.ignite.configuration.CacheConfiguration: > > /** > * Gets size of queries metrics history that will be stored in memory for > monitoring purposes. > * If {@code 0} then history will not be collected. > * Note, Larger number may lead to higher memory consumption. > * > * @return Maximum number of query metrics that will be stored in memory. > */ > public int getQueryMetricsHistorySize() { > return qryMetricsHistSz; > } > > /** > * Sets size of queries metrics history that will be stored in memory for > monitoring purposes. > * > * @param qryMetricsHistSz Maximum number of latest queries metrics that will > be stored in memory. > * @return {@code this} for chaining. > */ > public CacheConfiguration<K, V> setQueryMetricsHistorySize(int > qryMetricsHistSz) { > this.qryMetricsHistSz = qryMetricsHistSz; > > return this; > } > > > > [1] https://issues.apache.org/jira/browse/IGNITE-3443 > > -- > Alexey Kuznetsov >
