Java Code Examples for com.signalfx.codahale.reporter.MetricMetadata#BuilderTagger
The following examples show how to use
com.signalfx.codahale.reporter.MetricMetadata#BuilderTagger .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SignalFxEndpointMetricsHandler.java From riposte with Apache License 2.0 | 6 votes |
@Override public MetricMetadata.BuilderTagger<T> setupMetricWithDimensions( MetricMetadata.BuilderTagger<T> rawBuilder, RequestInfo<?> requestInfo, ResponseInfo<?> responseInfo, HttpProcessingState httpState, int responseHttpStatusCode, int responseHttpStatusCodeXXValue, long elapsedTimeMillis, Endpoint<?> endpoint, String endpointClass, String method, String matchingPathTemplate ) { return rawBuilder .withMetricName(metricName) .withDimension(responseCodeDimensionKey, String.valueOf(responseHttpStatusCode)) .withDimension(uriDimensionKey, matchingPathTemplate) .withDimension(methodDimensionKey, method) .withDimension(endpointClassKey, endpointClass); }
Example 2
Source File: SignalFxEndpointMetricsHandler.java From riposte with Apache License 2.0 | 6 votes |
@Override public MetricMetadata.BuilderTagger<T> setupMetricWithDimensions(MetricMetadata.BuilderTagger<T> rawBuilder, RequestInfo<?> requestInfo, ResponseInfo<?> responseInfo, HttpProcessingState httpState, int responseHttpStatusCode, int responseHttpStatusCodeXXValue, long elapsedTimeMillis, Endpoint<?> endpoint, String endpointClass, String method, String matchingPathTemplate) { // Execute the first configurator. MetricMetadata.BuilderTagger<T> withFirstConfiguration = firstConfigurator.setupMetricWithDimensions( rawBuilder, requestInfo, responseInfo, httpState, responseHttpStatusCode, responseHttpStatusCodeXXValue, elapsedTimeMillis, endpoint, endpointClass, method, matchingPathTemplate ); // Execute the second configurator with the result of the first. return secondConfigurator.setupMetricWithDimensions( withFirstConfiguration, requestInfo, responseInfo, httpState, responseHttpStatusCode, responseHttpStatusCodeXXValue, elapsedTimeMillis, endpoint, endpointClass, method, matchingPathTemplate ); }
Example 3
Source File: SfxMetrics.java From signalfx-java with Apache License 2.0 | 5 votes |
private <T extends Metric> T getT(String metricName, MetricMetadata.BuilderTagger<T> tagger, String[] dimensions) { Preconditions.checkArgument(dimensions.length % 2 == 0, "Dimensions parameter should have even number of elements"); tagger.withMetricName(metricName); for (int i = 0; i < dimensions.length - 1; i += 2) { tagger.withDimension(dimensions[i], dimensions[i + 1]); } return tagger.createOrGet(metricRegistry); }
Example 4
Source File: SfxMetrics.java From signalfx-java with Apache License 2.0 | 5 votes |
private <T extends Metric> T getT(String metricName, MetricMetadata.BuilderTagger<T> tagger, Map<String, String> dimensions) { tagger.withMetricName(metricName); if (dimensions != null) { for (Map.Entry<String, String> entry : dimensions.entrySet()) { tagger.withDimension(entry.getKey(), entry.getValue()); } } return tagger.createOrGet(metricRegistry); }
Example 5
Source File: SfxMetrics.java From signalfx-java with Apache License 2.0 | 4 votes |
private <T extends Metric> T build(MetricBuilder<T> builder, String metricName, String... dimensions) { MetricMetadata.BuilderTagger<T> tagger = metricMetadata.forBuilder(builder); return getT(metricName, tagger, dimensions); }
Example 6
Source File: SfxMetrics.java From signalfx-java with Apache License 2.0 | 4 votes |
private <T extends Metric> T build(MetricBuilder<T> builder, String metricName, Map<String, String> dimensions) { MetricMetadata.BuilderTagger<T> tagger = metricMetadata.forBuilder(builder); return getT(metricName, tagger, dimensions); }
Example 7
Source File: SignalFxEndpointMetricsHandler.java From riposte with Apache License 2.0 | 3 votes |
/** * Takes in information about the request and returns a {@link MetricMetadata.BuilderTagger} that will be used * to create or get the appropriately-dimensioned timer. * * @param rawBuilder The brand new {@link MetricMetadata.BuilderTagger}, ready for dimensioning. You should * return this using the fluent method API to add metric name, dimensions, etc, i.e. * {@code return rawBuilder.withMetricName(...).withDimension(...).with...;}. Will never be null. * @param requestInfo The {@link RequestInfo} for the request. Will never be null. * @param responseInfo The {@link ResponseInfo} for the response associated with the request. Will never be * null. * @param httpState The {@link HttpProcessingState} associated with the request. Will never be null. * @param responseHttpStatusCode The HTTP status code sent back in the response. * @param responseHttpStatusCodeXXValue Which category the response status code falls into, * i.e. 1xx, 2xx, 3xx, 4xx, 5xx, etc. This is just a convenience for * {@code (int)(responseHttpStatusCode / 100)}. * @param elapsedTimeMillis How long the request took in milliseconds. * @param endpoint The endpoint that handled the request. This may be null in short-circuit cases where no * endpoint was called. * @param endpointClass The endpoint class name, or "NONE" in short-circuit cases where no endpoint was called. * @param method The HTTP method of the request, or "NONE" if requestInfo.getMethod() is null (this should never * happen in practice). * @param matchingPathTemplate The URI/path template for the request. * @return The {@link MetricMetadata.BuilderTagger} that should be used to create or get the * appropriately-dimensioned timer. Implementations should likely use the given rawBuilder with fluent method * calls as intended, i.e. {@code return rawBuilder.withMetricName(...).withDimension(...).with...;} */ MetricMetadata.BuilderTagger<T> setupMetricWithDimensions( MetricMetadata.BuilderTagger<T> rawBuilder, RequestInfo<?> requestInfo, ResponseInfo<?> responseInfo, HttpProcessingState httpState, int responseHttpStatusCode, int responseHttpStatusCodeXXValue, long elapsedTimeMillis, Endpoint<?> endpoint, String endpointClass, String method, String matchingPathTemplate );
Example 8
Source File: SfxMetrics.java From signalfx-java with Apache License 2.0 | 3 votes |
/** * Get or create a new incremental counter. * * @param metricName * The metric name. * @param dimensions * Additional dimension key/value pairs, as a map. * @return The {@link IncrementalCounter} instance. */ public IncrementalCounter incrementalCounter(String metricName, Map<String, String> dimensions) { MetricMetadata.BuilderTagger<IncrementalCounter> metric = metricMetadata .forBuilder(IncrementalCounter.Builder.INSTANCE); return getT(metricName, metric, dimensions); }
Example 9
Source File: SfxMetrics.java From signalfx-java with Apache License 2.0 | 2 votes |
/** * Get or create a new incremental counter. * * @param metricName * The metric name. * @param dimensions * Additional dimension key/value pairs (an even number of strings must be provided). * @return The {@link IncrementalCounter} instance. */ public IncrementalCounter incrementalCounter(String metricName, String... dimensions) { MetricMetadata.BuilderTagger<IncrementalCounter> metric = metricMetadata .forBuilder(IncrementalCounter.Builder.INSTANCE); return getT(metricName, metric, dimensions); }