Skip to content
This repository was archived by the owner on Dec 31, 2023. It is now read-only.

Commit 4c02194

Browse files
yoshi-automationbusunkim96
authored andcommitted
fix(trace)!: remove span_path resource helper method from v2; modify retry configs; standardize usage of 'optional' and 'required' for args in docstrings; add 2.7 deprecation warning (via synth) (#10075)
1 parent 2a481ba commit 4c02194

17 files changed

+495
-396
lines changed

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
# Add any paths that contain custom static files (such as style sheets) here,
165165
# relative to this directory. They are copied after the builtin static files,
166166
# so a file named "default.css" will overwrite the builtin "default.css".
167-
# html_static_path = []
167+
html_static_path = ["_static"]
168168

169169
# Add any extra paths that contain custom files (such as robots.txt or
170170
# .htaccess) here, relative to this directory. These files are copied

google/cloud/trace_v1/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,23 @@
1616

1717

1818
from __future__ import absolute_import
19+
import sys
20+
import warnings
1921

2022
from google.cloud.trace_v1 import types
2123
from google.cloud.trace_v1.gapic import enums
2224
from google.cloud.trace_v1.gapic import trace_service_client
2325

2426

27+
if sys.version_info[:2] == (2, 7):
28+
message = (
29+
"A future version of this library will drop support for Python 2.7."
30+
"More details about Python 2 support for Google Cloud Client Libraries"
31+
"can be found at https://cloud.google.com/python/docs/python2-sunset/"
32+
)
33+
warnings.warn(message, DeprecationWarning)
34+
35+
2536
class TraceServiceClient(trace_service_client.TraceServiceClient):
2637
__doc__ = trace_service_client.TraceServiceClient.__doc__
2738
enums = enums

google/cloud/trace_v1/gapic/trace_service_client.py

Lines changed: 135 additions & 135 deletions
Large diffs are not rendered by default.

google/cloud/trace_v1/gapic/trace_service_client_config.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88
"retry_params": {
99
"default": {
1010
"initial_retry_delay_millis": 100,
11-
"retry_delay_multiplier": 1.2,
12-
"max_retry_delay_millis": 1000,
11+
"retry_delay_multiplier": 1.3,
12+
"max_retry_delay_millis": 60000,
1313
"initial_rpc_timeout_millis": 20000,
14-
"rpc_timeout_multiplier": 1.5,
15-
"max_rpc_timeout_millis": 30000,
16-
"total_timeout_millis": 45000,
14+
"rpc_timeout_multiplier": 1.0,
15+
"max_rpc_timeout_millis": 20000,
16+
"total_timeout_millis": 600000,
1717
}
1818
},
1919
"methods": {
20-
"PatchTraces": {
20+
"ListTraces": {
2121
"timeout_millis": 60000,
2222
"retry_codes_name": "idempotent",
2323
"retry_params_name": "default",
@@ -27,9 +27,9 @@
2727
"retry_codes_name": "idempotent",
2828
"retry_params_name": "default",
2929
},
30-
"ListTraces": {
30+
"PatchTraces": {
3131
"timeout_millis": 60000,
32-
"retry_codes_name": "idempotent",
32+
"retry_codes_name": "non_idempotent",
3333
"retry_params_name": "default",
3434
},
3535
},

google/cloud/trace_v1/gapic/transports/trace_service_grpc_transport.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,21 +112,17 @@ def channel(self):
112112
return self._channel
113113

114114
@property
115-
def patch_traces(self):
116-
"""Return the gRPC stub for :meth:`TraceServiceClient.patch_traces`.
115+
def list_traces(self):
116+
"""Return the gRPC stub for :meth:`TraceServiceClient.list_traces`.
117117
118-
Sends new traces to Stackdriver Trace or updates existing traces. If the ID
119-
of a trace that you send matches that of an existing trace, any fields
120-
in the existing trace and its spans are overwritten by the provided values,
121-
and any new fields provided are merged with the existing trace data. If the
122-
ID does not match, a new trace is created.
118+
Returns of a list of traces that match the specified filter conditions.
123119
124120
Returns:
125121
Callable: A callable which accepts the appropriate
126122
deserialized request object and returns a
127123
deserialized response object.
128124
"""
129-
return self._stubs["trace_service_stub"].PatchTraces
125+
return self._stubs["trace_service_stub"].ListTraces
130126

131127
@property
132128
def get_trace(self):
@@ -142,14 +138,18 @@ def get_trace(self):
142138
return self._stubs["trace_service_stub"].GetTrace
143139

144140
@property
145-
def list_traces(self):
146-
"""Return the gRPC stub for :meth:`TraceServiceClient.list_traces`.
141+
def patch_traces(self):
142+
"""Return the gRPC stub for :meth:`TraceServiceClient.patch_traces`.
147143
148-
Returns of a list of traces that match the specified filter conditions.
144+
Sends new traces to Stackdriver Trace or updates existing traces. If the ID
145+
of a trace that you send matches that of an existing trace, any fields
146+
in the existing trace and its spans are overwritten by the provided values,
147+
and any new fields provided are merged with the existing trace data. If the
148+
ID does not match, a new trace is created.
149149
150150
Returns:
151151
Callable: A callable which accepts the appropriate
152152
deserialized request object and returns a
153153
deserialized response object.
154154
"""
155-
return self._stubs["trace_service_stub"].ListTraces
155+
return self._stubs["trace_service_stub"].PatchTraces

google/cloud/trace_v1/proto/trace.proto

Lines changed: 40 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2017 Google Inc.
1+
// Copyright 2019 Google LLC.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -17,6 +17,9 @@ syntax = "proto3";
1717
package google.devtools.cloudtrace.v1;
1818

1919
import "google/api/annotations.proto";
20+
import "google/api/client.proto";
21+
import "google/api/field_behavior.proto";
22+
import "google/api/resource.proto";
2023
import "google/protobuf/empty.proto";
2124
import "google/protobuf/timestamp.proto";
2225

@@ -33,18 +36,26 @@ option php_namespace = "Google\\Cloud\\Trace\\V1";
3336
// timed event which forms a node of the trace tree. Spans for a single trace
3437
// may span multiple services.
3538
service TraceService {
39+
option (google.api.default_host) = "cloudtrace.googleapis.com";
40+
option (google.api.oauth_scopes) =
41+
"https://www.googleapis.com/auth/cloud-platform,"
42+
"https://www.googleapis.com/auth/trace.append,"
43+
"https://www.googleapis.com/auth/trace.readonly";
44+
3645
// Returns of a list of traces that match the specified filter conditions.
3746
rpc ListTraces(ListTracesRequest) returns (ListTracesResponse) {
3847
option (google.api.http) = {
3948
get: "/v1/projects/{project_id}/traces"
4049
};
50+
option (google.api.method_signature) = "project_id";
4151
}
4252

4353
// Gets a single trace by its ID.
4454
rpc GetTrace(GetTraceRequest) returns (Trace) {
4555
option (google.api.http) = {
4656
get: "/v1/projects/{project_id}/traces/{trace_id}"
4757
};
58+
option (google.api.method_signature) = "project_id,trace_id";
4859
}
4960

5061
// Sends new traces to Stackdriver Trace or updates existing traces. If the ID
@@ -57,6 +68,7 @@ service TraceService {
5768
patch: "/v1/projects/{project_id}/traces"
5869
body: "traces"
5970
};
71+
option (google.api.method_signature) = "project_id,traces";
6072
}
6173
}
6274

@@ -68,7 +80,8 @@ message Trace {
6880
string project_id = 1;
6981

7082
// Globally unique identifier for the trace. This identifier is a 128-bit
71-
// numeric value formatted as a 32-byte hex string.
83+
// numeric value formatted as a 32-byte hex string. For example,
84+
// `382d4f4c6b7bb2f4a972559d9085001d`.
7285
string trace_id = 2;
7386

7487
// Collection of spans in the trace.
@@ -103,7 +116,7 @@ message TraceSpan {
103116
}
104117

105118
// Identifier for the span. Must be a 64-bit integer other than 0 and
106-
// unique within a trace.
119+
// unique within a trace. For example, `2205310701640571284`.
107120
fixed64 span_id = 1;
108121

109122
// Distinguishes between spans generated in a particular context. For example,
@@ -113,7 +126,7 @@ message TraceSpan {
113126

114127
// Name of the span. Must be less than 128 bytes. The span name is sanitized
115128
// and displayed in the Stackdriver Trace tool in the
116-
// {% dynamic print site_values.console_name %}.
129+
// Google Cloud Platform Console.
117130
// The name may be a method name or some other per-call site name.
118131
// For the same executable and the same call point, a best practice is
119132
// to use a consistent name, which makes it easier to correlate
@@ -126,8 +139,8 @@ message TraceSpan {
126139
// End time of the span in nanoseconds from the UNIX epoch.
127140
google.protobuf.Timestamp end_time = 5;
128141

129-
// ID of the parent span, if any. Optional.
130-
fixed64 parent_span_id = 6;
142+
// Optional. ID of the parent span, if any.
143+
fixed64 parent_span_id = 6 [(google.api.field_behavior) = OPTIONAL];
131144

132145
// Collection of labels associated with the span. Label keys must be less than
133146
// 128 bytes. Label values must be less than 16 kilobytes (10MB for
@@ -189,20 +202,20 @@ message ListTracesRequest {
189202
COMPLETE = 3;
190203
}
191204

192-
// ID of the Cloud project where the trace data is stored.
193-
string project_id = 1;
205+
// Required. ID of the Cloud project where the trace data is stored.
206+
string project_id = 1 [(google.api.field_behavior) = REQUIRED];
194207

195-
// Type of data returned for traces in the list. Optional. Default is
208+
// Optional. Type of data returned for traces in the list. Default is
196209
// `MINIMAL`.
197-
ViewType view = 2;
210+
ViewType view = 2 [(google.api.field_behavior) = OPTIONAL];
198211

199-
// Maximum number of traces to return. If not specified or <= 0, the
212+
// Optional. Maximum number of traces to return. If not specified or <= 0, the
200213
// implementation selects a reasonable value. The implementation may
201-
// return fewer traces than the requested page size. Optional.
202-
int32 page_size = 3;
214+
// return fewer traces than the requested page size.
215+
int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL];
203216

204217
// Token identifying the page of results to return. If provided, use the
205-
// value of the `next_page_token` field from a previous request. Optional.
218+
// value of the `next_page_token` field from a previous request.
206219
string page_token = 4;
207220

208221
// Start of the time interval (inclusive) during which the trace data was
@@ -213,7 +226,7 @@ message ListTracesRequest {
213226
// collected from the application.
214227
google.protobuf.Timestamp end_time = 6;
215228

216-
// An optional filter against labels for the request.
229+
// Optional. A filter against labels for the request.
217230
//
218231
// By default, searches use prefix matching. To specify exact match, prepend
219232
// a plus symbol (`+`) to the search term.
@@ -243,9 +256,9 @@ message ListTracesRequest {
243256
// specified.
244257
// * `method:VALUE`: Equivalent to `/http/method:VALUE`.
245258
// * `url:VALUE`: Equivalent to `/http/url:VALUE`.
246-
string filter = 7;
259+
string filter = 7 [(google.api.field_behavior) = OPTIONAL];
247260

248-
// Field used to sort the returned traces. Optional.
261+
// Optional. Field used to sort the returned traces.
249262
// Can be one of the following:
250263
//
251264
// * `trace_id`
@@ -258,12 +271,12 @@ message ListTracesRequest {
258271
// (for example, `name desc`).
259272
//
260273
// Only one sort field is permitted.
261-
string order_by = 8;
274+
string order_by = 8 [(google.api.field_behavior) = OPTIONAL];
262275
}
263276

264277
// The response message for the `ListTraces` method.
265278
message ListTracesResponse {
266-
// List of trace records returned.
279+
// List of trace records as specified by the view parameter.
267280
repeated Trace traces = 1;
268281

269282
// If defined, indicates that there are more traces that match the request
@@ -274,18 +287,18 @@ message ListTracesResponse {
274287

275288
// The request message for the `GetTrace` method.
276289
message GetTraceRequest {
277-
// ID of the Cloud project where the trace data is stored.
278-
string project_id = 1;
290+
// Required. ID of the Cloud project where the trace data is stored.
291+
string project_id = 1 [(google.api.field_behavior) = REQUIRED];
279292

280-
// ID of the trace to return.
281-
string trace_id = 2;
293+
// Required. ID of the trace to return.
294+
string trace_id = 2 [(google.api.field_behavior) = REQUIRED];
282295
}
283296

284297
// The request message for the `PatchTraces` method.
285298
message PatchTracesRequest {
286-
// ID of the Cloud project where the trace data is stored.
287-
string project_id = 1;
299+
// Required. ID of the Cloud project where the trace data is stored.
300+
string project_id = 1 [(google.api.field_behavior) = REQUIRED];
288301

289-
// The body of the message.
290-
Traces traces = 2;
302+
// Required. The body of the message.
303+
Traces traces = 2 [(google.api.field_behavior) = REQUIRED];
291304
}

0 commit comments

Comments
 (0)