@Test public void createAddLabelledQueryWithAdditionalData() { AddLabelledQuery<String> userQuery = LabelledEvents.start(query, corrId, label, addData); RequestData rd = userQuery.getData(); assertThat(rd.getQuery(), is(query)); assertThat(rd.getType(), is(label)); assertThat(rd.getCorrelationId(), is(corrId)); assertThat(rd.getAdditionalData(), is(addData)); }
/** * Marks the start of a query identified by the provided correlationId, with additional query type and data parameters * * @param query - Query data * @param correlationId - Identifier * @param label - allows queries to be grouped by label * @param additionalData - Any additional info about the request to be rendered in the JSON view / rest endpoint * @return Start event to pass to the Events systems EventBus */ public static <T> AddLabelledQuery<T> start(T query, long correlationId, String label, Object additionalData) { return new AddLabelledQuery( RequestData.builder() .query(query) .correlationId(correlationId) .type(label) .additionalData(additionalData) .build()); }
/** * Marks the start of a query identified by the provided correlationId, with additional query type and data parameters * * @param query - Query data * @param correlationId - Identifier * @param label - allows queries to be grouped by label * @param additionalData - Any additional info about the request to be rendered in the JSON view / rest endpoint * @return Start event to pass to the Events systems EventBus */ public static <T> AddLabelledQuery<T> start(T query, long correlationId, String label, Object additionalData) { return new AddLabelledQuery( RequestData.builder() .query(query) .correlationId(correlationId) .type(label) .additionalData(additionalData) .build()); }
@Test public void createAddLabelledQuery() { AddLabelledQuery<String> userQuery = LabelledEvents.start(query, corrId, label); RequestData rd = userQuery.getData(); assertThat(rd.getQuery(), is(query)); assertThat(rd.getType(), is(label)); assertThat(rd.getCorrelationId(), is(corrId)); }
@Subscribe public void requestStart(AddLabelledQuery<T> data) { if (this.configuration.isQueriesByType()) { RequestData<T> rd = data.getData(); ((InstantGauge) registry.gauge(prefix + ".requests-started-" + rd.getType() + "-interval-count", () -> new InstantGauge())) .increment(); } }