// printPointSummary prints a summarized view of the points in the store corresponding to the given requirements
164784
func printPointSummary(ctx context.Context, store *cassandra.CassandraStore, tables []cassandra.Table, metrics []Metric, fromUnix, toUnix, fix uint32) {
	for _, metric := range metrics {
		fmt.Println("## Metric", metric)
		for _, table := range tables {
			fmt.Println("### Table", table.Name)
			if fix != 0 {
				points := getSeries(ctx, store, table, metric.AMKey, fromUnix, toUnix, fix)
				printPointsSummary(points, fromUnix, toUnix)
			} else {
				igens, err := store.SearchTable(ctx, metric.AMKey, table, fromUnix, toUnix)
				if err != nil {
					panic(err)
				}
				printSummary(igens, fromUnix, toUnix)
			}
		}
	}
}
1134686
func getSummary(c context.Context, host string, project string, id int64) (*model.BuildSummary, error) {
	client, err := buildbucketClient(c, host, auth.AsProject, auth.WithProject(project))
	if err != nil {
		return nil, err
	}
	b, err := client.GetBuild(c, &buildbucketpb.GetBuildRequest{
		Id:     id,
		Fields: summaryBuildMask,
	})
	if err != nil {
		return nil, err
	}
	buildAddress := fmt.Sprintf("%d", b.Id)
	if b.Number != 0 {
		buildAddress = fmt.Sprintf("luci.%s.%s/%s/%d", b.Builder.Project, b.Builder.Bucket, b.Builder.Builder, b.Number)
	}

	// Note: The parent for buildbucket build summaries is currently a fake entity.
	// In the future, builds can be cached here, but we currently don't do that.
	buildKey := datastore.MakeKey(c, "buildbucket.Build", fmt.Sprintf("%s:%s", host, buildAddress))
	swarming := b.GetInfra().GetSwarming()

	bs := &model.BuildSummary{
		ProjectID:  b.Builder.Project,
		BuildKey:   buildKey,
		BuilderID:  BuilderID{*b.Builder}.String(),
		BuildID:    "buildbucket/" + buildAddress,
		BuildSet:   protoutil.BuildSets(b),
		ContextURI: []string{fmt.Sprintf("buildbucket://%s/build/%d", host, id)},
		Created:    mustTimestamp(b.CreateTime),
		Summary: model.Summary{
			Start:  mustTimestamp(b.StartTime),
			End:    mustTimestamp(b.EndTime),
			Status: statusMap[b.Status],
		},
		Version:      mustTimestamp(b.UpdateTime).UnixNano(),
		Experimental: b.GetInput().GetExperimental(),
	}
	if task := swarming.GetTaskId(); task != "" {
		bs.ContextURI = append(
			bs.ContextURI,
			fmt.Sprintf("swarming://%s/task/%s", swarming.GetHostname(), swarming.GetTaskId()))
	}
	return bs, nil
}
588909
func MessageSummary(msg Message) string {
	switch msg := msg.(type) {
	case *Init:
		return ""

	case *CreateSession:
		return fmt.Sprintf("blob_type=%s, max_updates=%d "+
			"reward_base=%d reward_rate=%d sweep_fee_rate=%d",
			msg.BlobType, msg.MaxUpdates, msg.RewardBase,
			msg.RewardRate, msg.SweepFeeRate)

	case *CreateSessionReply:
		return fmt.Sprintf("code=%d", msg.Code)

	case *StateUpdate:
		return fmt.Sprintf("seqnum=%d last_applied=%d is_complete=%d "+
			"hint=%x", msg.SeqNum, msg.LastApplied, msg.IsComplete,
			msg.Hint)

	case *StateUpdateReply:
		return fmt.Sprintf("code=%d last_applied=%d", msg.Code,
			msg.LastApplied)

	case *Error:
		return fmt.Sprintf("code=%d", msg.Code)

	default:
		return ""
	}
}
340523
func (h *hawkularSink) pointToLabeledMetricHeader(ms *core.MetricSet, metric core.LabeledMetric, timestamp time.Time) (*metrics.MetricHeader, error) {

	name := h.idName(ms, metric.Name)
	if resourceID, found := metric.Labels[core.LabelResourceID.Key]; found {
		name = h.idName(ms, metric.Name+separator+resourceID)
	}

	var value float64
	if metric.ValueType == core.ValueInt64 {
		value = float64(metric.IntValue)
	} else {
		value = float64(metric.FloatValue)
	}

	m := metrics.Datapoint{
		Value:     value,
		Timestamp: timestamp,
	}

	mh := &metrics.MetricHeader{
		ID:   name,
		Data: []metrics.Datapoint{m},
		Type: heapsterTypeToHawkularType(metric.MetricType),
	}

	return mh, nil
}
1167112
func GetLicenseSummary(ctx context.Context, license model.IssuedLicense) (string, error) {
	lclient, err := getClient()
	if err != nil {
		return "", err
	}

	cr, err := lclient.VerifyLicense(ctx, license)
	if err != nil {
		return "", err
	}
	return lclient.SummarizeLicense(cr, license.KeyID).String(), nil
}
315460
func (this *summaryMetricsSource) decodeSummary(summary *stats.Summary) map[string]*MetricSet {
	glog.V(9).Infof("Begin summary decode")
	result := map[string]*MetricSet{}

	labels := map[string]string{
		LabelNodename.Key: this.node.NodeName,
		LabelHostname.Key: this.node.HostName,
		LabelHostID.Key:   this.node.HostID,
	}

	this.decodeNodeStats(result, labels, &summary.Node)
	for _, pod := range summary.Pods {
		this.decodePodStats(result, labels, &pod)
	}

	glog.V(9).Infof("End summary decode")
	return result
}
338306
func (p *ReadOnlySchedulerClient) GetJobUpdateSummaries(ctx context.Context, jobUpdateQuery *JobUpdateQuery) (r *Response, err error) {
  var _args70 ReadOnlySchedulerGetJobUpdateSummariesArgs
  _args70.JobUpdateQuery = jobUpdateQuery
  var _result71 ReadOnlySchedulerGetJobUpdateSummariesResult
  if err = p.Client_().Call(ctx, "getJobUpdateSummaries", &_args70, &_result71); err != nil {
    return
  }
  return _result71.GetSuccess(), nil
}
157702
func printEndpointLabels(lbls *labels.OpLabels) {
	log.WithField(logfields.Labels, logfields.Repr(*lbls)).Debug("All Labels")
	w := tabwriter.NewWriter(os.Stdout, 2, 0, 3, ' ', 0)

	for _, v := range lbls.IdentityLabels() {
		text := color.Green("Enabled")
		fmt.Fprintf(w, "%s\t%s\n", v, text)
	}

	for _, v := range lbls.Disabled {
		text := color.Red("Disabled")
		fmt.Fprintf(w, "%s\t%s\n", v, text)
	}
	w.Flush()
}
468186
func GetSummary(query map[string]string, lastModifiedSince string) (*Summary, string, error) {
	summary := new(Summary)

	if lastModified, err := executeRequest("summary", query, lastModifiedSince, &summary); err != nil {
		return nil, "", err
	} else {
		return summary, lastModified, nil
	}
}
299068
func printGatewayCommonMsg(apiEndpoints []string) {
	// Get saved credentials.
	cred := globalServerConfig.GetCredential()

	apiEndpointStr := strings.Join(apiEndpoints, "  ")

	// Colorize the message and print.
	logger.StartupMessage(colorBlue("Endpoint: ") + colorBold(fmt.Sprintf(getFormatStr(len(apiEndpointStr), 1), apiEndpointStr)))
	if isTerminal() && !globalCLIContext.Anonymous {
		logger.StartupMessage(colorBlue("AccessKey: ") + colorBold(fmt.Sprintf("%s ", cred.AccessKey)))
		logger.StartupMessage(colorBlue("SecretKey: ") + colorBold(fmt.Sprintf("%s ", cred.SecretKey)))
	}
	printEventNotifiers()

	if globalIsBrowserEnabled {
		logger.StartupMessage(colorBlue("\nBrowser Access:"))
		logger.StartupMessage(fmt.Sprintf(getFormatStr(len(apiEndpointStr), 3), apiEndpointStr))
	}
}
300577
func (al *archiveLogger) LogSummary(ctx context.Context, hits, misses int64, bytesHit, bytesPushed units.Size, digests []string) {
	end := time.Now()

	if !al.quiet {
		duration := end.Sub(al.start)
		fmt.Fprintf(os.Stderr, "Hits    : %5d (%s)\n", hits, bytesHit)
		fmt.Fprintf(os.Stderr, "Misses  : %5d (%s)\n", misses, bytesPushed)
		fmt.Fprintf(os.Stderr, "Duration: %s\n", units.Round(duration, time.Millisecond))
	}
}
1331747
func (s *Policy) SetPolicySummary(v *PolicySummary) *Policy {
	s.PolicySummary = v
	return s
}
212681
func StatusSummary() (maxSecondsBehindMaster int64, binlogPlayersCount int32) {
	return globalStats.maxSecondsBehindMaster(), int32(globalStats.numControllers())
}
175235
func (o *Domain) NSGatewaySummaries(info *bambou.FetchingInfo) (NSGatewaySummariesList, *bambou.Error) {

	var list NSGatewaySummariesList
	err := bambou.CurrentSession().FetchChildren(o, NSGatewaySummaryIdentity, &list, info)
	return list, err
}
159811
func GetBuildSummary(c context.Context, id int64) (*model.BuildSummary, error) {
	// The host is set to prod because buildbot is hardcoded to talk to prod.
	uri := fmt.Sprintf("buildbucket://cr-buildbucket.appspot.com/build/%d", id)
	bs := make([]*model.BuildSummary, 0, 1)
	q := datastore.NewQuery("BuildSummary").Eq("ContextURI", uri).Limit(1)
	switch err := datastore.GetAll(c, q, &bs); {
	case err != nil:
		return nil, common.ReplaceNSEWith(err.(errors.MultiError), ErrNotFound)
	case len(bs) == 0:
		return nil, ErrNotFound
	default:
		return bs[0], nil
	}
}
34582
func (c *CheckRunOutput) GetSummary() string {
	if c == nil || c.Summary == nil {
		return ""
	}
	return *c.Summary
}
1198878
func (c *JobStatusCommand) outputJobSummary(client *api.Client, job *api.Job) error {
	// Query the summary
	summary, _, err := client.Jobs().Summary(*job.ID, nil)
	if err != nil {
		return fmt.Errorf("Error querying job summary: %s", err)
	}

	if summary == nil {
		return nil
	}

	periodic := job.IsPeriodic()
	parameterizedJob := job.IsParameterized()

	// Print the summary
	if !periodic && !parameterizedJob {
		c.Ui.Output(c.Colorize().Color("\n[bold]Summary[reset]"))
		summaries := make([]string, len(summary.Summary)+1)
		summaries[0] = "Task Group|Queued|Starting|Running|Failed|Complete|Lost"
		taskGroups := make([]string, 0, len(summary.Summary))
		for taskGroup := range summary.Summary {
			taskGroups = append(taskGroups, taskGroup)
		}
		sort.Strings(taskGroups)
		for idx, taskGroup := range taskGroups {
			tgs := summary.Summary[taskGroup]
			summaries[idx+1] = fmt.Sprintf("%s|%d|%d|%d|%d|%d|%d",
				taskGroup, tgs.Queued, tgs.Starting,
				tgs.Running, tgs.Failed,
				tgs.Complete, tgs.Lost,
			)
		}
		c.Ui.Output(formatList(summaries))
	}

	// Always display the summary if we are periodic or parameterized, but
	// only display if the summary is non-zero on normal jobs
	if summary.Children != nil && (parameterizedJob || periodic || summary.Children.Sum() > 0) {
		if parameterizedJob {
			c.Ui.Output(c.Colorize().Color("\n[bold]Parameterized Job Summary[reset]"))
		} else {
			c.Ui.Output(c.Colorize().Color("\n[bold]Children Job Summary[reset]"))
		}
		summaries := make([]string, 2)
		summaries[0] = "Pending|Running|Dead"
		summaries[1] = fmt.Sprintf("%d|%d|%d",
			summary.Children.Pending, summary.Children.Running, summary.Children.Dead)
		c.Ui.Output(formatList(summaries))
	}

	return nil
}