Copyright 2020 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

package worker

import (
	
	
	

	
	
	
)

keyEnqueueStatus is a census tag used to keep track of the status of the modules being enqueued.
	keyEnqueueStatus = tag.MustNewKey("enqueue.status")
	enqueueStatus    = stats.Int64(
		"go-discovery/worker_enqueue_count",
		"The status of a module version enqueued to Cloud Tasks.",
		stats.UnitDimensionless,
EnqueueResponseCount counts worker enqueue responses by response type.
	EnqueueResponseCount = &view.View{
		Name:        "go-discovery/worker-enqueue/count",
		Measure:     enqueueStatus,
		Aggregation: view.Count(),
		Description: "Worker enqueue request count",
		TagKeys:     []tag.Key{keyEnqueueStatus},
	}

	processingLag = stats.Int64(
		"go-discovery/worker_processing_lag",
		"Time from appearing in the index to being processed.",
		stats.UnitSeconds,
	)
	ProcessingLag = &view.View{
		Name:        "go-discovery/worker_processing_lag",
		Measure:     processingLag,
		Aggregation: view.LastValue(),
		Description: "worker processing lag",
	}
)

func ( context.Context,  int) {
	stats.RecordWithTags(,
		[]tag.Mutator{tag.Upsert(keyEnqueueStatus, strconv.Itoa())},
		enqueueStatus.M(int64()))
}

func ( context.Context,  time.Duration) {
	stats.Record(, processingLag.M(.Milliseconds()/1000))