vendor: update vendor to pick up trace changes
Change-Id: I497019b66fa94186d0d55a2a1a952234ac7b37f5
Reviewed-on: https://go-review.googlesource.com/76731
Reviewed-by: Ross Light <light@google.com>
diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json
index 099a10a..7e01d9d 100644
--- a/Godeps/Godeps.json
+++ b/Godeps/Godeps.json
@@ -8,38 +8,38 @@
"Deps": [
{
"ImportPath": "cloud.google.com/go/compute/metadata",
- "Comment": "v0.13.0-17-g4b5faa4",
- "Rev": "4b5faa47331c50b3f75616de199da5fea9c50bea"
+ "Comment": "v0.16.0",
+ "Rev": "2d3a6656c17a60b0815b7e06ab0be04eacb6e613"
},
{
"ImportPath": "cloud.google.com/go/internal/tracecontext",
- "Comment": "v0.13.0-17-g4b5faa4",
- "Rev": "4b5faa47331c50b3f75616de199da5fea9c50bea"
+ "Comment": "v0.16.0",
+ "Rev": "2d3a6656c17a60b0815b7e06ab0be04eacb6e613"
},
{
"ImportPath": "cloud.google.com/go/internal/version",
- "Comment": "v0.13.0-17-g4b5faa4",
- "Rev": "4b5faa47331c50b3f75616de199da5fea9c50bea"
+ "Comment": "v0.16.0",
+ "Rev": "2d3a6656c17a60b0815b7e06ab0be04eacb6e613"
},
{
"ImportPath": "cloud.google.com/go/logging",
- "Comment": "v0.13.0-17-g4b5faa4",
- "Rev": "4b5faa47331c50b3f75616de199da5fea9c50bea"
+ "Comment": "v0.16.0",
+ "Rev": "2d3a6656c17a60b0815b7e06ab0be04eacb6e613"
},
{
"ImportPath": "cloud.google.com/go/logging/apiv2",
- "Comment": "v0.13.0-17-g4b5faa4",
- "Rev": "4b5faa47331c50b3f75616de199da5fea9c50bea"
+ "Comment": "v0.16.0",
+ "Rev": "2d3a6656c17a60b0815b7e06ab0be04eacb6e613"
},
{
"ImportPath": "cloud.google.com/go/logging/internal",
- "Comment": "v0.13.0-17-g4b5faa4",
- "Rev": "4b5faa47331c50b3f75616de199da5fea9c50bea"
+ "Comment": "v0.16.0",
+ "Rev": "2d3a6656c17a60b0815b7e06ab0be04eacb6e613"
},
{
"ImportPath": "cloud.google.com/go/trace",
- "Comment": "v0.13.0-17-g4b5faa4",
- "Rev": "4b5faa47331c50b3f75616de199da5fea9c50bea"
+ "Comment": "v0.16.0",
+ "Rev": "2d3a6656c17a60b0815b7e06ab0be04eacb6e613"
},
{
"ImportPath": "github.com/bradfitz/gomemcache/memcache",
diff --git a/vendor/cloud.google.com/go/internal/version/version.go b/vendor/cloud.google.com/go/internal/version/version.go
index 321f3c8..513afa4 100644
--- a/vendor/cloud.google.com/go/internal/version/version.go
+++ b/vendor/cloud.google.com/go/internal/version/version.go
@@ -26,7 +26,7 @@
// Repo is the current version of the client libraries in this
// repo. It should be a date in YYYYMMDD format.
-const Repo = "20170915"
+const Repo = "20170928"
// Go returns the Go runtime version. The returned string
// has no whitespace.
diff --git a/vendor/cloud.google.com/go/logging/apiv2/config_client.go b/vendor/cloud.google.com/go/logging/apiv2/config_client.go
index 3df8653..99857a1 100644
--- a/vendor/cloud.google.com/go/logging/apiv2/config_client.go
+++ b/vendor/cloud.google.com/go/logging/apiv2/config_client.go
@@ -29,15 +29,21 @@
loggingpb "google.golang.org/genproto/googleapis/logging/v2"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
+ "google.golang.org/grpc/metadata"
)
// ConfigCallOptions contains the retry settings for each method of ConfigClient.
type ConfigCallOptions struct {
- ListSinks []gax.CallOption
- GetSink []gax.CallOption
- CreateSink []gax.CallOption
- UpdateSink []gax.CallOption
- DeleteSink []gax.CallOption
+ ListSinks []gax.CallOption
+ GetSink []gax.CallOption
+ CreateSink []gax.CallOption
+ UpdateSink []gax.CallOption
+ DeleteSink []gax.CallOption
+ ListExclusions []gax.CallOption
+ GetExclusion []gax.CallOption
+ CreateExclusion []gax.CallOption
+ UpdateExclusion []gax.CallOption
+ DeleteExclusion []gax.CallOption
}
func defaultConfigClientOptions() []option.ClientOption {
@@ -64,11 +70,16 @@
},
}
return &ConfigCallOptions{
- ListSinks: retry[[2]string{"default", "idempotent"}],
- GetSink: retry[[2]string{"default", "idempotent"}],
- CreateSink: retry[[2]string{"default", "non_idempotent"}],
- UpdateSink: retry[[2]string{"default", "non_idempotent"}],
- DeleteSink: retry[[2]string{"default", "idempotent"}],
+ ListSinks: retry[[2]string{"default", "idempotent"}],
+ GetSink: retry[[2]string{"default", "idempotent"}],
+ CreateSink: retry[[2]string{"default", "non_idempotent"}],
+ UpdateSink: retry[[2]string{"default", "non_idempotent"}],
+ DeleteSink: retry[[2]string{"default", "idempotent"}],
+ ListExclusions: retry[[2]string{"default", "idempotent"}],
+ GetExclusion: retry[[2]string{"default", "idempotent"}],
+ CreateExclusion: retry[[2]string{"default", "non_idempotent"}],
+ UpdateExclusion: retry[[2]string{"default", "non_idempotent"}],
+ DeleteExclusion: retry[[2]string{"default", "idempotent"}],
}
}
@@ -84,7 +95,7 @@
CallOptions *ConfigCallOptions
// The metadata to be sent with each request.
- xGoogHeader []string
+ Metadata metadata.MD
}
// NewConfigClient creates a new config service v2 client.
@@ -123,7 +134,7 @@
func (c *ConfigClient) SetGoogleClientInfo(keyval ...string) {
kv := append([]string{"gl-go", version.Go()}, keyval...)
kv = append(kv, "gapic", version.Repo, "gax", gax.Version, "grpc", grpc.Version)
- c.xGoogHeader = []string{gax.XGoogHeader(kv...)}
+ c.Metadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
}
// ConfigProjectPath returns the path for the project resource.
@@ -144,9 +155,19 @@
""
}
+// ConfigExclusionPath returns the path for the exclusion resource.
+func ConfigExclusionPath(project, exclusion string) string {
+ return "" +
+ "projects/" +
+ project +
+ "/exclusions/" +
+ exclusion +
+ ""
+}
+
// ListSinks lists sinks.
func (c *ConfigClient) ListSinks(ctx context.Context, req *loggingpb.ListSinksRequest, opts ...gax.CallOption) *LogSinkIterator {
- ctx = insertXGoog(ctx, c.xGoogHeader)
+ ctx = insertMetadata(ctx, c.Metadata)
opts = append(c.CallOptions.ListSinks[0:len(c.CallOptions.ListSinks):len(c.CallOptions.ListSinks)], opts...)
it := &LogSinkIterator{}
it.InternalFetch = func(pageSize int, pageToken string) ([]*loggingpb.LogSink, string, error) {
@@ -181,7 +202,7 @@
// GetSink gets a sink.
func (c *ConfigClient) GetSink(ctx context.Context, req *loggingpb.GetSinkRequest, opts ...gax.CallOption) (*loggingpb.LogSink, error) {
- ctx = insertXGoog(ctx, c.xGoogHeader)
+ ctx = insertMetadata(ctx, c.Metadata)
opts = append(c.CallOptions.GetSink[0:len(c.CallOptions.GetSink):len(c.CallOptions.GetSink)], opts...)
var resp *loggingpb.LogSink
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
@@ -201,7 +222,7 @@
// writer_identity is not permitted to write to the destination. A sink can
// export log entries only from the resource owning the sink.
func (c *ConfigClient) CreateSink(ctx context.Context, req *loggingpb.CreateSinkRequest, opts ...gax.CallOption) (*loggingpb.LogSink, error) {
- ctx = insertXGoog(ctx, c.xGoogHeader)
+ ctx = insertMetadata(ctx, c.Metadata)
opts = append(c.CallOptions.CreateSink[0:len(c.CallOptions.CreateSink):len(c.CallOptions.CreateSink)], opts...)
var resp *loggingpb.LogSink
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
@@ -215,16 +236,13 @@
return resp, nil
}
-// UpdateSink updates a sink. If the named sink doesn't exist, then this method is
-// identical to
-// sinks.create (at /logging/docs/api/reference/rest/v2/projects.sinks/create).
-// If the named sink does exist, then this method replaces the following
-// fields in the existing sink with values from the new sink: destination,
-// filter, output_version_format, start_time, and end_time.
-// The updated filter might also have a new writer_identity; see the
+// UpdateSink updates a sink. This method replaces the following fields in the existing
+// sink with values from the new sink: destination, filter,
+// output_version_format, start_time, and end_time.
+// The updated sink might also have a new writer_identity; see the
// unique_writer_identity field.
func (c *ConfigClient) UpdateSink(ctx context.Context, req *loggingpb.UpdateSinkRequest, opts ...gax.CallOption) (*loggingpb.LogSink, error) {
- ctx = insertXGoog(ctx, c.xGoogHeader)
+ ctx = insertMetadata(ctx, c.Metadata)
opts = append(c.CallOptions.UpdateSink[0:len(c.CallOptions.UpdateSink):len(c.CallOptions.UpdateSink)], opts...)
var resp *loggingpb.LogSink
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
@@ -241,7 +259,7 @@
// DeleteSink deletes a sink. If the sink has a unique writer_identity, then that
// service account is also deleted.
func (c *ConfigClient) DeleteSink(ctx context.Context, req *loggingpb.DeleteSinkRequest, opts ...gax.CallOption) error {
- ctx = insertXGoog(ctx, c.xGoogHeader)
+ ctx = insertMetadata(ctx, c.Metadata)
opts = append(c.CallOptions.DeleteSink[0:len(c.CallOptions.DeleteSink):len(c.CallOptions.DeleteSink)], opts...)
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
var err error
@@ -251,6 +269,145 @@
return err
}
+// ListExclusions lists all the exclusions in a parent resource.
+func (c *ConfigClient) ListExclusions(ctx context.Context, req *loggingpb.ListExclusionsRequest, opts ...gax.CallOption) *LogExclusionIterator {
+ ctx = insertMetadata(ctx, c.Metadata)
+ opts = append(c.CallOptions.ListExclusions[0:len(c.CallOptions.ListExclusions):len(c.CallOptions.ListExclusions)], opts...)
+ it := &LogExclusionIterator{}
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*loggingpb.LogExclusion, string, error) {
+ var resp *loggingpb.ListExclusionsResponse
+ req.PageToken = pageToken
+ if pageSize > math.MaxInt32 {
+ req.PageSize = math.MaxInt32
+ } else {
+ req.PageSize = int32(pageSize)
+ }
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.configClient.ListExclusions(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+ return resp.Exclusions, resp.NextPageToken, nil
+ }
+ fetch := func(pageSize int, pageToken string) (string, error) {
+ items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
+ if err != nil {
+ return "", err
+ }
+ it.items = append(it.items, items...)
+ return nextPageToken, nil
+ }
+ it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
+ return it
+}
+
+// GetExclusion gets the description of an exclusion.
+func (c *ConfigClient) GetExclusion(ctx context.Context, req *loggingpb.GetExclusionRequest, opts ...gax.CallOption) (*loggingpb.LogExclusion, error) {
+ ctx = insertMetadata(ctx, c.Metadata)
+ opts = append(c.CallOptions.GetExclusion[0:len(c.CallOptions.GetExclusion):len(c.CallOptions.GetExclusion)], opts...)
+ var resp *loggingpb.LogExclusion
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.configClient.GetExclusion(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// CreateExclusion creates a new exclusion in a specified parent resource.
+// Only log entries belonging to that resource can be excluded.
+// You can have up to 10 exclusions in a resource.
+func (c *ConfigClient) CreateExclusion(ctx context.Context, req *loggingpb.CreateExclusionRequest, opts ...gax.CallOption) (*loggingpb.LogExclusion, error) {
+ ctx = insertMetadata(ctx, c.Metadata)
+ opts = append(c.CallOptions.CreateExclusion[0:len(c.CallOptions.CreateExclusion):len(c.CallOptions.CreateExclusion)], opts...)
+ var resp *loggingpb.LogExclusion
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.configClient.CreateExclusion(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// UpdateExclusion changes one or more properties of an existing exclusion.
+func (c *ConfigClient) UpdateExclusion(ctx context.Context, req *loggingpb.UpdateExclusionRequest, opts ...gax.CallOption) (*loggingpb.LogExclusion, error) {
+ ctx = insertMetadata(ctx, c.Metadata)
+ opts = append(c.CallOptions.UpdateExclusion[0:len(c.CallOptions.UpdateExclusion):len(c.CallOptions.UpdateExclusion)], opts...)
+ var resp *loggingpb.LogExclusion
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.configClient.UpdateExclusion(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// DeleteExclusion deletes an exclusion.
+func (c *ConfigClient) DeleteExclusion(ctx context.Context, req *loggingpb.DeleteExclusionRequest, opts ...gax.CallOption) error {
+ ctx = insertMetadata(ctx, c.Metadata)
+ opts = append(c.CallOptions.DeleteExclusion[0:len(c.CallOptions.DeleteExclusion):len(c.CallOptions.DeleteExclusion)], opts...)
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ _, err = c.configClient.DeleteExclusion(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ return err
+}
+
+// LogExclusionIterator manages a stream of *loggingpb.LogExclusion.
+type LogExclusionIterator struct {
+ items []*loggingpb.LogExclusion
+ pageInfo *iterator.PageInfo
+ nextFunc func() error
+
+ // InternalFetch is for use by the Google Cloud Libraries only.
+ // It is not part of the stable interface of this package.
+ //
+ // InternalFetch returns results from a single call to the underlying RPC.
+ // The number of results is no greater than pageSize.
+ // If there are no more results, nextPageToken is empty and err is nil.
+ InternalFetch func(pageSize int, pageToken string) (results []*loggingpb.LogExclusion, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *LogExclusionIterator) PageInfo() *iterator.PageInfo {
+ return it.pageInfo
+}
+
+// Next returns the next result. Its second return value is iterator.Done if there are no more
+// results. Once Next returns Done, all subsequent calls will return Done.
+func (it *LogExclusionIterator) Next() (*loggingpb.LogExclusion, error) {
+ var item *loggingpb.LogExclusion
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *LogExclusionIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *LogExclusionIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
+
// LogSinkIterator manages a stream of *loggingpb.LogSink.
type LogSinkIterator struct {
items []*loggingpb.LogSink
diff --git a/vendor/cloud.google.com/go/logging/apiv2/doc.go b/vendor/cloud.google.com/go/logging/apiv2/doc.go
index 116bb68..5f6616a 100644
--- a/vendor/cloud.google.com/go/logging/apiv2/doc.go
+++ b/vendor/cloud.google.com/go/logging/apiv2/doc.go
@@ -14,9 +14,11 @@
// AUTO-GENERATED CODE. DO NOT EDIT.
-// Package logging is an experimental, auto-generated package for the
+// Package logging is an auto-generated package for the
// Stackdriver Logging API.
//
+// NOTE: This package is in alpha. It is not stable, and is likely to be subject to changes.
+//
// The Stackdriver Logging API lets you write log entries and manage your
// logs, log sinks and logs-based metrics.
//
@@ -28,11 +30,15 @@
"google.golang.org/grpc/metadata"
)
-func insertXGoog(ctx context.Context, val []string) context.Context {
- md, _ := metadata.FromOutgoingContext(ctx)
- md = md.Copy()
- md["x-goog-api-client"] = val
- return metadata.NewOutgoingContext(ctx, md)
+func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
+ out, _ := metadata.FromOutgoingContext(ctx)
+ out = out.Copy()
+ for _, md := range mds {
+ for k, v := range md {
+ out[k] = append(out[k], v...)
+ }
+ }
+ return metadata.NewOutgoingContext(ctx, out)
}
// DefaultAuthScopes reports the default set of authentication scopes to use with this package.
diff --git a/vendor/cloud.google.com/go/logging/apiv2/logging_client.go b/vendor/cloud.google.com/go/logging/apiv2/logging_client.go
index 4f64ff0..964d752 100644
--- a/vendor/cloud.google.com/go/logging/apiv2/logging_client.go
+++ b/vendor/cloud.google.com/go/logging/apiv2/logging_client.go
@@ -30,6 +30,7 @@
loggingpb "google.golang.org/genproto/googleapis/logging/v2"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
+ "google.golang.org/grpc/metadata"
)
// CallOptions contains the retry settings for each method of Client.
@@ -98,7 +99,7 @@
CallOptions *CallOptions
// The metadata to be sent with each request.
- xGoogHeader []string
+ Metadata metadata.MD
}
// NewClient creates a new logging service v2 client.
@@ -136,7 +137,7 @@
func (c *Client) SetGoogleClientInfo(keyval ...string) {
kv := append([]string{"gl-go", version.Go()}, keyval...)
kv = append(kv, "gapic", version.Repo, "gax", gax.Version, "grpc", grpc.Version)
- c.xGoogHeader = []string{gax.XGoogHeader(kv...)}
+ c.Metadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
}
// ProjectPath returns the path for the project resource.
@@ -162,7 +163,7 @@
// Log entries written shortly before the delete operation might not be
// deleted.
func (c *Client) DeleteLog(ctx context.Context, req *loggingpb.DeleteLogRequest, opts ...gax.CallOption) error {
- ctx = insertXGoog(ctx, c.xGoogHeader)
+ ctx = insertMetadata(ctx, c.Metadata)
opts = append(c.CallOptions.DeleteLog[0:len(c.CallOptions.DeleteLog):len(c.CallOptions.DeleteLog)], opts...)
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
var err error
@@ -172,9 +173,15 @@
return err
}
-// WriteLogEntries writes log entries to Stackdriver Logging.
+// WriteLogEntries ## Log entry resources
+//
+// Writes log entries to Stackdriver Logging. This API method is the
+// only way to send log entries to Stackdriver Logging. This method
+// is used, directly or indirectly, by the Stackdriver Logging agent
+// (fluentd) and all logging libraries configured to use Stackdriver
+// Logging.
func (c *Client) WriteLogEntries(ctx context.Context, req *loggingpb.WriteLogEntriesRequest, opts ...gax.CallOption) (*loggingpb.WriteLogEntriesResponse, error) {
- ctx = insertXGoog(ctx, c.xGoogHeader)
+ ctx = insertMetadata(ctx, c.Metadata)
opts = append(c.CallOptions.WriteLogEntries[0:len(c.CallOptions.WriteLogEntries):len(c.CallOptions.WriteLogEntries)], opts...)
var resp *loggingpb.WriteLogEntriesResponse
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
@@ -192,7 +199,7 @@
// Stackdriver Logging. For ways to export log entries, see
// Exporting Logs (at /logging/docs/export).
func (c *Client) ListLogEntries(ctx context.Context, req *loggingpb.ListLogEntriesRequest, opts ...gax.CallOption) *LogEntryIterator {
- ctx = insertXGoog(ctx, c.xGoogHeader)
+ ctx = insertMetadata(ctx, c.Metadata)
opts = append(c.CallOptions.ListLogEntries[0:len(c.CallOptions.ListLogEntries):len(c.CallOptions.ListLogEntries)], opts...)
it := &LogEntryIterator{}
it.InternalFetch = func(pageSize int, pageToken string) ([]*loggingpb.LogEntry, string, error) {
@@ -228,7 +235,7 @@
// ListMonitoredResourceDescriptors lists the descriptors for monitored resource types used by Stackdriver
// Logging.
func (c *Client) ListMonitoredResourceDescriptors(ctx context.Context, req *loggingpb.ListMonitoredResourceDescriptorsRequest, opts ...gax.CallOption) *MonitoredResourceDescriptorIterator {
- ctx = insertXGoog(ctx, c.xGoogHeader)
+ ctx = insertMetadata(ctx, c.Metadata)
opts = append(c.CallOptions.ListMonitoredResourceDescriptors[0:len(c.CallOptions.ListMonitoredResourceDescriptors):len(c.CallOptions.ListMonitoredResourceDescriptors)], opts...)
it := &MonitoredResourceDescriptorIterator{}
it.InternalFetch = func(pageSize int, pageToken string) ([]*monitoredrespb.MonitoredResourceDescriptor, string, error) {
@@ -264,7 +271,7 @@
// ListLogs lists the logs in projects, organizations, folders, or billing accounts.
// Only logs that have entries are listed.
func (c *Client) ListLogs(ctx context.Context, req *loggingpb.ListLogsRequest, opts ...gax.CallOption) *StringIterator {
- ctx = insertXGoog(ctx, c.xGoogHeader)
+ ctx = insertMetadata(ctx, c.Metadata)
opts = append(c.CallOptions.ListLogs[0:len(c.CallOptions.ListLogs):len(c.CallOptions.ListLogs)], opts...)
it := &StringIterator{}
it.InternalFetch = func(pageSize int, pageToken string) ([]string, string, error) {
diff --git a/vendor/cloud.google.com/go/logging/apiv2/metrics_client.go b/vendor/cloud.google.com/go/logging/apiv2/metrics_client.go
index e4cc57f..3393290 100644
--- a/vendor/cloud.google.com/go/logging/apiv2/metrics_client.go
+++ b/vendor/cloud.google.com/go/logging/apiv2/metrics_client.go
@@ -29,6 +29,7 @@
loggingpb "google.golang.org/genproto/googleapis/logging/v2"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
+ "google.golang.org/grpc/metadata"
)
// MetricsCallOptions contains the retry settings for each method of MetricsClient.
@@ -84,7 +85,7 @@
CallOptions *MetricsCallOptions
// The metadata to be sent with each request.
- xGoogHeader []string
+ Metadata metadata.MD
}
// NewMetricsClient creates a new metrics service v2 client.
@@ -122,7 +123,7 @@
func (c *MetricsClient) SetGoogleClientInfo(keyval ...string) {
kv := append([]string{"gl-go", version.Go()}, keyval...)
kv = append(kv, "gapic", version.Repo, "gax", gax.Version, "grpc", grpc.Version)
- c.xGoogHeader = []string{gax.XGoogHeader(kv...)}
+ c.Metadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
}
// MetricsProjectPath returns the path for the project resource.
@@ -145,7 +146,7 @@
// ListLogMetrics lists logs-based metrics.
func (c *MetricsClient) ListLogMetrics(ctx context.Context, req *loggingpb.ListLogMetricsRequest, opts ...gax.CallOption) *LogMetricIterator {
- ctx = insertXGoog(ctx, c.xGoogHeader)
+ ctx = insertMetadata(ctx, c.Metadata)
opts = append(c.CallOptions.ListLogMetrics[0:len(c.CallOptions.ListLogMetrics):len(c.CallOptions.ListLogMetrics)], opts...)
it := &LogMetricIterator{}
it.InternalFetch = func(pageSize int, pageToken string) ([]*loggingpb.LogMetric, string, error) {
@@ -180,7 +181,7 @@
// GetLogMetric gets a logs-based metric.
func (c *MetricsClient) GetLogMetric(ctx context.Context, req *loggingpb.GetLogMetricRequest, opts ...gax.CallOption) (*loggingpb.LogMetric, error) {
- ctx = insertXGoog(ctx, c.xGoogHeader)
+ ctx = insertMetadata(ctx, c.Metadata)
opts = append(c.CallOptions.GetLogMetric[0:len(c.CallOptions.GetLogMetric):len(c.CallOptions.GetLogMetric)], opts...)
var resp *loggingpb.LogMetric
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
@@ -196,7 +197,7 @@
// CreateLogMetric creates a logs-based metric.
func (c *MetricsClient) CreateLogMetric(ctx context.Context, req *loggingpb.CreateLogMetricRequest, opts ...gax.CallOption) (*loggingpb.LogMetric, error) {
- ctx = insertXGoog(ctx, c.xGoogHeader)
+ ctx = insertMetadata(ctx, c.Metadata)
opts = append(c.CallOptions.CreateLogMetric[0:len(c.CallOptions.CreateLogMetric):len(c.CallOptions.CreateLogMetric)], opts...)
var resp *loggingpb.LogMetric
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
@@ -212,7 +213,7 @@
// UpdateLogMetric creates or updates a logs-based metric.
func (c *MetricsClient) UpdateLogMetric(ctx context.Context, req *loggingpb.UpdateLogMetricRequest, opts ...gax.CallOption) (*loggingpb.LogMetric, error) {
- ctx = insertXGoog(ctx, c.xGoogHeader)
+ ctx = insertMetadata(ctx, c.Metadata)
opts = append(c.CallOptions.UpdateLogMetric[0:len(c.CallOptions.UpdateLogMetric):len(c.CallOptions.UpdateLogMetric)], opts...)
var resp *loggingpb.LogMetric
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
@@ -228,7 +229,7 @@
// DeleteLogMetric deletes a logs-based metric.
func (c *MetricsClient) DeleteLogMetric(ctx context.Context, req *loggingpb.DeleteLogMetricRequest, opts ...gax.CallOption) error {
- ctx = insertXGoog(ctx, c.xGoogHeader)
+ ctx = insertMetadata(ctx, c.Metadata)
opts = append(c.CallOptions.DeleteLogMetric[0:len(c.CallOptions.DeleteLogMetric):len(c.CallOptions.DeleteLogMetric)], opts...)
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
var err error
diff --git a/vendor/cloud.google.com/go/trace/grpc.go b/vendor/cloud.google.com/go/trace/grpc.go
index ca7b464..e78f4a2 100644
--- a/vendor/cloud.google.com/go/trace/grpc.go
+++ b/vendor/cloud.google.com/go/trace/grpc.go
@@ -29,10 +29,16 @@
// GRPCClientInterceptor returns a grpc.UnaryClientInterceptor that traces all outgoing requests from a gRPC client.
// The calling context should already have a *trace.Span; a child span will be
// created for the outgoing gRPC call. If the calling context doesn't have a span,
-// the call will not be traced.
+// the call will not be traced. If the client is nil, then the interceptor just
+// passes through the request.
//
// The functionality in gRPC that this feature relies on is currently experimental.
func (c *Client) GRPCClientInterceptor() grpc.UnaryClientInterceptor {
+ if c == nil {
+ return func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {
+ return invoker(ctx, method, req, reply, cc, opts...)
+ }
+ }
return grpc.UnaryClientInterceptor(c.grpcUnaryInterceptor)
}
@@ -75,8 +81,15 @@
//
// span := trace.FromContext(ctx)
//
+// If the client is nil, then the interceptor just invokes the handler.
+//
// The functionality in gRPC that this feature relies on is currently experimental.
func (c *Client) GRPCServerInterceptor() grpc.UnaryServerInterceptor {
+ if c == nil {
+ return func(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
+ return handler(ctx, req)
+ }
+ }
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {
md, _ := metadata.FromIncomingContext(ctx)
var traceHeader string
diff --git a/vendor/cloud.google.com/go/trace/http.go b/vendor/cloud.google.com/go/trace/http.go
index e06fb57..290d139 100644
--- a/vendor/cloud.google.com/go/trace/http.go
+++ b/vendor/cloud.google.com/go/trace/http.go
@@ -69,6 +69,9 @@
//
// The span will be auto finished by the handler.
func (c *Client) HTTPHandler(h http.Handler) http.Handler {
+ if c == nil {
+ return h
+ }
return &handler{traceClient: c, handler: h}
}
@@ -101,5 +104,4 @@
w.Header().Set(httpHeader, spanHeader(traceID, parentSpanID, span.trace.localOptions))
}
h.handler.ServeHTTP(w, r)
-
}
diff --git a/vendor/cloud.google.com/go/trace/trace.go b/vendor/cloud.google.com/go/trace/trace.go
index 96caa70..d4f7abe 100644
--- a/vendor/cloud.google.com/go/trace/trace.go
+++ b/vendor/cloud.google.com/go/trace/trace.go
@@ -254,7 +254,8 @@
return fmt.Sprintf("%016x%016x", id1, id2)
}
-// Client is a client for uploading traces to the Google Stackdriver Trace server.
+// Client is a client for uploading traces to the Google Stackdriver Trace service.
+// A nil Client will no-op for all of its methods.
type Client struct {
service *api.Service
projectID string
@@ -310,13 +311,13 @@
}
}
-// SpanFromHeader returns a new trace span, based on a provided request header
-// value. See https://cloud.google.com/trace/docs/faq.
-//
-// It returns nil iff the client is nil.
+// SpanFromHeader returns a new trace span based on a provided request header
+// value or nil iff the client is nil.
//
// The trace information and identifiers will be read from the header value.
// Otherwise, a new trace ID is made and the parent span ID is zero.
+// For the exact format of the header value, see
+// https://cloud.google.com/trace/docs/support#how_do_i_force_a_request_to_be_traced
//
// The name of the new span is provided as an argument.
//
@@ -352,9 +353,8 @@
return span
}
-// SpanFromRequest returns a new trace span for an HTTP request.
-//
-// It returns nil iff the client is nil.
+// SpanFromRequest returns a new trace span for an HTTP request or nil
+// iff the client is nil.
//
// If the incoming HTTP request contains a trace context header, the trace ID,
// parent span ID, and tracing options will be read from that header.
@@ -390,7 +390,8 @@
return span
}
-// NewSpan returns a new trace span with the given name.
+// NewSpan returns a new trace span with the given name or nil iff the
+// client is nil.
//
// A new trace and span ID is generated to trace the span.
// Returned span need to be finished by calling Finish or FinishWait.