You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1776 regels
64 KiB

  1. // Package tracing provides access to the Google Tracing API.
  2. //
  3. // See https://cloud.google.com/trace
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/tracing/v2"
  8. // ...
  9. // tracingService, err := tracing.New(oauthHttpClient)
  10. package tracing // import "google.golang.org/api/tracing/v2"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "tracing:v2"
  41. const apiName = "tracing"
  42. const apiVersion = "v2"
  43. const basePath = "https://tracing.googleapis.com/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View and manage your data across Google Cloud Platform services
  47. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  48. // Write Trace data for a project or application
  49. TraceAppendScope = "https://www.googleapis.com/auth/trace.append"
  50. // Read Trace data for a project or application
  51. TraceReadonlyScope = "https://www.googleapis.com/auth/trace.readonly"
  52. )
  53. func New(client *http.Client) (*Service, error) {
  54. if client == nil {
  55. return nil, errors.New("client is nil")
  56. }
  57. s := &Service{client: client, BasePath: basePath}
  58. s.Projects = NewProjectsService(s)
  59. return s, nil
  60. }
  61. type Service struct {
  62. client *http.Client
  63. BasePath string // API endpoint base URL
  64. UserAgent string // optional additional User-Agent fragment
  65. Projects *ProjectsService
  66. }
  67. func (s *Service) userAgent() string {
  68. if s.UserAgent == "" {
  69. return googleapi.UserAgent
  70. }
  71. return googleapi.UserAgent + " " + s.UserAgent
  72. }
  73. func NewProjectsService(s *Service) *ProjectsService {
  74. rs := &ProjectsService{s: s}
  75. rs.Traces = NewProjectsTracesService(s)
  76. return rs
  77. }
  78. type ProjectsService struct {
  79. s *Service
  80. Traces *ProjectsTracesService
  81. }
  82. func NewProjectsTracesService(s *Service) *ProjectsTracesService {
  83. rs := &ProjectsTracesService{s: s}
  84. rs.Spans = NewProjectsTracesSpansService(s)
  85. return rs
  86. }
  87. type ProjectsTracesService struct {
  88. s *Service
  89. Spans *ProjectsTracesSpansService
  90. }
  91. func NewProjectsTracesSpansService(s *Service) *ProjectsTracesSpansService {
  92. rs := &ProjectsTracesSpansService{s: s}
  93. return rs
  94. }
  95. type ProjectsTracesSpansService struct {
  96. s *Service
  97. }
  98. // Annotation: Text annotation with a set of attributes. A maximum of 32
  99. // annotations are
  100. // allowed per Span.
  101. type Annotation struct {
  102. // Attributes: A set of attributes on the annotation. A maximum of 4
  103. // attributes are
  104. // allowed per Annotation.
  105. Attributes *Attributes `json:"attributes,omitempty"`
  106. // Description: A user-supplied message describing the event. The
  107. // maximum length for
  108. // the description is 256 bytes.
  109. Description *TruncatableString `json:"description,omitempty"`
  110. // ForceSendFields is a list of field names (e.g. "Attributes") to
  111. // unconditionally include in API requests. By default, fields with
  112. // empty values are omitted from API requests. However, any non-pointer,
  113. // non-interface field appearing in ForceSendFields will be sent to the
  114. // server regardless of whether the field is empty or not. This may be
  115. // used to include empty fields in Patch requests.
  116. ForceSendFields []string `json:"-"`
  117. // NullFields is a list of field names (e.g. "Attributes") to include in
  118. // API requests with the JSON null value. By default, fields with empty
  119. // values are omitted from API requests. However, any field with an
  120. // empty value appearing in NullFields will be sent to the server as
  121. // null. It is an error if a field in this list has a non-empty value.
  122. // This may be used to include null fields in Patch requests.
  123. NullFields []string `json:"-"`
  124. }
  125. func (s *Annotation) MarshalJSON() ([]byte, error) {
  126. type NoMethod Annotation
  127. raw := NoMethod(*s)
  128. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  129. }
  130. // AttributeValue: The allowed types for the value side of an attribute
  131. // key:value pair.
  132. type AttributeValue struct {
  133. // BoolValue: A boolean value.
  134. BoolValue bool `json:"boolValue,omitempty"`
  135. // IntValue: An integer value.
  136. IntValue int64 `json:"intValue,omitempty,string"`
  137. // StringValue: A string value (up to 256 bytes).
  138. StringValue *TruncatableString `json:"stringValue,omitempty"`
  139. // ForceSendFields is a list of field names (e.g. "BoolValue") to
  140. // unconditionally include in API requests. By default, fields with
  141. // empty values are omitted from API requests. However, any non-pointer,
  142. // non-interface field appearing in ForceSendFields will be sent to the
  143. // server regardless of whether the field is empty or not. This may be
  144. // used to include empty fields in Patch requests.
  145. ForceSendFields []string `json:"-"`
  146. // NullFields is a list of field names (e.g. "BoolValue") to include in
  147. // API requests with the JSON null value. By default, fields with empty
  148. // values are omitted from API requests. However, any field with an
  149. // empty value appearing in NullFields will be sent to the server as
  150. // null. It is an error if a field in this list has a non-empty value.
  151. // This may be used to include null fields in Patch requests.
  152. NullFields []string `json:"-"`
  153. }
  154. func (s *AttributeValue) MarshalJSON() ([]byte, error) {
  155. type NoMethod AttributeValue
  156. raw := NoMethod(*s)
  157. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  158. }
  159. // Attributes: Attributes of a span with a key:value format.
  160. type Attributes struct {
  161. // AttributeMap: The maximum key length is 128 bytes (attributes are
  162. // dropped if the
  163. // key size is larger than the maximum allowed). The value can be a
  164. // string
  165. // (up to 256 bytes), integer, or boolean (true/false). Some common
  166. // pair
  167. // examples:
  168. //
  169. // "/instance_id": "my-instance"
  170. // "/zone": "us-central1-a"
  171. // "/grpc/peer_address": "ip:port" (dns, etc.)
  172. // "/grpc/deadline": "Duration"
  173. // "/http/user_agent"
  174. // "/http/request_bytes": 300
  175. // "/http/response_bytes": 1200
  176. // "/http/url": google.com/apis
  177. // "abc.com/myattribute": true
  178. AttributeMap map[string]AttributeValue `json:"attributeMap,omitempty"`
  179. // DroppedAttributesCount: The number of dropped attributes after the
  180. // maximum size was enforced. If
  181. // 0 then no attributes were dropped.
  182. DroppedAttributesCount int64 `json:"droppedAttributesCount,omitempty"`
  183. // ForceSendFields is a list of field names (e.g. "AttributeMap") to
  184. // unconditionally include in API requests. By default, fields with
  185. // empty values are omitted from API requests. However, any non-pointer,
  186. // non-interface field appearing in ForceSendFields will be sent to the
  187. // server regardless of whether the field is empty or not. This may be
  188. // used to include empty fields in Patch requests.
  189. ForceSendFields []string `json:"-"`
  190. // NullFields is a list of field names (e.g. "AttributeMap") to include
  191. // in API requests with the JSON null value. By default, fields with
  192. // empty values are omitted from API requests. However, any field with
  193. // an empty value appearing in NullFields will be sent to the server as
  194. // null. It is an error if a field in this list has a non-empty value.
  195. // This may be used to include null fields in Patch requests.
  196. NullFields []string `json:"-"`
  197. }
  198. func (s *Attributes) MarshalJSON() ([]byte, error) {
  199. type NoMethod Attributes
  200. raw := NoMethod(*s)
  201. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  202. }
  203. // BatchWriteSpansRequest: The request message for the `BatchWriteSpans`
  204. // method.
  205. type BatchWriteSpansRequest struct {
  206. // Spans: A collection of spans.
  207. Spans []*Span `json:"spans,omitempty"`
  208. // ForceSendFields is a list of field names (e.g. "Spans") to
  209. // unconditionally include in API requests. By default, fields with
  210. // empty values are omitted from API requests. However, any non-pointer,
  211. // non-interface field appearing in ForceSendFields will be sent to the
  212. // server regardless of whether the field is empty or not. This may be
  213. // used to include empty fields in Patch requests.
  214. ForceSendFields []string `json:"-"`
  215. // NullFields is a list of field names (e.g. "Spans") to include in API
  216. // requests with the JSON null value. By default, fields with empty
  217. // values are omitted from API requests. However, any field with an
  218. // empty value appearing in NullFields will be sent to the server as
  219. // null. It is an error if a field in this list has a non-empty value.
  220. // This may be used to include null fields in Patch requests.
  221. NullFields []string `json:"-"`
  222. }
  223. func (s *BatchWriteSpansRequest) MarshalJSON() ([]byte, error) {
  224. type NoMethod BatchWriteSpansRequest
  225. raw := NoMethod(*s)
  226. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  227. }
  228. // Empty: A generic empty message that you can re-use to avoid defining
  229. // duplicated
  230. // empty messages in your APIs. A typical example is to use it as the
  231. // request
  232. // or the response type of an API method. For instance:
  233. //
  234. // service Foo {
  235. // rpc Bar(google.protobuf.Empty) returns
  236. // (google.protobuf.Empty);
  237. // }
  238. //
  239. // The JSON representation for `Empty` is empty JSON object `{}`.
  240. type Empty struct {
  241. // ServerResponse contains the HTTP response code and headers from the
  242. // server.
  243. googleapi.ServerResponse `json:"-"`
  244. }
  245. // Link: A pointer from this span to another span in a different `Trace`
  246. // within
  247. // the same service project or within a different service project.
  248. // Used
  249. // (for example) in batching operations, where a single batch
  250. // handler
  251. // processes multiple requests from different traces or when receives
  252. // a
  253. // request from a different service project.
  254. type Link struct {
  255. // SpanId: `SPAN_ID` is a unique identifier for a span within a trace.
  256. // It is a
  257. // base16-encoded, case-insensitive string of a 8-bytes array and
  258. // is
  259. // required to be 16 char long.
  260. SpanId string `json:"spanId,omitempty"`
  261. // TraceId: `TRACE_ID` is a unique identifier for a trace within a
  262. // project. It is
  263. // a base16-encoded, case-insensitive string of a 16-bytes array and
  264. // is
  265. // required to be 32 char long.
  266. TraceId string `json:"traceId,omitempty"`
  267. // Type: The relationship of the current span relative to the linked
  268. // span.
  269. //
  270. // Possible values:
  271. // "TYPE_UNSPECIFIED" - The relationship of the two spans is unknown.
  272. // "CHILD" - The current span is a child of the linked span.
  273. // "PARENT" - The current span is the parent of the linked span.
  274. Type string `json:"type,omitempty"`
  275. // ForceSendFields is a list of field names (e.g. "SpanId") to
  276. // unconditionally include in API requests. By default, fields with
  277. // empty values are omitted from API requests. However, any non-pointer,
  278. // non-interface field appearing in ForceSendFields will be sent to the
  279. // server regardless of whether the field is empty or not. This may be
  280. // used to include empty fields in Patch requests.
  281. ForceSendFields []string `json:"-"`
  282. // NullFields is a list of field names (e.g. "SpanId") to include in API
  283. // requests with the JSON null value. By default, fields with empty
  284. // values are omitted from API requests. However, any field with an
  285. // empty value appearing in NullFields will be sent to the server as
  286. // null. It is an error if a field in this list has a non-empty value.
  287. // This may be used to include null fields in Patch requests.
  288. NullFields []string `json:"-"`
  289. }
  290. func (s *Link) MarshalJSON() ([]byte, error) {
  291. type NoMethod Link
  292. raw := NoMethod(*s)
  293. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  294. }
  295. // Links: A collection of links, which are references from this span to
  296. // a span
  297. // in the same or different trace.
  298. type Links struct {
  299. // DroppedLinksCount: The number of dropped links after the maximum size
  300. // was enforced. If
  301. // 0 then no links were dropped.
  302. DroppedLinksCount int64 `json:"droppedLinksCount,omitempty"`
  303. // Link: A collection of links.
  304. Link []*Link `json:"link,omitempty"`
  305. // ForceSendFields is a list of field names (e.g. "DroppedLinksCount")
  306. // to unconditionally include in API requests. By default, fields with
  307. // empty values are omitted from API requests. However, any non-pointer,
  308. // non-interface field appearing in ForceSendFields will be sent to the
  309. // server regardless of whether the field is empty or not. This may be
  310. // used to include empty fields in Patch requests.
  311. ForceSendFields []string `json:"-"`
  312. // NullFields is a list of field names (e.g. "DroppedLinksCount") to
  313. // include in API requests with the JSON null value. By default, fields
  314. // with empty values are omitted from API requests. However, any field
  315. // with an empty value appearing in NullFields will be sent to the
  316. // server as null. It is an error if a field in this list has a
  317. // non-empty value. This may be used to include null fields in Patch
  318. // requests.
  319. NullFields []string `json:"-"`
  320. }
  321. func (s *Links) MarshalJSON() ([]byte, error) {
  322. type NoMethod Links
  323. raw := NoMethod(*s)
  324. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  325. }
  326. // ListSpansResponse: The response message for the `ListSpans` method.
  327. type ListSpansResponse struct {
  328. // NextPageToken: If defined, indicates that there are more spans that
  329. // match the request.
  330. // Pass this as the value of `pageToken` in a subsequent request to
  331. // retrieve
  332. // additional spans.
  333. NextPageToken string `json:"nextPageToken,omitempty"`
  334. // Spans: The requested spans if there are any in the specified trace.
  335. Spans []*Span `json:"spans,omitempty"`
  336. // ServerResponse contains the HTTP response code and headers from the
  337. // server.
  338. googleapi.ServerResponse `json:"-"`
  339. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  340. // unconditionally include in API requests. By default, fields with
  341. // empty values are omitted from API requests. However, any non-pointer,
  342. // non-interface field appearing in ForceSendFields will be sent to the
  343. // server regardless of whether the field is empty or not. This may be
  344. // used to include empty fields in Patch requests.
  345. ForceSendFields []string `json:"-"`
  346. // NullFields is a list of field names (e.g. "NextPageToken") to include
  347. // in API requests with the JSON null value. By default, fields with
  348. // empty values are omitted from API requests. However, any field with
  349. // an empty value appearing in NullFields will be sent to the server as
  350. // null. It is an error if a field in this list has a non-empty value.
  351. // This may be used to include null fields in Patch requests.
  352. NullFields []string `json:"-"`
  353. }
  354. func (s *ListSpansResponse) MarshalJSON() ([]byte, error) {
  355. type NoMethod ListSpansResponse
  356. raw := NoMethod(*s)
  357. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  358. }
  359. // ListTracesResponse: The response message for the `ListTraces` method.
  360. type ListTracesResponse struct {
  361. // NextPageToken: If defined, indicates that there are more traces that
  362. // match the request
  363. // and that this value should be passed to the next request to
  364. // continue
  365. // retrieving additional traces.
  366. NextPageToken string `json:"nextPageToken,omitempty"`
  367. // Traces: List of trace records returned.
  368. Traces []*Trace `json:"traces,omitempty"`
  369. // ServerResponse contains the HTTP response code and headers from the
  370. // server.
  371. googleapi.ServerResponse `json:"-"`
  372. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  373. // unconditionally include in API requests. By default, fields with
  374. // empty values are omitted from API requests. However, any non-pointer,
  375. // non-interface field appearing in ForceSendFields will be sent to the
  376. // server regardless of whether the field is empty or not. This may be
  377. // used to include empty fields in Patch requests.
  378. ForceSendFields []string `json:"-"`
  379. // NullFields is a list of field names (e.g. "NextPageToken") to include
  380. // in API requests with the JSON null value. By default, fields with
  381. // empty values are omitted from API requests. However, any field with
  382. // an empty value appearing in NullFields will be sent to the server as
  383. // null. It is an error if a field in this list has a non-empty value.
  384. // This may be used to include null fields in Patch requests.
  385. NullFields []string `json:"-"`
  386. }
  387. func (s *ListTracesResponse) MarshalJSON() ([]byte, error) {
  388. type NoMethod ListTracesResponse
  389. raw := NoMethod(*s)
  390. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  391. }
  392. // Module: Binary module.
  393. type Module struct {
  394. // BuildId: Build_id is a unique identifier for the module, usually a
  395. // hash of its
  396. // contents (up to 128 characters).
  397. BuildId *TruncatableString `json:"buildId,omitempty"`
  398. // Module: E.g. main binary, kernel modules, and dynamic libraries
  399. // such as libc.so, sharedlib.so (up to 256 characters).
  400. Module *TruncatableString `json:"module,omitempty"`
  401. // ForceSendFields is a list of field names (e.g. "BuildId") to
  402. // unconditionally include in API requests. By default, fields with
  403. // empty values are omitted from API requests. However, any non-pointer,
  404. // non-interface field appearing in ForceSendFields will be sent to the
  405. // server regardless of whether the field is empty or not. This may be
  406. // used to include empty fields in Patch requests.
  407. ForceSendFields []string `json:"-"`
  408. // NullFields is a list of field names (e.g. "BuildId") to include in
  409. // API requests with the JSON null value. By default, fields with empty
  410. // values are omitted from API requests. However, any field with an
  411. // empty value appearing in NullFields will be sent to the server as
  412. // null. It is an error if a field in this list has a non-empty value.
  413. // This may be used to include null fields in Patch requests.
  414. NullFields []string `json:"-"`
  415. }
  416. func (s *Module) MarshalJSON() ([]byte, error) {
  417. type NoMethod Module
  418. raw := NoMethod(*s)
  419. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  420. }
  421. // NetworkEvent: An event describing an RPC message sent/received on the
  422. // network. A
  423. // maximum of 128 network events are allowed per Span.
  424. type NetworkEvent struct {
  425. // MessageId: An identifier for the message, which must be unique in
  426. // this span.
  427. MessageId uint64 `json:"messageId,omitempty,string"`
  428. // MessageSize: The number of bytes sent or received.
  429. MessageSize uint64 `json:"messageSize,omitempty,string"`
  430. // Time: If available, this is the kernel time:
  431. //
  432. // * For sent messages, this is the time at which the first bit was
  433. // sent.
  434. // * For received messages, this is the time at which the last bit was
  435. // received.
  436. Time string `json:"time,omitempty"`
  437. // Type: Type of NetworkEvent. Indicates whether the RPC message was
  438. // sent or
  439. // received.
  440. //
  441. // Possible values:
  442. // "TYPE_UNSPECIFIED" - Unknown event type.
  443. // "SENT" - Indicates a sent RPC message.
  444. // "RECV" - Indicates a received RPC message.
  445. Type string `json:"type,omitempty"`
  446. // ForceSendFields is a list of field names (e.g. "MessageId") to
  447. // unconditionally include in API requests. By default, fields with
  448. // empty values are omitted from API requests. However, any non-pointer,
  449. // non-interface field appearing in ForceSendFields will be sent to the
  450. // server regardless of whether the field is empty or not. This may be
  451. // used to include empty fields in Patch requests.
  452. ForceSendFields []string `json:"-"`
  453. // NullFields is a list of field names (e.g. "MessageId") to include in
  454. // API requests with the JSON null value. By default, fields with empty
  455. // values are omitted from API requests. However, any field with an
  456. // empty value appearing in NullFields will be sent to the server as
  457. // null. It is an error if a field in this list has a non-empty value.
  458. // This may be used to include null fields in Patch requests.
  459. NullFields []string `json:"-"`
  460. }
  461. func (s *NetworkEvent) MarshalJSON() ([]byte, error) {
  462. type NoMethod NetworkEvent
  463. raw := NoMethod(*s)
  464. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  465. }
  466. // Span: A span represents a single operation within a trace. Spans can
  467. // be nested
  468. // to form a trace tree. Often, a trace contains a root span
  469. // that
  470. // describes the end-to-end latency and, optionally, one or more
  471. // subspans for
  472. // its sub-operations. (A trace could alternatively contain multiple
  473. // root spans,
  474. // or none at all.) Spans do not need to be contiguous. There may be
  475. // gaps
  476. // and/or overlaps between spans in a trace.
  477. type Span struct {
  478. // Attributes: A set of attributes on the span. A maximum of 32
  479. // attributes are allowed per
  480. // Span.
  481. Attributes *Attributes `json:"attributes,omitempty"`
  482. // DisplayName: Description of the operation in the span. It is
  483. // sanitized and displayed in
  484. // the Stackdriver Trace tool in the
  485. // {% dynamic print site_values.console_name %}.
  486. // The display_name may be a method name or some other per-call
  487. // site
  488. // name. For the same executable and the same call point, a best
  489. // practice is
  490. // to use a consistent operation name, which makes it easier to
  491. // correlate
  492. // cross-trace spans.
  493. // The maximum length for the display_name is 128 bytes.
  494. DisplayName *TruncatableString `json:"displayName,omitempty"`
  495. // EndTime: End time of the span.
  496. // On the client side, this is the local machine clock time at which the
  497. // span
  498. // execution was ended; on the server
  499. // side, this is the time at which the server application handler
  500. // stopped
  501. // running.
  502. EndTime string `json:"endTime,omitempty"`
  503. // Links: A maximum of 128 links are allowed per Span.
  504. Links *Links `json:"links,omitempty"`
  505. // Name: The resource name of Span in the
  506. // format
  507. // `projects/PROJECT_ID/traces/TRACE_ID/spans/SPAN_ID`.
  508. // `TRACE_ID`
  509. // is a unique identifier for a trace within a project and is
  510. // a
  511. // base16-encoded, case-insensitive string and is required to be 32 char
  512. // long.
  513. // `SPAN_ID` is a unique identifier for a span within a trace. It is
  514. // a
  515. // base 16-encoded, case-insensitive string of a 8-bytes array and is
  516. // required
  517. // to be 16 char long.
  518. Name string `json:"name,omitempty"`
  519. // ParentSpanId: ID of parent span which is a base 16-encoded,
  520. // case-insensitive string of
  521. // a 8-bytes array and is required to be 16 char long. If this is a root
  522. // span,
  523. // the value must be empty.
  524. ParentSpanId string `json:"parentSpanId,omitempty"`
  525. // SpanId: Unique identifier for a span within a trace. It is a base
  526. // 16-encoded,
  527. // case-insensitive string of a 8-bytes array and is required.
  528. SpanId string `json:"spanId,omitempty"`
  529. // StackTrace: Stack trace captured at the start of the span.
  530. StackTrace *StackTrace `json:"stackTrace,omitempty"`
  531. // StartTime: Start time of the span.
  532. // On the client side, this is the local machine clock time at which the
  533. // span
  534. // execution was started; on the server
  535. // side, this is the time at which the server application handler
  536. // started
  537. // running.
  538. StartTime string `json:"startTime,omitempty"`
  539. // Status: An optional final status for this span.
  540. Status *Status `json:"status,omitempty"`
  541. // TimeEvents: A maximum of 32 annotations and 128 network events are
  542. // allowed per Span.
  543. TimeEvents *TimeEvents `json:"timeEvents,omitempty"`
  544. // ServerResponse contains the HTTP response code and headers from the
  545. // server.
  546. googleapi.ServerResponse `json:"-"`
  547. // ForceSendFields is a list of field names (e.g. "Attributes") to
  548. // unconditionally include in API requests. By default, fields with
  549. // empty values are omitted from API requests. However, any non-pointer,
  550. // non-interface field appearing in ForceSendFields will be sent to the
  551. // server regardless of whether the field is empty or not. This may be
  552. // used to include empty fields in Patch requests.
  553. ForceSendFields []string `json:"-"`
  554. // NullFields is a list of field names (e.g. "Attributes") to include in
  555. // API requests with the JSON null value. By default, fields with empty
  556. // values are omitted from API requests. However, any field with an
  557. // empty value appearing in NullFields will be sent to the server as
  558. // null. It is an error if a field in this list has a non-empty value.
  559. // This may be used to include null fields in Patch requests.
  560. NullFields []string `json:"-"`
  561. }
  562. func (s *Span) MarshalJSON() ([]byte, error) {
  563. type NoMethod Span
  564. raw := NoMethod(*s)
  565. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  566. }
  567. // StackFrame: Represents a single stack frame in a stack trace.
  568. type StackFrame struct {
  569. // ColumnNumber: Column number is important in JavaScript (anonymous
  570. // functions).
  571. // May not be available in some languages.
  572. ColumnNumber int64 `json:"columnNumber,omitempty,string"`
  573. // FileName: The filename of the file containing this frame (up to 256
  574. // characters).
  575. FileName *TruncatableString `json:"fileName,omitempty"`
  576. // FunctionName: The fully-qualified name that uniquely identifies this
  577. // function or
  578. // method (up to 1024 characters).
  579. FunctionName *TruncatableString `json:"functionName,omitempty"`
  580. // LineNumber: Line number of the frame.
  581. LineNumber int64 `json:"lineNumber,omitempty,string"`
  582. // LoadModule: Binary module the code is loaded from.
  583. LoadModule *Module `json:"loadModule,omitempty"`
  584. // OriginalFunctionName: Used when the function name
  585. // is
  586. // [mangled](http://www.avabodh.com/cxxin/namemangling.html). May
  587. // be
  588. // fully-qualified (up to 1024 characters).
  589. OriginalFunctionName *TruncatableString `json:"originalFunctionName,omitempty"`
  590. // SourceVersion: The version of the deployed source code (up to 128
  591. // characters).
  592. SourceVersion *TruncatableString `json:"sourceVersion,omitempty"`
  593. // ForceSendFields is a list of field names (e.g. "ColumnNumber") to
  594. // unconditionally include in API requests. By default, fields with
  595. // empty values are omitted from API requests. However, any non-pointer,
  596. // non-interface field appearing in ForceSendFields will be sent to the
  597. // server regardless of whether the field is empty or not. This may be
  598. // used to include empty fields in Patch requests.
  599. ForceSendFields []string `json:"-"`
  600. // NullFields is a list of field names (e.g. "ColumnNumber") to include
  601. // in API requests with the JSON null value. By default, fields with
  602. // empty values are omitted from API requests. However, any field with
  603. // an empty value appearing in NullFields will be sent to the server as
  604. // null. It is an error if a field in this list has a non-empty value.
  605. // This may be used to include null fields in Patch requests.
  606. NullFields []string `json:"-"`
  607. }
  608. func (s *StackFrame) MarshalJSON() ([]byte, error) {
  609. type NoMethod StackFrame
  610. raw := NoMethod(*s)
  611. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  612. }
  613. // StackFrames: Represents collection of StackFrames that can be
  614. // truncated.
  615. type StackFrames struct {
  616. // DroppedFramesCount: The number of dropped stack frames after the
  617. // maximum size was enforced.
  618. // If 0 then no frames were dropped.
  619. DroppedFramesCount int64 `json:"droppedFramesCount,omitempty"`
  620. // Frame: Stack frames in this stack trace.
  621. Frame []*StackFrame `json:"frame,omitempty"`
  622. // ForceSendFields is a list of field names (e.g. "DroppedFramesCount")
  623. // to unconditionally include in API requests. By default, fields with
  624. // empty values are omitted from API requests. However, any non-pointer,
  625. // non-interface field appearing in ForceSendFields will be sent to the
  626. // server regardless of whether the field is empty or not. This may be
  627. // used to include empty fields in Patch requests.
  628. ForceSendFields []string `json:"-"`
  629. // NullFields is a list of field names (e.g. "DroppedFramesCount") to
  630. // include in API requests with the JSON null value. By default, fields
  631. // with empty values are omitted from API requests. However, any field
  632. // with an empty value appearing in NullFields will be sent to the
  633. // server as null. It is an error if a field in this list has a
  634. // non-empty value. This may be used to include null fields in Patch
  635. // requests.
  636. NullFields []string `json:"-"`
  637. }
  638. func (s *StackFrames) MarshalJSON() ([]byte, error) {
  639. type NoMethod StackFrames
  640. raw := NoMethod(*s)
  641. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  642. }
  643. // StackTrace: StackTrace collected in a trace.
  644. type StackTrace struct {
  645. // StackFrames: Stack frames in this stack trace. A maximum of 128
  646. // frames are allowed.
  647. StackFrames *StackFrames `json:"stackFrames,omitempty"`
  648. // StackTraceHashId: The hash ID is used to conserve network bandwidth
  649. // for duplicate
  650. // stack traces within a single trace.
  651. //
  652. // Often multiple spans will have identical stack traces.
  653. // The first occurrence of a stack trace should contain both
  654. // the
  655. // `stackFrame` content and a value in `stackTraceHashId`.
  656. //
  657. // Subsequent spans within the same request can refer
  658. // to that stack trace by only setting `stackTraceHashId`.
  659. StackTraceHashId uint64 `json:"stackTraceHashId,omitempty,string"`
  660. // ForceSendFields is a list of field names (e.g. "StackFrames") to
  661. // unconditionally include in API requests. By default, fields with
  662. // empty values are omitted from API requests. However, any non-pointer,
  663. // non-interface field appearing in ForceSendFields will be sent to the
  664. // server regardless of whether the field is empty or not. This may be
  665. // used to include empty fields in Patch requests.
  666. ForceSendFields []string `json:"-"`
  667. // NullFields is a list of field names (e.g. "StackFrames") to include
  668. // in API requests with the JSON null value. By default, fields with
  669. // empty values are omitted from API requests. However, any field with
  670. // an empty value appearing in NullFields will be sent to the server as
  671. // null. It is an error if a field in this list has a non-empty value.
  672. // This may be used to include null fields in Patch requests.
  673. NullFields []string `json:"-"`
  674. }
  675. func (s *StackTrace) MarshalJSON() ([]byte, error) {
  676. type NoMethod StackTrace
  677. raw := NoMethod(*s)
  678. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  679. }
  680. // Status: The `Status` type defines a logical error model that is
  681. // suitable for different
  682. // programming environments, including REST APIs and RPC APIs. It is
  683. // used by
  684. // [gRPC](https://github.com/grpc). The error model is designed to
  685. // be:
  686. //
  687. // - Simple to use and understand for most users
  688. // - Flexible enough to meet unexpected needs
  689. //
  690. // # Overview
  691. //
  692. // The `Status` message contains three pieces of data: error code, error
  693. // message,
  694. // and error details. The error code should be an enum value
  695. // of
  696. // google.rpc.Code, but it may accept additional error codes if needed.
  697. // The
  698. // error message should be a developer-facing English message that
  699. // helps
  700. // developers *understand* and *resolve* the error. If a localized
  701. // user-facing
  702. // error message is needed, put the localized message in the error
  703. // details or
  704. // localize it in the client. The optional error details may contain
  705. // arbitrary
  706. // information about the error. There is a predefined set of error
  707. // detail types
  708. // in the package `google.rpc` that can be used for common error
  709. // conditions.
  710. //
  711. // # Language mapping
  712. //
  713. // The `Status` message is the logical representation of the error
  714. // model, but it
  715. // is not necessarily the actual wire format. When the `Status` message
  716. // is
  717. // exposed in different client libraries and different wire protocols,
  718. // it can be
  719. // mapped differently. For example, it will likely be mapped to some
  720. // exceptions
  721. // in Java, but more likely mapped to some error codes in C.
  722. //
  723. // # Other uses
  724. //
  725. // The error model and the `Status` message can be used in a variety
  726. // of
  727. // environments, either with or without APIs, to provide a
  728. // consistent developer experience across different
  729. // environments.
  730. //
  731. // Example uses of this error model include:
  732. //
  733. // - Partial errors. If a service needs to return partial errors to the
  734. // client,
  735. // it may embed the `Status` in the normal response to indicate the
  736. // partial
  737. // errors.
  738. //
  739. // - Workflow errors. A typical workflow has multiple steps. Each step
  740. // may
  741. // have a `Status` message for error reporting.
  742. //
  743. // - Batch operations. If a client uses batch request and batch
  744. // response, the
  745. // `Status` message should be used directly inside batch response,
  746. // one for
  747. // each error sub-response.
  748. //
  749. // - Asynchronous operations. If an API call embeds asynchronous
  750. // operation
  751. // results in its response, the status of those operations should
  752. // be
  753. // represented directly using the `Status` message.
  754. //
  755. // - Logging. If some API errors are stored in logs, the message
  756. // `Status` could
  757. // be used directly after any stripping needed for security/privacy
  758. // reasons.
  759. type Status struct {
  760. // Code: The status code, which should be an enum value of
  761. // google.rpc.Code.
  762. Code int64 `json:"code,omitempty"`
  763. // Details: A list of messages that carry the error details. There will
  764. // be a
  765. // common set of message types for APIs to use.
  766. Details []googleapi.RawMessage `json:"details,omitempty"`
  767. // Message: A developer-facing error message, which should be in
  768. // English. Any
  769. // user-facing error message should be localized and sent in
  770. // the
  771. // google.rpc.Status.details field, or localized by the client.
  772. Message string `json:"message,omitempty"`
  773. // ForceSendFields is a list of field names (e.g. "Code") to
  774. // unconditionally include in API requests. By default, fields with
  775. // empty values are omitted from API requests. However, any non-pointer,
  776. // non-interface field appearing in ForceSendFields will be sent to the
  777. // server regardless of whether the field is empty or not. This may be
  778. // used to include empty fields in Patch requests.
  779. ForceSendFields []string `json:"-"`
  780. // NullFields is a list of field names (e.g. "Code") to include in API
  781. // requests with the JSON null value. By default, fields with empty
  782. // values are omitted from API requests. However, any field with an
  783. // empty value appearing in NullFields will be sent to the server as
  784. // null. It is an error if a field in this list has a non-empty value.
  785. // This may be used to include null fields in Patch requests.
  786. NullFields []string `json:"-"`
  787. }
  788. func (s *Status) MarshalJSON() ([]byte, error) {
  789. type NoMethod Status
  790. raw := NoMethod(*s)
  791. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  792. }
  793. // TimeEvent: A time-stamped annotation in the Span.
  794. type TimeEvent struct {
  795. // Annotation: One or more key:value pairs.
  796. Annotation *Annotation `json:"annotation,omitempty"`
  797. // NetworkEvent: An event describing an RPC message sent/received on the
  798. // network.
  799. NetworkEvent *NetworkEvent `json:"networkEvent,omitempty"`
  800. // Time: The timestamp indicating the time the event occurred.
  801. Time string `json:"time,omitempty"`
  802. // ForceSendFields is a list of field names (e.g. "Annotation") to
  803. // unconditionally include in API requests. By default, fields with
  804. // empty values are omitted from API requests. However, any non-pointer,
  805. // non-interface field appearing in ForceSendFields will be sent to the
  806. // server regardless of whether the field is empty or not. This may be
  807. // used to include empty fields in Patch requests.
  808. ForceSendFields []string `json:"-"`
  809. // NullFields is a list of field names (e.g. "Annotation") to include in
  810. // API requests with the JSON null value. By default, fields with empty
  811. // values are omitted from API requests. However, any field with an
  812. // empty value appearing in NullFields will be sent to the server as
  813. // null. It is an error if a field in this list has a non-empty value.
  814. // This may be used to include null fields in Patch requests.
  815. NullFields []string `json:"-"`
  816. }
  817. func (s *TimeEvent) MarshalJSON() ([]byte, error) {
  818. type NoMethod TimeEvent
  819. raw := NoMethod(*s)
  820. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  821. }
  822. // TimeEvents: A collection of `TimeEvent`s. A `TimeEvent` is a
  823. // time-stamped annotation
  824. // on the span, consisting of either user-supplied key:value pairs,
  825. // or
  826. // details of an RPC message sent/received on the network.
  827. type TimeEvents struct {
  828. // DroppedAnnotationsCount: The number of dropped annotations after the
  829. // maximum size was enforced. If
  830. // 0 then no annotations were dropped.
  831. DroppedAnnotationsCount int64 `json:"droppedAnnotationsCount,omitempty"`
  832. // DroppedNetworkEventsCount: The number of dropped network events after
  833. // the maximum size was enforced.
  834. // If 0 then no annotations were dropped.
  835. DroppedNetworkEventsCount int64 `json:"droppedNetworkEventsCount,omitempty"`
  836. // TimeEvent: A collection of `TimeEvent`s.
  837. TimeEvent []*TimeEvent `json:"timeEvent,omitempty"`
  838. // ForceSendFields is a list of field names (e.g.
  839. // "DroppedAnnotationsCount") to unconditionally include in API
  840. // requests. By default, fields with empty values are omitted from API
  841. // requests. However, any non-pointer, non-interface field appearing in
  842. // ForceSendFields will be sent to the server regardless of whether the
  843. // field is empty or not. This may be used to include empty fields in
  844. // Patch requests.
  845. ForceSendFields []string `json:"-"`
  846. // NullFields is a list of field names (e.g. "DroppedAnnotationsCount")
  847. // to include in API requests with the JSON null value. By default,
  848. // fields with empty values are omitted from API requests. However, any
  849. // field with an empty value appearing in NullFields will be sent to the
  850. // server as null. It is an error if a field in this list has a
  851. // non-empty value. This may be used to include null fields in Patch
  852. // requests.
  853. NullFields []string `json:"-"`
  854. }
  855. func (s *TimeEvents) MarshalJSON() ([]byte, error) {
  856. type NoMethod TimeEvents
  857. raw := NoMethod(*s)
  858. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  859. }
  860. // Trace: A trace describes how long it takes for an application to
  861. // perform some
  862. // operations. It consists of a set of spans, each representing
  863. // an operation and including time information and operation details.
  864. type Trace struct {
  865. // Name: The resource name of Trace in the
  866. // format
  867. // `projects/PROJECT_ID/traces/TRACE_ID`. `TRACE_ID` is a unique
  868. // identifier
  869. // for a trace within a project and is a base16-encoded,
  870. // case-insensitive
  871. // string and is required to be 32 char long.
  872. Name string `json:"name,omitempty"`
  873. // ForceSendFields is a list of field names (e.g. "Name") to
  874. // unconditionally include in API requests. By default, fields with
  875. // empty values are omitted from API requests. However, any non-pointer,
  876. // non-interface field appearing in ForceSendFields will be sent to the
  877. // server regardless of whether the field is empty or not. This may be
  878. // used to include empty fields in Patch requests.
  879. ForceSendFields []string `json:"-"`
  880. // NullFields is a list of field names (e.g. "Name") to include in API
  881. // requests with the JSON null value. By default, fields with empty
  882. // values are omitted from API requests. However, any field with an
  883. // empty value appearing in NullFields will be sent to the server as
  884. // null. It is an error if a field in this list has a non-empty value.
  885. // This may be used to include null fields in Patch requests.
  886. NullFields []string `json:"-"`
  887. }
  888. func (s *Trace) MarshalJSON() ([]byte, error) {
  889. type NoMethod Trace
  890. raw := NoMethod(*s)
  891. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  892. }
  893. // TruncatableString: Represents a string value that might be truncated.
  894. type TruncatableString struct {
  895. // TruncatedCharacterCount: The number of characters truncated from the
  896. // original string value. If 0 it
  897. // means that the string value was not truncated.
  898. TruncatedCharacterCount int64 `json:"truncatedCharacterCount,omitempty"`
  899. // Value: The truncated string value. E.g. for a string attribute this
  900. // may have up to
  901. // 256 bytes.
  902. Value string `json:"value,omitempty"`
  903. // ForceSendFields is a list of field names (e.g.
  904. // "TruncatedCharacterCount") to unconditionally include in API
  905. // requests. By default, fields with empty values are omitted from API
  906. // requests. However, any non-pointer, non-interface field appearing in
  907. // ForceSendFields will be sent to the server regardless of whether the
  908. // field is empty or not. This may be used to include empty fields in
  909. // Patch requests.
  910. ForceSendFields []string `json:"-"`
  911. // NullFields is a list of field names (e.g. "TruncatedCharacterCount")
  912. // to include in API requests with the JSON null value. By default,
  913. // fields with empty values are omitted from API requests. However, any
  914. // field with an empty value appearing in NullFields will be sent to the
  915. // server as null. It is an error if a field in this list has a
  916. // non-empty value. This may be used to include null fields in Patch
  917. // requests.
  918. NullFields []string `json:"-"`
  919. }
  920. func (s *TruncatableString) MarshalJSON() ([]byte, error) {
  921. type NoMethod TruncatableString
  922. raw := NoMethod(*s)
  923. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  924. }
  925. // method id "tracing.projects.traces.batchWrite":
  926. type ProjectsTracesBatchWriteCall struct {
  927. s *Service
  928. name string
  929. batchwritespansrequest *BatchWriteSpansRequest
  930. urlParams_ gensupport.URLParams
  931. ctx_ context.Context
  932. header_ http.Header
  933. }
  934. // BatchWrite: Sends new spans to Stackdriver Trace or updates existing
  935. // traces. If the
  936. // name of a trace that you send matches that of an existing trace, new
  937. // spans
  938. // are added to the existing trace. Attempt to update existing spans
  939. // results
  940. // undefined behavior. If the name does not match, a new trace is
  941. // created
  942. // with given set of spans.
  943. func (r *ProjectsTracesService) BatchWrite(name string, batchwritespansrequest *BatchWriteSpansRequest) *ProjectsTracesBatchWriteCall {
  944. c := &ProjectsTracesBatchWriteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  945. c.name = name
  946. c.batchwritespansrequest = batchwritespansrequest
  947. return c
  948. }
  949. // Fields allows partial responses to be retrieved. See
  950. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  951. // for more information.
  952. func (c *ProjectsTracesBatchWriteCall) Fields(s ...googleapi.Field) *ProjectsTracesBatchWriteCall {
  953. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  954. return c
  955. }
  956. // Context sets the context to be used in this call's Do method. Any
  957. // pending HTTP request will be aborted if the provided context is
  958. // canceled.
  959. func (c *ProjectsTracesBatchWriteCall) Context(ctx context.Context) *ProjectsTracesBatchWriteCall {
  960. c.ctx_ = ctx
  961. return c
  962. }
  963. // Header returns an http.Header that can be modified by the caller to
  964. // add HTTP headers to the request.
  965. func (c *ProjectsTracesBatchWriteCall) Header() http.Header {
  966. if c.header_ == nil {
  967. c.header_ = make(http.Header)
  968. }
  969. return c.header_
  970. }
  971. func (c *ProjectsTracesBatchWriteCall) doRequest(alt string) (*http.Response, error) {
  972. reqHeaders := make(http.Header)
  973. for k, v := range c.header_ {
  974. reqHeaders[k] = v
  975. }
  976. reqHeaders.Set("User-Agent", c.s.userAgent())
  977. var body io.Reader = nil
  978. body, err := googleapi.WithoutDataWrapper.JSONReader(c.batchwritespansrequest)
  979. if err != nil {
  980. return nil, err
  981. }
  982. reqHeaders.Set("Content-Type", "application/json")
  983. c.urlParams_.Set("alt", alt)
  984. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}/traces:batchWrite")
  985. urls += "?" + c.urlParams_.Encode()
  986. req, _ := http.NewRequest("POST", urls, body)
  987. req.Header = reqHeaders
  988. googleapi.Expand(req.URL, map[string]string{
  989. "name": c.name,
  990. })
  991. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  992. }
  993. // Do executes the "tracing.projects.traces.batchWrite" call.
  994. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  995. // code is an error. Response headers are in either
  996. // *Empty.ServerResponse.Header or (if a response was returned at all)
  997. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  998. // check whether the returned error was because http.StatusNotModified
  999. // was returned.
  1000. func (c *ProjectsTracesBatchWriteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1001. gensupport.SetOptions(c.urlParams_, opts...)
  1002. res, err := c.doRequest("json")
  1003. if res != nil && res.StatusCode == http.StatusNotModified {
  1004. if res.Body != nil {
  1005. res.Body.Close()
  1006. }
  1007. return nil, &googleapi.Error{
  1008. Code: res.StatusCode,
  1009. Header: res.Header,
  1010. }
  1011. }
  1012. if err != nil {
  1013. return nil, err
  1014. }
  1015. defer googleapi.CloseBody(res)
  1016. if err := googleapi.CheckResponse(res); err != nil {
  1017. return nil, err
  1018. }
  1019. ret := &Empty{
  1020. ServerResponse: googleapi.ServerResponse{
  1021. Header: res.Header,
  1022. HTTPStatusCode: res.StatusCode,
  1023. },
  1024. }
  1025. target := &ret
  1026. if err := gensupport.DecodeResponse(target, res); err != nil {
  1027. return nil, err
  1028. }
  1029. return ret, nil
  1030. // {
  1031. // "description": "Sends new spans to Stackdriver Trace or updates existing traces. If the\nname of a trace that you send matches that of an existing trace, new spans\nare added to the existing trace. Attempt to update existing spans results\nundefined behavior. If the name does not match, a new trace is created\nwith given set of spans.",
  1032. // "flatPath": "v2/projects/{projectsId}/traces:batchWrite",
  1033. // "httpMethod": "POST",
  1034. // "id": "tracing.projects.traces.batchWrite",
  1035. // "parameterOrder": [
  1036. // "name"
  1037. // ],
  1038. // "parameters": {
  1039. // "name": {
  1040. // "description": "Name of the project where the spans belong to. Format is\n`projects/PROJECT_ID`.",
  1041. // "location": "path",
  1042. // "pattern": "^projects/[^/]+$",
  1043. // "required": true,
  1044. // "type": "string"
  1045. // }
  1046. // },
  1047. // "path": "v2/{+name}/traces:batchWrite",
  1048. // "request": {
  1049. // "$ref": "BatchWriteSpansRequest"
  1050. // },
  1051. // "response": {
  1052. // "$ref": "Empty"
  1053. // },
  1054. // "scopes": [
  1055. // "https://www.googleapis.com/auth/cloud-platform",
  1056. // "https://www.googleapis.com/auth/trace.append"
  1057. // ]
  1058. // }
  1059. }
  1060. // method id "tracing.projects.traces.list":
  1061. type ProjectsTracesListCall struct {
  1062. s *Service
  1063. parent string
  1064. urlParams_ gensupport.URLParams
  1065. ifNoneMatch_ string
  1066. ctx_ context.Context
  1067. header_ http.Header
  1068. }
  1069. // List: Returns of a list of traces that match the specified filter
  1070. // conditions.
  1071. func (r *ProjectsTracesService) List(parent string) *ProjectsTracesListCall {
  1072. c := &ProjectsTracesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1073. c.parent = parent
  1074. return c
  1075. }
  1076. // EndTime sets the optional parameter "endTime": End of the time
  1077. // interval (inclusive) during which the trace data was
  1078. // collected from the application.
  1079. func (c *ProjectsTracesListCall) EndTime(endTime string) *ProjectsTracesListCall {
  1080. c.urlParams_.Set("endTime", endTime)
  1081. return c
  1082. }
  1083. // Filter sets the optional parameter "filter": An optional filter for
  1084. // the request.
  1085. // Example:
  1086. // `version_label_key:a some_label:some_label_key`
  1087. // returns traces from version `a` and has `some_label` with
  1088. // `some_label_key`.
  1089. func (c *ProjectsTracesListCall) Filter(filter string) *ProjectsTracesListCall {
  1090. c.urlParams_.Set("filter", filter)
  1091. return c
  1092. }
  1093. // OrderBy sets the optional parameter "orderBy": Field used to sort the
  1094. // returned traces.
  1095. // Can be one of the following:
  1096. //
  1097. // * `trace_id`
  1098. // * `name` (`name` field of root span in the trace)
  1099. // * `duration` (difference between `end_time` and `start_time` fields
  1100. // of
  1101. // the root span)
  1102. // * `start` (`start_time` field of the root span)
  1103. //
  1104. // Descending order can be specified by appending `desc` to the sort
  1105. // field
  1106. // (for example, `name desc`).
  1107. //
  1108. // Only one sort field is permitted.
  1109. func (c *ProjectsTracesListCall) OrderBy(orderBy string) *ProjectsTracesListCall {
  1110. c.urlParams_.Set("orderBy", orderBy)
  1111. return c
  1112. }
  1113. // PageSize sets the optional parameter "pageSize": Maximum number of
  1114. // traces to return. If not specified or <= 0, the
  1115. // implementation selects a reasonable value. The implementation
  1116. // may
  1117. // return fewer traces than the requested page size.
  1118. func (c *ProjectsTracesListCall) PageSize(pageSize int64) *ProjectsTracesListCall {
  1119. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1120. return c
  1121. }
  1122. // PageToken sets the optional parameter "pageToken": Token identifying
  1123. // the page of results to return. If provided, use the
  1124. // value of the `next_page_token` field from a previous request.
  1125. func (c *ProjectsTracesListCall) PageToken(pageToken string) *ProjectsTracesListCall {
  1126. c.urlParams_.Set("pageToken", pageToken)
  1127. return c
  1128. }
  1129. // StartTime sets the optional parameter "startTime": Start of the time
  1130. // interval (inclusive) during which the trace data was
  1131. // collected from the application.
  1132. func (c *ProjectsTracesListCall) StartTime(startTime string) *ProjectsTracesListCall {
  1133. c.urlParams_.Set("startTime", startTime)
  1134. return c
  1135. }
  1136. // Fields allows partial responses to be retrieved. See
  1137. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1138. // for more information.
  1139. func (c *ProjectsTracesListCall) Fields(s ...googleapi.Field) *ProjectsTracesListCall {
  1140. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1141. return c
  1142. }
  1143. // IfNoneMatch sets the optional parameter which makes the operation
  1144. // fail if the object's ETag matches the given value. This is useful for
  1145. // getting updates only after the object has changed since the last
  1146. // request. Use googleapi.IsNotModified to check whether the response
  1147. // error from Do is the result of In-None-Match.
  1148. func (c *ProjectsTracesListCall) IfNoneMatch(entityTag string) *ProjectsTracesListCall {
  1149. c.ifNoneMatch_ = entityTag
  1150. return c
  1151. }
  1152. // Context sets the context to be used in this call's Do method. Any
  1153. // pending HTTP request will be aborted if the provided context is
  1154. // canceled.
  1155. func (c *ProjectsTracesListCall) Context(ctx context.Context) *ProjectsTracesListCall {
  1156. c.ctx_ = ctx
  1157. return c
  1158. }
  1159. // Header returns an http.Header that can be modified by the caller to
  1160. // add HTTP headers to the request.
  1161. func (c *ProjectsTracesListCall) Header() http.Header {
  1162. if c.header_ == nil {
  1163. c.header_ = make(http.Header)
  1164. }
  1165. return c.header_
  1166. }
  1167. func (c *ProjectsTracesListCall) doRequest(alt string) (*http.Response, error) {
  1168. reqHeaders := make(http.Header)
  1169. for k, v := range c.header_ {
  1170. reqHeaders[k] = v
  1171. }
  1172. reqHeaders.Set("User-Agent", c.s.userAgent())
  1173. if c.ifNoneMatch_ != "" {
  1174. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1175. }
  1176. var body io.Reader = nil
  1177. c.urlParams_.Set("alt", alt)
  1178. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/traces")
  1179. urls += "?" + c.urlParams_.Encode()
  1180. req, _ := http.NewRequest("GET", urls, body)
  1181. req.Header = reqHeaders
  1182. googleapi.Expand(req.URL, map[string]string{
  1183. "parent": c.parent,
  1184. })
  1185. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1186. }
  1187. // Do executes the "tracing.projects.traces.list" call.
  1188. // Exactly one of *ListTracesResponse or error will be non-nil. Any
  1189. // non-2xx status code is an error. Response headers are in either
  1190. // *ListTracesResponse.ServerResponse.Header or (if a response was
  1191. // returned at all) in error.(*googleapi.Error).Header. Use
  1192. // googleapi.IsNotModified to check whether the returned error was
  1193. // because http.StatusNotModified was returned.
  1194. func (c *ProjectsTracesListCall) Do(opts ...googleapi.CallOption) (*ListTracesResponse, error) {
  1195. gensupport.SetOptions(c.urlParams_, opts...)
  1196. res, err := c.doRequest("json")
  1197. if res != nil && res.StatusCode == http.StatusNotModified {
  1198. if res.Body != nil {
  1199. res.Body.Close()
  1200. }
  1201. return nil, &googleapi.Error{
  1202. Code: res.StatusCode,
  1203. Header: res.Header,
  1204. }
  1205. }
  1206. if err != nil {
  1207. return nil, err
  1208. }
  1209. defer googleapi.CloseBody(res)
  1210. if err := googleapi.CheckResponse(res); err != nil {
  1211. return nil, err
  1212. }
  1213. ret := &ListTracesResponse{
  1214. ServerResponse: googleapi.ServerResponse{
  1215. Header: res.Header,
  1216. HTTPStatusCode: res.StatusCode,
  1217. },
  1218. }
  1219. target := &ret
  1220. if err := gensupport.DecodeResponse(target, res); err != nil {
  1221. return nil, err
  1222. }
  1223. return ret, nil
  1224. // {
  1225. // "description": "Returns of a list of traces that match the specified filter conditions.",
  1226. // "flatPath": "v2/projects/{projectsId}/traces",
  1227. // "httpMethod": "GET",
  1228. // "id": "tracing.projects.traces.list",
  1229. // "parameterOrder": [
  1230. // "parent"
  1231. // ],
  1232. // "parameters": {
  1233. // "endTime": {
  1234. // "description": "End of the time interval (inclusive) during which the trace data was\ncollected from the application.",
  1235. // "format": "google-datetime",
  1236. // "location": "query",
  1237. // "type": "string"
  1238. // },
  1239. // "filter": {
  1240. // "description": "An optional filter for the request.\nExample:\n`version_label_key:a some_label:some_label_key`\nreturns traces from version `a` and has `some_label` with `some_label_key`.",
  1241. // "location": "query",
  1242. // "type": "string"
  1243. // },
  1244. // "orderBy": {
  1245. // "description": "Field used to sort the returned traces. Optional.\nCan be one of the following:\n\n* `trace_id`\n* `name` (`name` field of root span in the trace)\n* `duration` (difference between `end_time` and `start_time` fields of\n the root span)\n* `start` (`start_time` field of the root span)\n\nDescending order can be specified by appending `desc` to the sort field\n(for example, `name desc`).\n\nOnly one sort field is permitted.",
  1246. // "location": "query",
  1247. // "type": "string"
  1248. // },
  1249. // "pageSize": {
  1250. // "description": "Maximum number of traces to return. If not specified or \u003c= 0, the\nimplementation selects a reasonable value. The implementation may\nreturn fewer traces than the requested page size. Optional.",
  1251. // "format": "int32",
  1252. // "location": "query",
  1253. // "type": "integer"
  1254. // },
  1255. // "pageToken": {
  1256. // "description": "Token identifying the page of results to return. If provided, use the\nvalue of the `next_page_token` field from a previous request. Optional.",
  1257. // "location": "query",
  1258. // "type": "string"
  1259. // },
  1260. // "parent": {
  1261. // "description": "ID of the Cloud project where the trace data is stored which is\n`projects/PROJECT_ID`.",
  1262. // "location": "path",
  1263. // "pattern": "^projects/[^/]+$",
  1264. // "required": true,
  1265. // "type": "string"
  1266. // },
  1267. // "startTime": {
  1268. // "description": "Start of the time interval (inclusive) during which the trace data was\ncollected from the application.",
  1269. // "format": "google-datetime",
  1270. // "location": "query",
  1271. // "type": "string"
  1272. // }
  1273. // },
  1274. // "path": "v2/{+parent}/traces",
  1275. // "response": {
  1276. // "$ref": "ListTracesResponse"
  1277. // },
  1278. // "scopes": [
  1279. // "https://www.googleapis.com/auth/cloud-platform",
  1280. // "https://www.googleapis.com/auth/trace.readonly"
  1281. // ]
  1282. // }
  1283. }
  1284. // Pages invokes f for each page of results.
  1285. // A non-nil error returned from f will halt the iteration.
  1286. // The provided context supersedes any context provided to the Context method.
  1287. func (c *ProjectsTracesListCall) Pages(ctx context.Context, f func(*ListTracesResponse) error) error {
  1288. c.ctx_ = ctx
  1289. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1290. for {
  1291. x, err := c.Do()
  1292. if err != nil {
  1293. return err
  1294. }
  1295. if err := f(x); err != nil {
  1296. return err
  1297. }
  1298. if x.NextPageToken == "" {
  1299. return nil
  1300. }
  1301. c.PageToken(x.NextPageToken)
  1302. }
  1303. }
  1304. // method id "tracing.projects.traces.listSpans":
  1305. type ProjectsTracesListSpansCall struct {
  1306. s *Service
  1307. parent string
  1308. urlParams_ gensupport.URLParams
  1309. ifNoneMatch_ string
  1310. ctx_ context.Context
  1311. header_ http.Header
  1312. }
  1313. // ListSpans: Returns a list of spans within a trace.
  1314. func (r *ProjectsTracesService) ListSpans(parent string) *ProjectsTracesListSpansCall {
  1315. c := &ProjectsTracesListSpansCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1316. c.parent = parent
  1317. return c
  1318. }
  1319. // PageToken sets the optional parameter "pageToken": Token identifying
  1320. // the page of results to return. If provided, use the
  1321. // value of the `nextPageToken` field from a previous request.
  1322. func (c *ProjectsTracesListSpansCall) PageToken(pageToken string) *ProjectsTracesListSpansCall {
  1323. c.urlParams_.Set("pageToken", pageToken)
  1324. return c
  1325. }
  1326. // Fields allows partial responses to be retrieved. See
  1327. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1328. // for more information.
  1329. func (c *ProjectsTracesListSpansCall) Fields(s ...googleapi.Field) *ProjectsTracesListSpansCall {
  1330. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1331. return c
  1332. }
  1333. // IfNoneMatch sets the optional parameter which makes the operation
  1334. // fail if the object's ETag matches the given value. This is useful for
  1335. // getting updates only after the object has changed since the last
  1336. // request. Use googleapi.IsNotModified to check whether the response
  1337. // error from Do is the result of In-None-Match.
  1338. func (c *ProjectsTracesListSpansCall) IfNoneMatch(entityTag string) *ProjectsTracesListSpansCall {
  1339. c.ifNoneMatch_ = entityTag
  1340. return c
  1341. }
  1342. // Context sets the context to be used in this call's Do method. Any
  1343. // pending HTTP request will be aborted if the provided context is
  1344. // canceled.
  1345. func (c *ProjectsTracesListSpansCall) Context(ctx context.Context) *ProjectsTracesListSpansCall {
  1346. c.ctx_ = ctx
  1347. return c
  1348. }
  1349. // Header returns an http.Header that can be modified by the caller to
  1350. // add HTTP headers to the request.
  1351. func (c *ProjectsTracesListSpansCall) Header() http.Header {
  1352. if c.header_ == nil {
  1353. c.header_ = make(http.Header)
  1354. }
  1355. return c.header_
  1356. }
  1357. func (c *ProjectsTracesListSpansCall) doRequest(alt string) (*http.Response, error) {
  1358. reqHeaders := make(http.Header)
  1359. for k, v := range c.header_ {
  1360. reqHeaders[k] = v
  1361. }
  1362. reqHeaders.Set("User-Agent", c.s.userAgent())
  1363. if c.ifNoneMatch_ != "" {
  1364. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1365. }
  1366. var body io.Reader = nil
  1367. c.urlParams_.Set("alt", alt)
  1368. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}:listSpans")
  1369. urls += "?" + c.urlParams_.Encode()
  1370. req, _ := http.NewRequest("GET", urls, body)
  1371. req.Header = reqHeaders
  1372. googleapi.Expand(req.URL, map[string]string{
  1373. "parent": c.parent,
  1374. })
  1375. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1376. }
  1377. // Do executes the "tracing.projects.traces.listSpans" call.
  1378. // Exactly one of *ListSpansResponse or error will be non-nil. Any
  1379. // non-2xx status code is an error. Response headers are in either
  1380. // *ListSpansResponse.ServerResponse.Header or (if a response was
  1381. // returned at all) in error.(*googleapi.Error).Header. Use
  1382. // googleapi.IsNotModified to check whether the returned error was
  1383. // because http.StatusNotModified was returned.
  1384. func (c *ProjectsTracesListSpansCall) Do(opts ...googleapi.CallOption) (*ListSpansResponse, error) {
  1385. gensupport.SetOptions(c.urlParams_, opts...)
  1386. res, err := c.doRequest("json")
  1387. if res != nil && res.StatusCode == http.StatusNotModified {
  1388. if res.Body != nil {
  1389. res.Body.Close()
  1390. }
  1391. return nil, &googleapi.Error{
  1392. Code: res.StatusCode,
  1393. Header: res.Header,
  1394. }
  1395. }
  1396. if err != nil {
  1397. return nil, err
  1398. }
  1399. defer googleapi.CloseBody(res)
  1400. if err := googleapi.CheckResponse(res); err != nil {
  1401. return nil, err
  1402. }
  1403. ret := &ListSpansResponse{
  1404. ServerResponse: googleapi.ServerResponse{
  1405. Header: res.Header,
  1406. HTTPStatusCode: res.StatusCode,
  1407. },
  1408. }
  1409. target := &ret
  1410. if err := gensupport.DecodeResponse(target, res); err != nil {
  1411. return nil, err
  1412. }
  1413. return ret, nil
  1414. // {
  1415. // "description": "Returns a list of spans within a trace.",
  1416. // "flatPath": "v2/projects/{projectsId}/traces/{tracesId}:listSpans",
  1417. // "httpMethod": "GET",
  1418. // "id": "tracing.projects.traces.listSpans",
  1419. // "parameterOrder": [
  1420. // "parent"
  1421. // ],
  1422. // "parameters": {
  1423. // "pageToken": {
  1424. // "description": "Token identifying the page of results to return. If provided, use the\nvalue of the `nextPageToken` field from a previous request. Optional.",
  1425. // "location": "query",
  1426. // "type": "string"
  1427. // },
  1428. // "parent": {
  1429. // "description": "ID of the trace for which to list child spans. Format is\n`projects/PROJECT_ID/traces/TRACE_ID`.",
  1430. // "location": "path",
  1431. // "pattern": "^projects/[^/]+/traces/[^/]+$",
  1432. // "required": true,
  1433. // "type": "string"
  1434. // }
  1435. // },
  1436. // "path": "v2/{+parent}:listSpans",
  1437. // "response": {
  1438. // "$ref": "ListSpansResponse"
  1439. // },
  1440. // "scopes": [
  1441. // "https://www.googleapis.com/auth/cloud-platform",
  1442. // "https://www.googleapis.com/auth/trace.readonly"
  1443. // ]
  1444. // }
  1445. }
  1446. // Pages invokes f for each page of results.
  1447. // A non-nil error returned from f will halt the iteration.
  1448. // The provided context supersedes any context provided to the Context method.
  1449. func (c *ProjectsTracesListSpansCall) Pages(ctx context.Context, f func(*ListSpansResponse) error) error {
  1450. c.ctx_ = ctx
  1451. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1452. for {
  1453. x, err := c.Do()
  1454. if err != nil {
  1455. return err
  1456. }
  1457. if err := f(x); err != nil {
  1458. return err
  1459. }
  1460. if x.NextPageToken == "" {
  1461. return nil
  1462. }
  1463. c.PageToken(x.NextPageToken)
  1464. }
  1465. }
  1466. // method id "tracing.projects.traces.spans.create":
  1467. type ProjectsTracesSpansCreateCall struct {
  1468. s *Service
  1469. nameid string
  1470. span *Span
  1471. urlParams_ gensupport.URLParams
  1472. ctx_ context.Context
  1473. header_ http.Header
  1474. }
  1475. // Create: Creates a new Span.
  1476. func (r *ProjectsTracesSpansService) Create(nameid string, span *Span) *ProjectsTracesSpansCreateCall {
  1477. c := &ProjectsTracesSpansCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1478. c.nameid = nameid
  1479. c.span = span
  1480. return c
  1481. }
  1482. // Fields allows partial responses to be retrieved. See
  1483. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1484. // for more information.
  1485. func (c *ProjectsTracesSpansCreateCall) Fields(s ...googleapi.Field) *ProjectsTracesSpansCreateCall {
  1486. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1487. return c
  1488. }
  1489. // Context sets the context to be used in this call's Do method. Any
  1490. // pending HTTP request will be aborted if the provided context is
  1491. // canceled.
  1492. func (c *ProjectsTracesSpansCreateCall) Context(ctx context.Context) *ProjectsTracesSpansCreateCall {
  1493. c.ctx_ = ctx
  1494. return c
  1495. }
  1496. // Header returns an http.Header that can be modified by the caller to
  1497. // add HTTP headers to the request.
  1498. func (c *ProjectsTracesSpansCreateCall) Header() http.Header {
  1499. if c.header_ == nil {
  1500. c.header_ = make(http.Header)
  1501. }
  1502. return c.header_
  1503. }
  1504. func (c *ProjectsTracesSpansCreateCall) doRequest(alt string) (*http.Response, error) {
  1505. reqHeaders := make(http.Header)
  1506. for k, v := range c.header_ {
  1507. reqHeaders[k] = v
  1508. }
  1509. reqHeaders.Set("User-Agent", c.s.userAgent())
  1510. var body io.Reader = nil
  1511. body, err := googleapi.WithoutDataWrapper.JSONReader(c.span)
  1512. if err != nil {
  1513. return nil, err
  1514. }
  1515. reqHeaders.Set("Content-Type", "application/json")
  1516. c.urlParams_.Set("alt", alt)
  1517. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  1518. urls += "?" + c.urlParams_.Encode()
  1519. req, _ := http.NewRequest("PUT", urls, body)
  1520. req.Header = reqHeaders
  1521. googleapi.Expand(req.URL, map[string]string{
  1522. "name": c.nameid,
  1523. })
  1524. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1525. }
  1526. // Do executes the "tracing.projects.traces.spans.create" call.
  1527. // Exactly one of *Span or error will be non-nil. Any non-2xx status
  1528. // code is an error. Response headers are in either
  1529. // *Span.ServerResponse.Header or (if a response was returned at all) in
  1530. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1531. // whether the returned error was because http.StatusNotModified was
  1532. // returned.
  1533. func (c *ProjectsTracesSpansCreateCall) Do(opts ...googleapi.CallOption) (*Span, error) {
  1534. gensupport.SetOptions(c.urlParams_, opts...)
  1535. res, err := c.doRequest("json")
  1536. if res != nil && res.StatusCode == http.StatusNotModified {
  1537. if res.Body != nil {
  1538. res.Body.Close()
  1539. }
  1540. return nil, &googleapi.Error{
  1541. Code: res.StatusCode,
  1542. Header: res.Header,
  1543. }
  1544. }
  1545. if err != nil {
  1546. return nil, err
  1547. }
  1548. defer googleapi.CloseBody(res)
  1549. if err := googleapi.CheckResponse(res); err != nil {
  1550. return nil, err
  1551. }
  1552. ret := &Span{
  1553. ServerResponse: googleapi.ServerResponse{
  1554. Header: res.Header,
  1555. HTTPStatusCode: res.StatusCode,
  1556. },
  1557. }
  1558. target := &ret
  1559. if err := gensupport.DecodeResponse(target, res); err != nil {
  1560. return nil, err
  1561. }
  1562. return ret, nil
  1563. // {
  1564. // "description": "Creates a new Span.",
  1565. // "flatPath": "v2/projects/{projectsId}/traces/{tracesId}/spans/{spansId}",
  1566. // "httpMethod": "PUT",
  1567. // "id": "tracing.projects.traces.spans.create",
  1568. // "parameterOrder": [
  1569. // "name"
  1570. // ],
  1571. // "parameters": {
  1572. // "name": {
  1573. // "description": "The resource name of Span in the format\n`projects/PROJECT_ID/traces/TRACE_ID/spans/SPAN_ID`.\n`TRACE_ID` is a unique identifier for a trace within a project and is a\nbase16-encoded, case-insensitive string and is required to be 32 char long.\n`SPAN_ID` is a unique identifier for a span within a trace. It is a\nbase 16-encoded, case-insensitive string of a 8-bytes array and is required\nto be 16 char long.",
  1574. // "location": "path",
  1575. // "pattern": "^projects/[^/]+/traces/[^/]+/spans/[^/]+$",
  1576. // "required": true,
  1577. // "type": "string"
  1578. // }
  1579. // },
  1580. // "path": "v2/{+name}",
  1581. // "request": {
  1582. // "$ref": "Span"
  1583. // },
  1584. // "response": {
  1585. // "$ref": "Span"
  1586. // },
  1587. // "scopes": [
  1588. // "https://www.googleapis.com/auth/cloud-platform",
  1589. // "https://www.googleapis.com/auth/trace.append"
  1590. // ]
  1591. // }
  1592. }