Java Code Examples for io.opencensus.stats.Stats#getStatsRecorder()

The following examples show how to use io.opencensus.stats.Stats#getStatsRecorder() . 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: HttpServerHandler.java    From opencensus-java with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a {@link HttpServerHandler} with given parameters.
 *
 * @param tracer the Open Census tracing component.
 * @param extractor the {@code HttpExtractor} used to extract information from the
 *     request/response.
 * @param textFormat the {@code TextFormat} used in HTTP propagation.
 * @param getter the getter used when extracting information from the {@code carrier}.
 * @param publicEndpoint set to true for publicly accessible HTTP(S) server. If true then incoming
 *     tracecontext will be added as a link instead of as a parent.
 * @since 0.19
 */
public HttpServerHandler(
    Tracer tracer,
    HttpExtractor<Q, P> extractor,
    TextFormat textFormat,
    TextFormat.Getter<C> getter,
    Boolean publicEndpoint) {
  super(extractor);
  checkNotNull(tracer, "tracer");
  checkNotNull(textFormat, "textFormat");
  checkNotNull(getter, "getter");
  checkNotNull(publicEndpoint, "publicEndpoint");
  this.tracer = tracer;
  this.textFormat = textFormat;
  this.getter = getter;
  this.publicEndpoint = publicEndpoint;
  this.statsRecorder = Stats.getStatsRecorder();
  this.tagger = Tags.getTagger();
}
 
Example 2
Source File: HttpClientHandler.java    From opencensus-java with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a {@link HttpClientHandler} with given parameters.
 *
 * @param tracer the Open Census tracing component.
 * @param extractor the {@code HttpExtractor} used to extract information from the
 *     request/response.
 * @param textFormat the {@code TextFormat} used in HTTP propagation.
 * @param setter the setter used when injecting information to the {@code carrier}.
 * @since 0.19
 */
public HttpClientHandler(
    Tracer tracer,
    HttpExtractor<Q, P> extractor,
    TextFormat textFormat,
    TextFormat.Setter<C> setter) {
  super(extractor);
  checkNotNull(setter, "setter");
  checkNotNull(textFormat, "textFormat");
  checkNotNull(tracer, "tracer");
  this.setter = setter;
  this.textFormat = textFormat;
  this.tracer = tracer;
  this.statsRecorder = Stats.getStatsRecorder();
  this.tagger = Tags.getTagger();
}
 
Example 3
Source File: CensusStatsModule.java    From grpc-nebula-java with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a {@link CensusStatsModule} with the default OpenCensus implementation.
 */
CensusStatsModule(Supplier<Stopwatch> stopwatchSupplier, boolean propagateTags) {
  this(
      Tags.getTagger(),
      Tags.getTagPropagationComponent().getBinarySerializer(),
      Stats.getStatsRecorder(),
      stopwatchSupplier,
      propagateTags);
}
 
Example 4
Source File: CensusStatsModule.java    From grpc-java with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a {@link CensusStatsModule} with the default OpenCensus implementation.
 */
CensusStatsModule(Supplier<Stopwatch> stopwatchSupplier,
    boolean propagateTags, boolean recordStartedRpcs, boolean recordFinishedRpcs,
    boolean recordRealTimeMetrics) {
  this(
      Tags.getTagger(),
      Tags.getTagPropagationComponent().getBinarySerializer(),
      Stats.getStatsRecorder(),
      stopwatchSupplier,
      propagateTags, recordStartedRpcs, recordFinishedRpcs, recordRealTimeMetrics);
}