congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
RequestLog.startTiming
Code IndexAdd Tabnine to your IDE (free)

How to use
startTiming
method
in
com.yahoo.bard.webservice.logging.RequestLog

Best Java code snippets using com.yahoo.bard.webservice.logging.RequestLog.startTiming (Showing top 20 results out of 315)

origin: yahoo/fili

/**
 * Start a stopwatch.
 * Time is accumulated if the stopwatch is already registered
 *
 * @param caller  the caller to name this stopwatch with its class's simple name
 *
 * @return The stopwatch
 */
public static TimedPhase startTiming(Object caller) {
  return startTiming(caller.getClass().getSimpleName());
}
origin: com.yahoo.fili/fili-core

@Override
public void filter(final ContainerRequestContext request) {
  RequestLog.startTiming("TestLogWrapper");
}
origin: yahoo/fili

@Override
public void filter(final ContainerRequestContext request) {
  RequestLog.startTiming("TestLogWrapper");
}
origin: yahoo/fili

@Override
public void filter(final ClientRequestContext request) {
  RequestLog.startTiming("TestLogWrapper");
}
origin: com.yahoo.fili/fili-core

@Override
public void filter(final ClientRequestContext request) {
  RequestLog.startTiming("TestLogWrapper");
}
origin: yahoo/fili

/**
 * Stop the most recent stopwatch and start this one.
 * Time is accumulated if the stopwatch is already registered.
 *
 * @param nextPhase  the name of the stopwatch to be started
 *
 * @deprecated This method is too dependent on context that can be too easily changed by internal method calls.
 * Each timer should be explicitly started by {@link RequestLog#startTiming(String)} and stopped by
 * {@link RequestLog#stopTiming(String)} instead
 */
@Deprecated
public static void switchTiming(String nextPhase) {
  stopMostRecentTimer();
  startTiming(nextPhase);
}
origin: yahoo/fili

  /**
   * Stop the request timer, start the response timer, and then invoke the failure callback code.
   *
   * @param error  The error that caused the failure
   */
  default void dispatch(Throwable error) {
    RequestLog.stopTiming(REQUEST_WORKFLOW_TIMER);
    RequestLog.startTiming(RESPONSE_WORKFLOW_TIMER);
    invoke(error);
  }
}
origin: yahoo/fili

@Override
@Deprecated
public Filter getQueryFilter() {
  try (TimedPhase timer = RequestLog.startTiming("BuildingDruidFilter")) {
    return filterBuilder.buildFilters(this.apiFilters);
  } catch (FilterBuilderException e) {
    LOG.debug(e.getMessage());
    throw new BadApiRequestException(e);
  }
}
origin: yahoo/fili

/**
 * Intercept Client request and add start timestamp.
 *
 * @param request  Request to intercept
 *
 * @throws IOException if there's a problem processing the request
 */
@Override
public void filter(ClientRequestContext request) throws IOException {
  appendRequestId(request.getStringHeaders().getFirst(X_REQUEST_ID_HEADER));
  RequestLog.startTiming(CLIENT_TOTAL_TIMER);
  request.setProperty(PROPERTY_NANOS, System.nanoTime());
}
origin: yahoo/fili

  @Override
  public void onThrowable(Throwable t) {
    RequestLog.restore(logCtx);
    RequestLog.stopTiming(timerName);
    if (outstanding.decrementAndGet() == 0) {
      RequestLog.startTiming(RESPONSE_WORKFLOW_TIMER);
    }
    exceptionMeter.mark();
    LOG.error("druid {} request failed:", serviceConfig.getNameAndUrl(), t);
    failure.invoke(t);
  }
});
origin: yahoo/fili

  /**
   * Stop the request timer, start the response timer, and then invoke the error callback code.
   *
   * @param statusCode  Http status code of the error response
   * @param reasonPhrase  The reason for the error. Often the status code description.
   * @param responseBody  The body of the error response
   */
  default void dispatch(int statusCode, String reasonPhrase, String responseBody) {
    RequestLog.stopTiming(REQUEST_WORKFLOW_TIMER);
    RequestLog.startTiming(RESPONSE_WORKFLOW_TIMER);
    invoke(statusCode, reasonPhrase, responseBody);
  }
}
origin: yahoo/fili

  @Override
  public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
      throws IOException {
    RequestLog.startTiming(this);
    MultivaluedMap<String, Object> headers = responseContext.getHeaders();

    String origin = requestContext.getHeaderString("origin");
    if (origin == null || "".equals(origin)) {
      headers.add("Access-Control-Allow-Origin", "*");
    } else {
      headers.add("Access-Control-Allow-Origin", origin);
    }

    String requestedHeaders = requestContext.getHeaderString("access-control-request-headers");
    // allow all requested headers
    headers.add("Access-Control-Allow-Headers", requestedHeaders == null ? "" : requestedHeaders);

    headers.add("Access-Control-Allow-Methods", "GET, POST, DELETE, OPTIONS, PUT, PATCH");
    headers.add("Access-Control-Allow-Credentials", "true");
    RequestLog.stopTiming(this);
  }
}
origin: yahoo/fili

