Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 

1781 строка
64 KiB

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