|
44 | 44 | import com.google.cloud.bigquery.exception.BigQueryJdbcException; |
45 | 45 | import io.opentelemetry.api.trace.Span; |
46 | 46 | import io.opentelemetry.api.trace.SpanContext; |
| 47 | +import io.opentelemetry.api.trace.StatusCode; |
47 | 48 | import io.opentelemetry.api.trace.Tracer; |
48 | 49 | import io.opentelemetry.context.Context; |
49 | 50 | import io.opentelemetry.context.Scope; |
@@ -1744,6 +1745,7 @@ public ResultSet getTables( |
1744 | 1745 | Span backgroundSpan = |
1745 | 1746 | tracer |
1746 | 1747 | .spanBuilder("BigQueryDatabaseMetaData.getTables.background") |
| 1748 | + .setNoParent() |
1747 | 1749 | .addLink(parentSpanContext) |
1748 | 1750 | .startSpan(); |
1749 | 1751 |
|
@@ -1900,6 +1902,7 @@ public ResultSet getTables( |
1900 | 1902 | return resultSet; |
1901 | 1903 | } catch (Exception e) { |
1902 | 1904 | span.recordException(e); |
| 1905 | + span.setStatus(StatusCode.ERROR, e.getMessage()); |
1903 | 1906 | throw e; |
1904 | 1907 | } finally { |
1905 | 1908 | span.end(); |
@@ -2045,6 +2048,7 @@ public ResultSet getCatalogs() { |
2045 | 2048 | catalogsSchema, catalogRows.size(), queue, null, new Thread[0]); |
2046 | 2049 | } catch (Exception e) { |
2047 | 2050 | span.recordException(e); |
| 2051 | + span.setStatus(StatusCode.ERROR, e.getMessage()); |
2048 | 2052 | throw e; |
2049 | 2053 | } finally { |
2050 | 2054 | span.end(); |
@@ -2145,6 +2149,7 @@ public ResultSet getColumns( |
2145 | 2149 | Span backgroundSpan = |
2146 | 2150 | tracer |
2147 | 2151 | .spanBuilder("BigQueryDatabaseMetaData.getColumns.background") |
| 2152 | + .setNoParent() |
2148 | 2153 | .addLink(parentSpanContext) |
2149 | 2154 | .startSpan(); |
2150 | 2155 |
|
@@ -2258,6 +2263,7 @@ public ResultSet getColumns( |
2258 | 2263 | return resultSet; |
2259 | 2264 | } catch (Exception e) { |
2260 | 2265 | span.recordException(e); |
| 2266 | + span.setStatus(StatusCode.ERROR, e.getMessage()); |
2261 | 2267 | throw e; |
2262 | 2268 | } finally { |
2263 | 2269 | span.end(); |
@@ -3707,6 +3713,7 @@ public ResultSet getSchemas(String catalog, String schemaPattern) { |
3707 | 3713 | Span backgroundSpan = |
3708 | 3714 | tracer |
3709 | 3715 | .spanBuilder("BigQueryDatabaseMetaData.getSchemas.background") |
| 3716 | + .setNoParent() |
3710 | 3717 | .addLink(parentSpanContext) |
3711 | 3718 | .startSpan(); |
3712 | 3719 |
|
@@ -3799,6 +3806,7 @@ public ResultSet getSchemas(String catalog, String schemaPattern) { |
3799 | 3806 | return resultSet; |
3800 | 3807 | } catch (Exception e) { |
3801 | 3808 | span.recordException(e); |
| 3809 | + span.setStatus(StatusCode.ERROR, e.getMessage()); |
3802 | 3810 | throw e; |
3803 | 3811 | } finally { |
3804 | 3812 | span.end(); |
|
0 commit comments