@Override
public void filter(ContainerRequestContext requestContext) throws IOException {
  RequestLog.startTiming(this);
  String path = requestContext.getUriInfo().getAbsolutePath().getPath();
  if (path.startsWith("/v1/data") || path.startsWith("/data")) {
    // See if we have any unhealthy checks
    Map<String, Result> unhealthyChecks = getUnhealthy();
    StringBuilder debugMsgBuilder = builderErrorResponseBody(requestContext);
    if (!unhealthyChecks.keySet().isEmpty()) {
      unhealthyChecks.forEach((key, value) -> LOG.error("Healthcheck '{}' failed: {}", key, value));
      RequestLog.stopTiming(this);
      debugMsgBuilder.insert(0, "Service is unhealthy. At least 1 healthcheck is failing\n");
      requestContext.abortWith(
          Response.status(Status.SERVICE_UNAVAILABLE)
              .entity(debugMsgBuilder.toString())
              .build()
      );
      return;
    }
  }
  RequestLog.stopTiming(this);
}
origin: yahoo/fili

/**
 * Get the timezone for the request.
 *
 * @param timeZoneId  String of the TimeZone ID
 * @param systemTimeZone  TimeZone of the system to use if there is no timeZoneId
 *
 * @return the request's TimeZone
 */
protected DateTimeZone generateTimeZone(String timeZoneId, DateTimeZone systemTimeZone) {
  try (TimedPhase timer = RequestLog.startTiming("generatingTimeZone")) {
    if (timeZoneId == null) {
      return systemTimeZone;
    }
    try {
      return DateTimeZone.forID(timeZoneId);
    } catch (IllegalArgumentException ignored) {
      LOG.debug(INVALID_TIME_ZONE.logFormat(timeZoneId));
      throw new BadApiRequestException(INVALID_TIME_ZONE.format(timeZoneId));
    }
  }
}
origin: yahoo/fili

/**
 * Intercept the Container request to add length of request and a start timestamp.
 *
 * @param request  Request to intercept
 *
 * @throws IOException if there's a problem processing the request
 */
@Override
public void filter(ContainerRequestContext request) throws IOException {
  appendRequestId(request.getHeaders().getFirst(X_REQUEST_ID_HEADER));
  RequestLog.startTiming(TOTAL_TIMER);
  try (TimedPhase timer = RequestLog.startTiming(this)) {
    RequestLog.record(new Preface(request));
    // sets PROPERTY_REQ_LEN if content-length not defined
    lengthOfRequestEntity(request);
    // store start time to later calculate elapsed time
    request.setProperty(PROPERTY_NANOS, System.nanoTime());
  }
}
origin: yahoo/fili

/**
 * Accept request and reply with webapp exception and a simple string message.
 *
 * @param uriInfo  Information about the URL for the request
 */
@GET
@Timed(name = "logTimed")
@Metered(name = "logMetered")
@ExceptionMetered(name = "logException")
@Produces(MediaType.APPLICATION_JSON)
@Path("/webbug")
public void getFailWithWebAppException(@Context UriInfo uriInfo) {
  RequestLog.startTiming(this);
  try {
    Thread.sleep(200);
    throw new WebApplicationException(
        Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("Oops! Web App Exception").build()
    );
  } catch (InterruptedException ignore) {
    // Do nothing
  }
}
origin: com.yahoo.fili/fili-core

