Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ public Dataset getDatasetSkipExceptionTranslation(
"DatasetService",
"GetDataset",
gcpResourceDestinationId,
bqGetRequest.getUriTemplate(),
options),
span -> {
Dataset dataset = bqGetRequest.execute();
Expand Down Expand Up @@ -243,6 +244,7 @@ public Tuple<String, Iterable<Dataset>> listDatasetsSkipExceptionTranslation(
"DatasetService",
"ListDatasets",
gcpResourceDestinationId,
datasetsListRequest.getUriTemplate(),
options),
span -> {
if (span != null) {
Expand Down Expand Up @@ -301,6 +303,7 @@ public Dataset createSkipExceptionTranslation(Dataset dataset, Map<Option, ?> op
"DatasetService",
"InsertDataset",
gcpResourceDestinationId,
bqCreateRequest.getUriTemplate(),
options),
span -> {
Dataset datasetResponse = bqCreateRequest.execute();
Expand Down Expand Up @@ -354,6 +357,7 @@ public Table createSkipExceptionTranslation(Table table, Map<Option, ?> options)
"TableService",
"InsertTable",
gcpResourceDestinationId,
bqCreateRequest.getUriTemplate(),
options),
span -> {
Table tableResponse = bqCreateRequest.execute();
Expand Down Expand Up @@ -405,6 +409,7 @@ public Routine createSkipExceptionTranslation(Routine routine, Map<Option, ?> op
"RoutineService",
"InsertRoutine",
gcpResourceDestinationId,
bqCreateRequest.getUriTemplate(),
options),
span -> {
Routine routineResponse = bqCreateRequest.execute();
Expand Down Expand Up @@ -456,6 +461,7 @@ public Job createSkipExceptionTranslation(Job job, Map<Option, ?> options) throw
"JobService",
"InsertJob",
gcpResourceDestinationId,
bqCreateRequest.getUriTemplate(),
options),
span -> {
Job jobResponse = bqCreateRequest.execute();
Expand Down Expand Up @@ -504,6 +510,7 @@ public Job createJobForQuerySkipExceptionTranslation(Job job) throws IOException
"JobService",
"InsertJob",
gcpResourceDestinationId,
bqCreateRequest.getUriTemplate(),
null),
span -> {
Job jobResponse = bqCreateRequest.execute();
Expand Down Expand Up @@ -558,6 +565,7 @@ public boolean deleteDatasetSkipExceptionTranslation(
"DatasetService",
"DeleteDataset",
gcpResourceDestinationId,
bqDeleteRequest.getUriTemplate(),
options),
span -> {
bqDeleteRequest.execute();
Expand Down Expand Up @@ -609,6 +617,7 @@ public Dataset patchSkipExceptionTranslation(Dataset dataset, Map<Option, ?> opt
"DatasetService",
"PatchDataset",
gcpResourceDestinationId,
bqPatchRequest.getUriTemplate(),
options),
span -> {
Dataset datasetResponse = bqPatchRequest.execute();
Expand Down Expand Up @@ -664,6 +673,7 @@ public Table patchSkipExceptionTranslation(Table table, Map<Option, ?> options)
"TableService",
"PatchTable",
gcpResourceDestinationId,
bqPatchRequest.getUriTemplate(),
options),
span -> {
Table tableResponse = bqPatchRequest.execute();
Expand Down Expand Up @@ -721,6 +731,7 @@ public Table getTableSkipExceptionTranslation(
"TableService",
"GetTable",
gcpResourceDestinationId,
bqGetRequest.getUriTemplate(),
options),
span -> {
Table tableResponse = bqGetRequest.execute();
Expand Down Expand Up @@ -779,6 +790,7 @@ public Tuple<String, Iterable<Table>> listTablesSkipExceptionTranslation(
"TableService",
"ListTables",
gcpResourceDestinationId,
tableListRequest.getUriTemplate(),
options),
span -> {
if (span != null) {
Expand Down Expand Up @@ -853,6 +865,7 @@ public boolean deleteTableSkipExceptionTranslation(
"TableService",
"DeleteTable",
gcpResourceDestinationId,
bqDeleteRequest.getUriTemplate(),
null),
span -> {
bqDeleteRequest.execute();
Expand Down Expand Up @@ -903,6 +916,7 @@ public Model patchSkipExceptionTranslation(Model model, Map<Option, ?> options)
"ModelService",
"PatchModel",
gcpResourceDestinationId,
bqPatchRequest.getUriTemplate(),
options),
span -> {
Model modelResponse = bqPatchRequest.execute();
Expand Down Expand Up @@ -960,6 +974,7 @@ public Model getModelSkipExceptionTranslation(
"ModelService",
"GetModel",
gcpResourceDestinationId,
bqGetRequest.getUriTemplate(),
options),
span -> {
Model modelResponse = bqGetRequest.execute();
Expand Down Expand Up @@ -1012,6 +1027,7 @@ public Tuple<String, Iterable<Model>> listModelsSkipExceptionTranslation(
"ModelService",
"ListModels",
gcpResourceDestinationId,
modelListRequest.getUriTemplate(),
options),
span -> {
if (span != null) {
Expand Down Expand Up @@ -1070,6 +1086,7 @@ public boolean deleteModelSkipExceptionTranslation(
"ModelService",
"DeleteModel",
gcpResourceDestinationId,
bqDeleteRequest.getUriTemplate(),
null),
span -> {
bqDeleteRequest.execute();
Expand Down Expand Up @@ -1122,6 +1139,7 @@ public Routine updateSkipExceptionTranslation(Routine routine, Map<Option, ?> op
"RoutineService",
"UpdateRoutine",
gcpResourceDestinationId,
bqUpdateRequest.getUriTemplate(),
options),
span -> {
Routine routineResponse = bqUpdateRequest.execute();
Expand Down Expand Up @@ -1179,6 +1197,7 @@ public Routine getRoutineSkipExceptionTranslation(
"RoutineService",
"GetRoutine",
gcpResourceDestinationId,
bqGetRequest.getUriTemplate(),
options),
span -> {
Routine routineResponse = bqGetRequest.execute();
Expand Down Expand Up @@ -1231,6 +1250,7 @@ public Tuple<String, Iterable<Routine>> listRoutinesSkipExceptionTranslation(
"RoutineService",
"ListRoutines",
gcpResourceDestinationId,
routineListRequest.getUriTemplate(),
options),
span -> {
if (span != null) {
Expand Down Expand Up @@ -1288,6 +1308,7 @@ public boolean deleteRoutineSkipExceptionTranslation(
"RoutineService",
"DeleteRoutine",
gcpResourceDestinationId,
bqDeleteRequest.getUriTemplate(),
null),
span -> {
bqDeleteRequest.execute();
Expand Down Expand Up @@ -1336,6 +1357,7 @@ public TableDataInsertAllResponse insertAllSkipExceptionTranslation(
"TableDataService",
"InsertAll",
gcpResourceDestinationId,
insertAllRequest.getUriTemplate(),
null),
span -> insertAllRequest.execute());
}
Expand Down Expand Up @@ -1387,6 +1409,7 @@ public TableDataList listTableDataSkipExceptionTranslation(
"TableDataService",
"List",
gcpResourceDestinationId,
bqListRequest.getUriTemplate(),
options),
span -> {
if (span != null) {
Expand Down Expand Up @@ -1448,6 +1471,7 @@ public TableDataList listTableDataWithRowLimitSkipExceptionTranslation(
"TableDataService",
"List",
gcpResourceDestinationId,
bqListRequest.getUriTemplate(),
null),
span -> {
if (span != null) {
Expand Down Expand Up @@ -1500,6 +1524,7 @@ public Job getJobSkipExceptionTranslation(
"JobService",
"GetJob",
gcpResourceDestinationId,
bqGetRequest.getUriTemplate(),
options),
span -> {
Job jobResponse = bqGetRequest.execute();
Expand Down Expand Up @@ -1550,6 +1575,7 @@ public Job getQueryJobSkipExceptionTranslation(String projectId, String jobId, S
"JobService",
"GetJob",
gcpResourceDestinationId,
bqGetRequest.getUriTemplate(),
null),
span -> {
Job jobResponse = bqGetRequest.execute();
Expand Down Expand Up @@ -1612,6 +1638,7 @@ public Tuple<String, Iterable<Job>> listJobsSkipExceptionTranslation(
"JobService",
"ListJobs",
gcpResourceDestinationId,
listJobsRequest.getUriTemplate(),
options),
span -> {
if (span != null) {
Expand Down Expand Up @@ -1689,6 +1716,7 @@ public boolean cancelSkipExceptionTranslation(String projectId, String jobId, St
"JobService",
"CancelJob",
gcpResourceDestinationId,
bqCancelRequest.getUriTemplate(),
null),
span -> {
bqCancelRequest.execute();
Expand Down Expand Up @@ -1730,6 +1758,7 @@ public boolean deleteJobSkipExceptionTranslation(
"JobService",
"DeleteJob",
gcpResourceDestinationId,
bqDeleteRequest.getUriTemplate(),
null),
span -> {
bqDeleteRequest.execute();
Expand Down Expand Up @@ -1783,6 +1812,7 @@ public GetQueryResultsResponse getQueryResultsSkipExceptionTranslation(
"JobService",
"GetQueryResults",
gcpResourceDestinationId,
queryRequest.getUriTemplate(),
options),
span -> {
if (span != null) {
Expand Down Expand Up @@ -1835,6 +1865,7 @@ public GetQueryResultsResponse getQueryResultsWithRowLimitSkipExceptionTranslati
"JobService",
"GetQueryResults",
gcpResourceDestinationId,
queryRequest.getUriTemplate(),
null),
span -> {
if (span != null) {
Expand Down Expand Up @@ -1875,6 +1906,7 @@ public QueryResponse queryRpcSkipExceptionTranslation(String projectId, QueryReq
"JobService",
"Query",
gcpResourceDestinationId,
queryRequest.getUriTemplate(),
null),
span -> {
return queryRequest.execute();
Expand Down Expand Up @@ -2006,6 +2038,7 @@ public Policy getIamPolicySkipExceptionTranslation(String resourceId, Map<Option
"TableService",
"GetIamPolicy",
gcpResourceDestinationId,
bqGetRequest.getUriTemplate(),
options),
span -> {
return bqGetRequest.execute();
Expand Down Expand Up @@ -2042,6 +2075,7 @@ public Policy setIamPolicySkipExceptionTranslation(
"TableService",
"SetIamPolicy",
gcpResourceDestinationId,
bqSetRequest.getUriTemplate(),
options),
span -> {
return bqSetRequest.execute();
Expand Down Expand Up @@ -2079,6 +2113,7 @@ public TestIamPermissionsResponse testIamPermissionsSkipExceptionTranslation(
"TableService",
"TestIamPermissions",
gcpResourceDestinationId,
bqTestRequest.getUriTemplate(),
options),
span -> {
return bqTestRequest.execute();
Expand All @@ -2095,6 +2130,7 @@ private Span createRpcTracingSpan(
String service,
String method,
String gcpResourceDestinationId,
String urlTemplate,
Map<Option, ?> options) {
if (!this.options.isOpenTelemetryTracingEnabled()
|| this.options.getOpenTelemetryTracer() == null) {
Expand All @@ -2108,9 +2144,13 @@ private Span createRpcTracingSpan(
.setSpanKind(SpanKind.CLIENT)
.setAttribute("bq.rpc.service", service)
.setAttribute("bq.rpc.method", method)
.setAttribute("bq.rpc.system", "http")
.setAttribute(
BigQueryTelemetryTracer.GCP_RESOURCE_DESTINATION_ID, gcpResourceDestinationId);
.setAttribute("bq.rpc.system", "http");
if (isHttpTracingEnabled()) {
builder
.setAttribute(
BigQueryTelemetryTracer.GCP_RESOURCE_DESTINATION_ID, gcpResourceDestinationId)
.setAttribute(BigQueryTelemetryTracer.URL_TEMPLATE, urlTemplate);
}

if (options != null) {
builder.setAllAttributes(otelAttributesFromOptions(options));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ private BigQueryTelemetryTracer() {}
public static final AttributeKey<String> SERVER_ADDRESS =
AttributeKey.stringKey("server.address");
public static final AttributeKey<Long> SERVER_PORT = AttributeKey.longKey("server.port");
public static final AttributeKey<String> URL_TEMPLATE = AttributeKey.stringKey("url.template");

public static void addCommonAttributeToSpan(Span span) {
span.setAttribute(GCP_CLIENT_SERVICE, BQ_GCP_CLIENT_SERVICE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public class HttpTracingRequestInitializer implements HttpRequestInitializer {
public static final AttributeKey<String> HTTP_REQUEST_METHOD =
AttributeKey.stringKey("http.request.method");
public static final AttributeKey<String> URL_FULL = AttributeKey.stringKey("url.full");
public static final AttributeKey<String> URL_TEMPLATE = AttributeKey.stringKey("url.template");
public static final AttributeKey<String> URL_DOMAIN = AttributeKey.stringKey("url.domain");
public static final AttributeKey<Long> HTTP_RESPONSE_STATUS_CODE =
AttributeKey.longKey("http.response.status_code");
Expand Down
Loading
Loading