Stackdriver

The stackdriver adapter enables Istio to deliver log, metric and traces to theStackdriver backend.

This adapter supports the metric template,the logentry template,and the tracespan template.

Params

Configuration format for the stackdriver adapter.

FieldTypeDescriptionRequired
endpointstringEndpoint URL to send stackdriver data - leave empty to use theStackDriver SDK’s default value (monitoring.googleapis.com).No
projectIdstringGCP Project to attach metrics to.No
pushIntervalDurationThis adapter batches the data it sends to Stackdriver; we will push to stackdriver every push_interval.If no value is provided we default to once per minute.No
appCredentialsbool (oneof)Use Google’s Application Default Credentials to authorize calls madeby the StackDriver SDK.See Google’s documentation.Yes
apiKeystring (oneof)The API Key to be used for auth. API Key is no longer supported, use service account instead.Yes
serviceAccountPathstring (oneof)The path to a Google service account credential file, relative tothe Mixer. E.g. /etc/opt/mixer/gcp-serviceaccount-creds.jsonor ./testdata/my-test-account-creds.json.Yes
metricInfomap<string, MetricInfo>A map of Istio metric name to Stackdriver metric info.No
logInfomap<string, LogInfo>A map of Istio LogEntry name to Stackdriver log info.No
traceTraceStackdriver Trace configuration.No

Params.LogInfo

Describes how to represent an Istio Log in Stackdriver.

FieldTypeDescriptionRequired
labelNamesstring[]The logging template provides a set of variables; these list the subset of variables that should be used toform Stackdriver labels for the log entry.No
payloadTemplatestringA golang text/template template that will be executed to construct the payload for this log entry.It will be given the full set of variables for the log to use to construct its result.No
httpMappingHttpRequestMappingIf an HttpRequestMapping is provided, a HttpRequest object will be filled out for this log entry using thevariables named in the mapping to populate the fields of the request struct from the instance’s variables.No
sinkInfoSinkInfoIf SinkInfo is provided, Stackriver logs would be exported to that sink.No

Params.LogInfo.HttpRequestMapping

Maps from template variable names to the various fields of Stackdriver’s HTTP request struct.See https://godoc.org/cloud.google.com/go/logging#HTTPRequest

FieldTypeDescriptionRequired
statusstringtemplate variable name to map into HTTPRequest.StatusNo
requestSizestringtemplate variable name to map into HTTPRequest.RequestSizeNo
responseSizestringtemplate variable name to map into HTTPRequest.ResponseSizeNo
latencystringtemplate variable name to map into HTTPRequest.LatencyNo
localIpstringtemplate variable name to map into HTTPRequest.LocalIPNo
remoteIpstringtemplate variable name to map into HTTPRequest.RemoteIPNo
urlstringtemplate variable name to map into HTTPRequest.Request.UrlNo
methodstringtemplate variable name to map into HTTPRequest.RequestMethodNo
userAgentstringtemplate variable name to map into HTTPRequest.UserAgentNo
refererstringtemplate variable name to map into HTTPRequest.RefererNo

Params.LogInfo.SinkInfo

Contains information about sink to export Stackdriver logs to.See https://godoc.org/cloud.google.com/go/logging/logadmin#Sink.Ex: If you want to export it to a GCS bucket, id would be a unique idetifier you want for the sink,destination would be the storage be name of GCS Storage bucket and filter would be user defined condition forfiltering logs. See below for a sample config:

  1. id: 'info-errors-to-gcs'
  2. destination: 'storage.googleapis.com/<bucket_name>'
  3. filter: 'severity >= Default'
FieldTypeDescriptionRequired
idstringClient assigned sink identifier.No
destinationstringExport Destination.No
filterstringFilter that specifies any filtering to be done on logs.No
UniqueWriterIdentityboolDetermines the kind of IAM identity returned as WriterIdentity in the newsink. If this value is omitted or set to false, and if the sink’s parent is aproject, then the value returned as WriterIdentity is the same group orservice account used by Stackdriver Logging before the addition of writeridentities to the API. The sink’s destination must be in the same project asthe sink itself.If this field is set to true, or if the sink is owned by a non-projectresource such as an organization, then the value of WriterIdentity willbe a unique service account used only for exports from the new sink.No
UpdateDestinationboolThese fields apply only to UpdateSinkOpt calls. The corresponding sink fieldis updated if and only if the Update field is true.Upate sink destination.No
UpdateFilterboolUpdate sink filter.No
UpdateIncludeChildrenboolUpdate includes children.No

