Documentation ¶
Index ¶
- func AccessMetricDescriptor(uploadedMetricDescriptors map[string]*metric.MetricDescriptor, ...) (*metric.MetricDescriptor, error)
- func AccessSpan(index int, uploadedSpans []*cloudtrace.Span) *cloudtrace.Span
- func AddMetricDescriptor(uploadedMetricDescriptors map[string]*metric.MetricDescriptor, ...) error
- func AddPoint(timeSeries []*monitoring.TimeSeries, uploadedPoints map[string]*PreviousPoint)
- func AddSpans(spanData *SpanData, spans ...*cloudtrace.Span)
- func CheckForRequiredFields(requiredFields []string, reqReflect reflect.Value, requestName string) error
- func Delay(ctx context.Context, delay time.Duration) error
- func RemoveMetricDescriptor(uploadedMetricDescriptors map[string]*metric.MetricDescriptor, ...) error
- func ValidateCreateMetricDescriptor(metricDescriptor *metric.MetricDescriptor) error
- func ValidateCreateTimeSeries(timeSeries []*monitoring.TimeSeries, timeSeriesData *TimeSeriesData, ...) error
- func ValidateDuplicateErrDetails(err error, duplicateName string) bool
- func ValidateMissingFieldsErrDetails(err error, missingFields map[string]struct{}) bool
- func ValidateProjectName(projectName string) error
- func ValidateRateLimit(timeSeries []*monitoring.TimeSeries, uploadedPoints map[string]*PreviousPoint) error
- func ValidateRequiredFields(req interface{}) error
- func ValidateSpans(requestName string, spanData *SpanData, spans ...*cloudtrace.Span) error
- type DescriptorStatus
- type MetricDescriptorData
- type PreviousPoint
- type SpanData
- type TimeSeriesData
- type TimeSeriesStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccessMetricDescriptor ¶
func AccessMetricDescriptor(uploadedMetricDescriptors map[string]*metric.MetricDescriptor, metricType string) (*metric.MetricDescriptor, error)
AccessMetricDescriptor attempts to retrieve the given metric descriptor. If it does / exist, an error is returned.
func AccessSpan ¶
func AccessSpan(index int, uploadedSpans []*cloudtrace.Span) *cloudtrace.Span
AccessSpan returns the span at the given index if it is in range. If it is not in range, nil is returned.
func AddMetricDescriptor ¶
func AddMetricDescriptor(uploadedMetricDescriptors map[string]*metric.MetricDescriptor, metricType string, metricDescriptor *metric.MetricDescriptor) error
AddMetricDescriptor adds a new MetricDescriptor to the map if a duplicate type does not already exist. If a duplicate is detected, an error is returned.
func AddPoint ¶
func AddPoint(timeSeries []*monitoring.TimeSeries, uploadedPoints map[string]*PreviousPoint)
AddPoint sets the latest point to be the current point for a given time series.
func AddSpans ¶
func AddSpans(spanData *SpanData, spans ...*cloudtrace.Span)
AddSpans adds the given spans to the list of uploaded spans.
func CheckForRequiredFields ¶
func CheckForRequiredFields(requiredFields []string, reqReflect reflect.Value, requestName string) error
CheckForRequiredFields verifies that the required fields for the given request are present.
func Delay ¶
Delay will block for the specified amount of time. Used to delay writing spans to memory.
func RemoveMetricDescriptor ¶
func RemoveMetricDescriptor(uploadedMetricDescriptors map[string]*metric.MetricDescriptor, metricType string) error
RemoveMetricDescriptor attempts to delete the given metric descriptor. If it does not exist, an error is returned.
func ValidateCreateMetricDescriptor ¶
func ValidateCreateMetricDescriptor(metricDescriptor *metric.MetricDescriptor) error
func ValidateCreateTimeSeries ¶
func ValidateCreateTimeSeries(timeSeries []*monitoring.TimeSeries, timeSeriesData *TimeSeriesData, descriptors map[string]*metric.MetricDescriptor) error
ValidateCreateTimeSeries checks that the given TimeSeries conform to the API requirements.
func ValidateDuplicateErrDetails ¶
ValidateDuplicateErrDetails is used in tests to verify that the error returned contains the correct duplicated value.
func ValidateMissingFieldsErrDetails ¶
ValidateMissingFieldsErrDetails is used to test that the error details contain the correct missing fields.
func ValidateProjectName ¶
ValidateProjectName verifies that the project name from the BatchWriteSpans request is of the form projects/[PROJECT_ID]
func ValidateRateLimit ¶
func ValidateRateLimit(timeSeries []*monitoring.TimeSeries, uploadedPoints map[string]*PreviousPoint) error
ValidateRateLimit validates that the rate at which points are written does not exceed the limit. The limit is one point every 10 seconds.
func ValidateRequiredFields ¶
func ValidateRequiredFields(req interface{}) error
ValidateRequiredFields verifies that the given request contains the required fields.
func ValidateSpans ¶
ValidateSpans checks that the spans conform to the API requirements. That is, required fields are present, and optional fields are of the correct form. If any violations are detected, the errors will be added to the result table.
Types ¶
type DescriptorStatus ¶
type DescriptorStatus struct { MetricDescriptor *metric.MetricDescriptor Status string }
MetricDescriptorStatus wraps a MetricDescriptor with the status of its creation. Used in the MetricDescriptor summary table.
type MetricDescriptorData ¶
type MetricDescriptorData struct { UploadedMetricDescriptors map[string]*metric.MetricDescriptor MetricDescriptorSummary []*DescriptorStatus MetricDescriptorsLock sync.Mutex }
MetricDescriptorData is a wrapper struct for all the data that the server keeps with respect to metric descriptors.
type PreviousPoint ¶
PreviousPoint contains information about the most recently uploaded point for a time series.
type SpanData ¶
type SpanData struct { // If a batch has a bad span, we don't write batch to memory, but still want // info on them for summary, so need SpansSummary SpansSummary []*cloudtrace.Span UploadedSpanNames map[string]struct{} UploadedSpans []*cloudtrace.Span Mutex sync.RWMutex }
SpanData wraps all the span data on the server into a struct.
type TimeSeriesData ¶
type TimeSeriesData struct { UploadedPoints map[string]*PreviousPoint TimeSeriesSummary []*TimeSeriesStatus TimeSeriesLock sync.Mutex }
TimeSeriesData is a wrapper struct for all the data that the server keeps with respect to time series.
type TimeSeriesStatus ¶
type TimeSeriesStatus struct { TimeSeries *monitoring.TimeSeries Status string }
TimeSeriesStruct wraps a TimeSeries with the status of its creation. Used in the TimeSeries summary table.