Copyright 2020 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Code generated by protoc-gen-go_gapic. DO NOT EDIT.

package trace

import (
	
	
	
	
	

	gax 
	
	gtransport 
	cloudtracepb 
	
	
	
)

var newClientHook clientHook
Client is a client for interacting with Stackdriver Trace API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Connection pool of gRPC connections to the service.
flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE
The gRPC API client.
The call options for this service.
The x-goog-* metadata to be sent with each request.
NewClient creates a new trace service client. This file describes an API for collecting and viewing traces and spans within a trace. A Trace is a collection of spans corresponding to a single operation or set of operations for an application. A span is an individual timed event which forms a node of the trace tree. A single trace may contain span(s) from multiple services.
func ( context.Context,  ...option.ClientOption) (*Client, error) {
	 := defaultClientOptions()

	if newClientHook != nil {
		,  := newClientHook(, clientHookParams{})
		if  != nil {
			return nil, 
		}
		 = append(, ...)
	}

	,  := checkDisableDeadlines()
	if  != nil {
		return nil, 
	}

	,  := gtransport.DialPool(, append(, ...)...)
	if  != nil {
		return nil, 
	}
	 := &Client{
		connPool:         ,
		disableDeadlines: ,
		CallOptions:      defaultCallOptions(),

		client: cloudtracepb.NewTraceServiceClient(),
	}
	.setGoogleClientInfo()

	return , nil
}
Connection returns a connection to the API service. Deprecated.
func ( *Client) () *grpc.ClientConn {
	return .connPool.Conn()
}
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func ( *Client) () error {
	return .connPool.Close()
}
setGoogleClientInfo sets the name and version of the application in the `x-goog-api-client` header passed on each request. Intended for use by Google-written clients.
func ( *Client) ( ...string) {
	 := append([]string{"gl-go", versionGo()}, ...)
	 = append(, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version)
	.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(...))
}
BatchWriteSpans sends new spans to new or existing traces. You cannot update existing spans.
func ( *Client) ( context.Context,  *cloudtracepb.BatchWriteSpansRequest,  ...gax.CallOption) error {
	if ,  := .Deadline(); ! && !.disableDeadlines {
		,  := context.WithTimeout(, 120000*time.Millisecond)
		defer ()
		 = 
	}
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(.GetName())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.BatchWriteSpans[0:len(.CallOptions.BatchWriteSpans):len(.CallOptions.BatchWriteSpans)], ...)
	 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
		var  error
		_,  = .client.BatchWriteSpans(, , .GRPC...)
		return 
	}, ...)
	return 
}
CreateSpan creates a new span.
func ( *Client) ( context.Context,  *cloudtracepb.Span,  ...gax.CallOption) (*cloudtracepb.Span, error) {
	if ,  := .Deadline(); ! && !.disableDeadlines {
		,  := context.WithTimeout(, 120000*time.Millisecond)
		defer ()
		 = 
	}
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(.GetName())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.CreateSpan[0:len(.CallOptions.CreateSpan):len(.CallOptions.CreateSpan)], ...)
	var  *cloudtracepb.Span
	 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
		var  error
		,  = .client.CreateSpan(, , .GRPC...)
		return 
	}, ...)
	if  != nil {
		return nil, 
	}
	return , nil