Skip to content

Commit 03c0d7c

Browse files
committed
feat(bigquery-jdbc): add telemetry proto schema definition
1 parent c5e4835 commit 03c0d7c

1 file changed

Lines changed: 162 additions & 0 deletions

File tree

  • java-bigquery-jdbc/src/main/proto/google/cloud/bigquery/jdbc/telemetry/v1
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
// Copyright 2026 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+
15+
syntax = "proto3";
16+
17+
package google.cloud.bigquery.jdbc.telemetry.v1;
18+
19+
import "google/protobuf/timestamp.proto";
20+
21+
option java_multiple_files = true;
22+
option java_package = "com.google.cloud.bigquery.jdbc.telemetry.v1";
23+
option java_outer_classname = "TelemetryProto";
24+
25+
// Aggregated client-side telemetry payload sent to Clearcut analytics backend.
26+
message TelemetryPayload {
27+
DriverEnvironment driver_environment = 1;
28+
google.protobuf.Timestamp timestamp = 2;
29+
repeated ConnectionAttempt connection_attempts = 3;
30+
repeated StatementExecution statement_executions = 4;
31+
repeated ErrorMetric errors = 5;
32+
repeated FeatureUsage feature_usages = 6;
33+
}
34+
35+
// Client runtime and environment attributes.
36+
message DriverEnvironment {
37+
enum OsType {
38+
OS_TYPE_UNSPECIFIED = 0;
39+
OS_TYPE_LINUX = 1;
40+
OS_TYPE_WINDOWS = 2;
41+
OS_TYPE_MACOS = 3;
42+
OS_TYPE_SOLARIS = 4;
43+
OS_TYPE_FREEBSD = 5;
44+
OS_TYPE_OPENBSD = 6;
45+
OS_TYPE_NETBSD = 7;
46+
OS_TYPE_AIX = 8;
47+
OS_TYPE_UNKNOWN = 9;
48+
}
49+
string driver_name = 1;
50+
string driver_version = 2;
51+
string client_language = 3;
52+
string client_language_version = 4;
53+
OsType os_type = 5;
54+
string os_version = 6;
55+
string telemetry_tag = 7;
56+
}
57+
58+
// Execution status enum for connection attempts and statement executions.
59+
enum Status {
60+
STATUS_UNSPECIFIED = 0;
61+
STATUS_SUCCESS = 1;
62+
STATUS_ERROR = 2;
63+
STATUS_CANCELLED = 3;
64+
}
65+
66+
// Authentication types utilized during connection creation.
67+
enum AuthenticationType {
68+
AUTHENTICATION_TYPE_UNSPECIFIED = 0;
69+
AUTHENTICATION_TYPE_SERVICE_ACCOUNT = 1;
70+
AUTHENTICATION_TYPE_USER_AUTHENTICATION = 2;
71+
AUTHENTICATION_TYPE_TOKEN = 3;
72+
AUTHENTICATION_TYPE_APPLICATION_DEFAULT_CREDENTIALS = 4;
73+
AUTHENTICATION_TYPE_EXTERNAL = 5;
74+
AUTHENTICATION_TYPE_CUSTOM = 6;
75+
}
76+
77+
// Aggregated metrics for connection attempts.
78+
message ConnectionAttempt {
79+
Status status = 1;
80+
string error_code = 2;
81+
AuthenticationType auth_type = 3;
82+
int64 count = 4;
83+
}
84+
85+
// High-level classification of statement execution types.
86+
enum StatementType {
87+
STATEMENT_TYPE_UNSPECIFIED = 0;
88+
STATEMENT_TYPE_SELECT = 1;
89+
STATEMENT_TYPE_INSERT = 2;
90+
STATEMENT_TYPE_UPDATE = 3;
91+
STATEMENT_TYPE_DELETE = 4;
92+
STATEMENT_TYPE_MERGE = 5;
93+
STATEMENT_TYPE_CREATE_TABLE = 6;
94+
STATEMENT_TYPE_CREATE_MODEL = 7;
95+
STATEMENT_TYPE_CREATE_VIEW = 8;
96+
STATEMENT_TYPE_DROP_TABLE = 9;
97+
STATEMENT_TYPE_DROP_VIEW = 10;
98+
STATEMENT_TYPE_ALTER_TABLE = 11;
99+
STATEMENT_TYPE_ALTER_VIEW = 12;
100+
STATEMENT_TYPE_SCRIPT = 13;
101+
STATEMENT_TYPE_CALL = 14;
102+
STATEMENT_TYPE_EXPLAIN = 15;
103+
STATEMENT_TYPE_OTHER = 16;
104+
}
105+
106+
// API substrate used during query execution (REST API vs Read API vs Write API vs Jobless Query).
107+
enum QueryApiType {
108+
QUERY_API_TYPE_UNSPECIFIED = 0;
109+
QUERY_API_TYPE_STANDARD_REST_API = 1;
110+
QUERY_API_TYPE_READ_API = 2;
111+
QUERY_API_TYPE_WRITE_API = 3;
112+
QUERY_API_TYPE_JOBLESS_QUERY = 4;
113+
}
114+
115+
// Aggregated execution metrics for statement executions.
116+
message StatementExecution {
117+
StatementType statement_type = 1;
118+
QueryApiType query_api_type = 2;
119+
Status status = 3;
120+
string error_code = 4;
121+
int64 count = 5;
122+
DurationHistogram duration = 6;
123+
}
124+
125+
// Duration histogram distribution for execution latency tracking.
126+
message DurationHistogram {
127+
repeated int64 bucket_counts = 1;
128+
repeated double explicit_bounds = 2;
129+
int64 count = 3;
130+
double sum = 4;
131+
}
132+
133+
// Aggregated error counts grouped by error code, SQL state, and method.
134+
message ErrorMetric {
135+
string error_code = 1;
136+
string error_xdbc_code = 2;
137+
string method_name = 3;
138+
int64 count = 4;
139+
}
140+
141+
// High-level driver runtime features and capabilities tracked for telemetry.
142+
enum DriverFeature {
143+
DRIVER_FEATURE_UNSPECIFIED = 0;
144+
DRIVER_FEATURE_BATCH_OPERATIONS = 1;
145+
DRIVER_FEATURE_PREPARED_STATEMENT = 2;
146+
DRIVER_FEATURE_CALLABLE_STATEMENT = 3;
147+
DRIVER_FEATURE_AUTOCOMMIT_ENABLED = 4;
148+
DRIVER_FEATURE_AUTOCOMMIT_DISABLED = 5;
149+
DRIVER_FEATURE_TRANSACTIONS = 6;
150+
DRIVER_FEATURE_CONNECTION_POOLING = 7;
151+
DRIVER_FEATURE_STATEMENT_CANCEL = 8;
152+
DRIVER_FEATURE_PARAMETER_BINDING = 9;
153+
DRIVER_FEATURE_METADATA_RETRIEVAL = 10;
154+
DRIVER_FEATURE_CUSTOM = 11;
155+
}
156+
157+
// Usage metrics for specific features.
158+
message FeatureUsage {
159+
DriverFeature driver_feature = 1;
160+
string custom_feature_name = 2;
161+
int64 count = 3;
162+
}

0 commit comments

Comments
 (0)