1// Copyright 2022 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.devtools.cloudtrace.v2;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/api/resource.proto";
23import "google/devtools/cloudtrace/v2/trace.proto";
24import "google/protobuf/empty.proto";
25
26option csharp_namespace = "Google.Cloud.Trace.V2";
27option go_package = "cloud.google.com/go/trace/apiv2/tracepb;tracepb";
28option java_multiple_files = true;
29option java_outer_classname = "TracingProto";
30option java_package = "com.google.devtools.cloudtrace.v2";
31option php_namespace = "Google\\Cloud\\Trace\\V2";
32option ruby_package = "Google::Cloud::Trace::V2";
33
34// Service for collecting and viewing traces and spans within a trace.
35//
36// A trace is a collection of spans corresponding to a single
37// operation or a set of operations in an application.
38//
39// A span is an individual timed event which forms a node of the trace tree.
40// A single trace can contain spans from multiple services.
41service TraceService {
42  option (google.api.default_host) = "cloudtrace.googleapis.com";
43  option (google.api.oauth_scopes) =
44      "https://www.googleapis.com/auth/cloud-platform,"
45      "https://www.googleapis.com/auth/trace.append";
46
47  // Batch writes new spans to new or existing traces. You cannot update
48  // existing spans.
49  rpc BatchWriteSpans(BatchWriteSpansRequest) returns (google.protobuf.Empty) {
50    option (google.api.http) = {
51      post: "/v2/{name=projects/*}/traces:batchWrite"
52      body: "*"
53    };
54    option (google.api.method_signature) = "name,spans";
55  }
56
57  // Creates a new span.
58  rpc CreateSpan(Span) returns (Span) {
59    option (google.api.http) = {
60      post: "/v2/{name=projects/*/traces/*/spans/*}"
61      body: "*"
62    };
63  }
64}
65
66// The request message for the `BatchWriteSpans` method.
67message BatchWriteSpansRequest {
68  // Required. The name of the project where the spans belong. The format is
69  // `projects/[PROJECT_ID]`.
70  string name = 1 [
71    (google.api.field_behavior) = REQUIRED,
72    (google.api.resource_reference) = {
73      type: "cloudresourcemanager.googleapis.com/Project"
74    }
75  ];
76
77  // Required. A list of new spans. The span names must not match existing
78  // spans, otherwise the results are undefined.
79  repeated Span spans = 2 [(google.api.field_behavior) = REQUIRED];
80}
81