/**
 * Accept request and reply with webapp exception and a simple string message.
 *
 * @param uriInfo  Information about the URL for the request
 */
@GET
@Timed(name = "logTimed")
@Metered(name = "logMetered")
@ExceptionMetered(name = "logException")
@Produces(MediaType.APPLICATION_JSON)
@Path("/webbug")
public void getFailWithWebAppException(@Context UriInfo uriInfo) {
  RequestLog.startTiming(this);
  try {
    Thread.sleep(200);
    throw new WebApplicationException(
        Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("Oops! Web App Exception").build()
    );
  } catch (InterruptedException ignore) {
    // Do nothing
  }
}
origin: yahoo/fili

  /**
   * Accept request and reply with a generic runtime exception and a simple string message.
   *
   * @param uriInfo  Information about the URL for the request
   */
  @GET
  @Timed(name = "logTimed")
  @Metered(name = "logMetered")
  @ExceptionMetered(name = "logException")
  @Produces(MediaType.APPLICATION_JSON)
  @Path("/genericbug")
  public void getFailWithRuntimeException(@Context UriInfo uriInfo) {
    RequestLog.startTiming(this);
    try {
      Thread.sleep(200);
      throw new RuntimeException("Oops! Generic Exception");
    } catch (InterruptedException ignore) {
      // Do nothing
    }
  }
}
origin: com.yahoo.fili/fili-core

  /**
   * Accept request and reply with a generic runtime exception and a simple string message.
   *
   * @param uriInfo  Information about the URL for the request
   */
  @GET
  @Timed(name = "logTimed")
  @Metered(name = "logMetered")
  @ExceptionMetered(name = "logException")
  @Produces(MediaType.APPLICATION_JSON)
  @Path("/genericbug")
  public void getFailWithRuntimeException(@Context UriInfo uriInfo) {
    RequestLog.startTiming(this);
    try {
      Thread.sleep(200);
      throw new RuntimeException("Oops! Generic Exception");
    } catch (InterruptedException ignore) {
      // Do nothing
    }
  }
}
origin: yahoo/fili

/**
 * Accept request and reply with OK.
 *
 * @param uriInfo  Information about the URL for the request
 * @param asyncResponse  The response object to send the final response to
 */
@GET
@Timed(name = "logTimed")
@Metered(name = "logMetered")
@ExceptionMetered(name = "logException")
@Produces(MediaType.APPLICATION_JSON)
@Path("/log")
public void getSucceed(@Context UriInfo uriInfo, @Suspended AsyncResponse asyncResponse) {
  RequestLog.startTiming(this);
  try {
    Thread.sleep(200);
  } catch (InterruptedException ignore) {
    // Do nothing
  }
  RequestLog.stopTiming(this);
  Response response = Response.status(Response.Status.OK).build();
  asyncResponse.resume(response);
}
com.yahoo.bard.webservice.loggingRequestLogstartTiming

Javadoc

Start a stopwatch. Time is accumulated if the stopwatch is already registered

Popular methods of RequestLog

  • dump
  • restore
  • copy
    Exports a snapshot of the request log of the current thread without resetting the request log for th
  • log
  • stopTiming
  • <init>
    Copy constructor is also private.
  • accumulate
    Accumulates timings and threads to current thread's request log context. It fills in the contents fo
  • addIdPrefix
    Prepend an id prefix to generated druid query id.
  • aggregateDurations
    Adds the durations in milliseconds of all the recorded timed phases to a map.
  • clear
    Resets the contents of a request log at the calling thread.
  • durations
    Adds the durations in milliseconds of all the recorded timed phases to a map.
  • export
    Exports current thread's request log object as a formatted string without resetting it.
  • durations,
  • export,
  • getId,
  • getLoginfoOrder,
  • init,
  • isRunning,
  • record,
  • registerTime,
  • retrieve

Popular in Java

  • Making http post requests using okhttp
  • getContentResolver (Context)
  • getSharedPreferences (Context)
  • onCreateOptionsMenu (Activity)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Option (scala)
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now