Java Code Examples for io.opencensus.stats.View#Name

The following examples show how to use io.opencensus.stats.View#Name . 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: MeasureToViewMap.java    From opencensus-java with Apache License 2.0 6 votes vote down vote up
@javax.annotation.Nullable
private synchronized MutableViewData getMutableViewData(View.Name viewName) {
  View view = registeredViews.get(viewName);
  if (view == null) {
    return null;
  }
  Collection<MutableViewData> views = mutableMap.get(view.getMeasure().getName());
  for (MutableViewData viewData : views) {
    if (viewData.getView().getName().equals(viewName)) {
      return viewData;
    }
  }
  throw new AssertionError(
      "Internal error: Not recording stats for view: \""
          + viewName
          + "\" registeredViews="
          + registeredViews
          + ", mutableMap="
          + mutableMap);
}
 
Example 2
Source File: StatszZPageHandler.java    From opencensus-java with Apache License 2.0 6 votes vote down vote up
private static void emitViewData(
    /*@Nullable*/ ViewData viewData, View.Name viewName, PrintWriter out, Formatter formatter) {
  if (viewData == null) {
    formatter.format("<p class=\"view\">No Stats found for View %s.</p>", viewName.asString());
    return;
  }
  View view = viewData.getView();
  emitViewInfo(view, viewData.getWindowData(), out, formatter);
  formatter.format("<p class=\"view\">Stats for View: %s</p>", view.getName().asString());

  formatter.format("<table cellspacing=0 cellpadding=0>");
  emitViewDataTableHeader(view, out, formatter);
  for (Entry<List</*@Nullable*/ TagValue>, AggregationData> entry :
      viewData.getAggregationMap().entrySet()) {
    emitViewDataRow(view, entry, out, formatter);
  }
  out.write("</table>");
  out.write("<p></p>");
}
 
Example 3
Source File: StatsManager.java    From opencensus-java with Apache License 2.0 4 votes vote down vote up
@Nullable
ViewData getView(View.Name viewName) {
  return measureToViewMap.getView(viewName, clock, state.getInternal());
}
 
Example 4
Source File: MeasureToViewMap.java    From opencensus-java with Apache License 2.0 4 votes vote down vote up
/** Returns a {@link ViewData} corresponding to the given {@link View.Name}. */
@javax.annotation.Nullable
synchronized ViewData getView(View.Name viewName, Clock clock, State state) {
  MutableViewData view = getMutableViewData(viewName);
  return view == null ? null : view.toViewData(clock.now(), state);
}
 
Example 5
Source File: ViewManagerImpl.java    From opencensus-java with Apache License 2.0 4 votes vote down vote up
@Override
@Nullable
public ViewData getView(View.Name viewName) {
  return statsManager.getView(viewName);
}
 
Example 6
Source File: ViewManagerImplTest.java    From opencensus-java with Apache License 2.0 4 votes vote down vote up
private static View createCumulativeView(
    View.Name name, Measure measure, Aggregation aggregation, List<TagKey> keys) {
  return View.create(name, VIEW_DESCRIPTION, measure, aggregation, keys, CUMULATIVE);
}
 
Example 7
Source File: StatszZPageHandler.java    From opencensus-java with Apache License 2.0 4 votes vote down vote up
TreeNode(View.Name viewName) {
  this.viewName = checkNotNull(viewName, "view name");
}
 
Example 8
Source File: RpcViewsTest.java    From opencensus-java with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public ViewData getView(View.Name view) {
  throw new UnsupportedOperationException();
}