Params.MetricInfo

Describes how to represent an Istio metric in Stackdriver.See https://github.com/googleapis/googleapis/blob/master/google/api/metric.proto

FieldTypeDescriptionRequired
kindMetricKindThe kind of measurement for a metric, which describes how the data is reported. Ex: Gauge.No
valueValueTypeThe type of the metric’s value. Ex: Distribution.No
bucketsBucketsDefinitionFor metrics with a metric value of DISTRIBUTION, this provides a mechanismfor configuring the buckets that will be used to store the aggregated values.This field must be provided for metrics declared to be of type DISTRIBUTION.This field will be ignored for non-distribution metric kinds.No
metricTypestringStackdriver metric type name, e.g.istio.io/service/server/request_count. If this is not provided, aconcantenation of custom metric prefix (custom.googleapis.com/) andIstio metric name will be used.No

Params.MetricInfo.BucketsDefinition

Describes buckets for DISTRIBUTION valued metrics.TODO: look into using google.api.distribution.proto instead - we would pull it in but it has a ton ofdependencies it doesn’t actually use.

FieldTypeDescriptionRequired
linearBucketsLinear (oneof)The linear buckets.Yes
exponentialBucketsExponential (oneof)The exponential buckets.Yes
explicitBucketsExplicit (oneof)The explicit buckets.Yes

Params.MetricInfo.BucketsDefinition.Explicit

Specifies a set of buckets with arbitrary widths.

There are size(bounds) + 1 (= N) buckets. Bucket i has the followingboundaries:

  • Upper bound (0 <= i < N-1): bounds[i]
  • Lower bound (1 <= i < N): bounds[i - 1]The bounds field must contain at least one element. If bounds hasonly one element, then there are no finite buckets, and that singleelement is the common boundary of the overflow and underflow buckets.
FieldTypeDescriptionRequired
boundsdouble[]The values must be monotonically increasing.No

Params.MetricInfo.BucketsDefinition.Exponential

Specifies an exponential sequence of buckets that have a width that isproportional to the value of the lower bound. Each bucket represents aconstant relative uncertainty on a specific value in the bucket.

There are num_finite_buckets + 2 (= N) buckets. The two additionalbuckets are the underflow and overflow buckets.

Bucket i has the following boundaries:

  • Upper bound (0 <= i < N-1): scale * (growth_factor ^ i)
  • Lower bound (1 <= i < N): scale * (growth_factor ^ (i - 1))
    FieldTypeDescriptionRequired
    numFiniteBucketsint32Must be greater than 0.No
    growthFactordoubleMust be greater than 1.No
    scaledoubleMust be greater than 0.No

Params.MetricInfo.BucketsDefinition.Linear

Specifies a linear sequence of buckets that all have the same width(except overflow and underflow). Each bucket represents a constantabsolute uncertainty on the specific value in the bucket.

There are num_finite_buckets + 2 (= N) buckets. The two additionalbuckets are the underflow and overflow buckets.

Bucket i has the following boundaries:

  • Upper bound (0 <= i < N-1): offset + (width * i)
  • Lower bound (1 <= i < N): offset + (width * (i - 1))
    FieldTypeDescriptionRequired
    numFiniteBucketsint32Must be greater than 0.No
    widthdoubleMust be greater than 0.No
    offsetdoubleLower bound of the first bucket.No

Params.Trace

Details of Stackdriver Trace configuration for tracespan template.

FieldTypeDescriptionRequired
sampleProbabilitydoubleProability that a particular trace ID will be sampled.No

google.api.MetricDescriptor.MetricKind

The kind of measurement. It describes how the data is reported.

NameDescription
METRIC_KIND_UNSPECIFIEDDo not use this default value.
GAUGEAn instantaneous measurement of a value.
DELTAThe change in a value during a time interval.
CUMULATIVEA value accumulated over a time interval. Cumulativemeasurements in a time series should have the same start timeand increasing end times, until an event resets the cumulativevalue to zero and sets a new start time for the followingpoints.

google.api.MetricDescriptor.ValueType

The value type of a metric.

NameDescription
VALUETYPE_UNSPECIFIEDDo not use this default value.
BOOLThe value is a boolean.This value type can be used only if the metric kind is GAUGE.
INT64The value is a signed 64-bit integer.
DOUBLEThe value is a double precision floating point number.
STRINGThe value is a text string.This value type can be used only if the metric kind is GAUGE.
DISTRIBUTIONThe value is a Distribution_.
MONEYThe value is money.