Skip to content

Commit dba2eb6

Browse files
committed
Add nolint comments for unused code
Temporarily suppress lint warnings for code that will be used in Phase 8+. These nolint comments will be removed in PR #322 when the code is actually used.
1 parent 0cb2635 commit dba2eb6

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

telemetry/aggregator.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ type metricsAggregator struct {
2323
}
2424

2525
// statementMetrics holds aggregated metrics for a statement.
26+
//
27+
//nolint:unused // Will be used in Phase 8+
2628
type statementMetrics struct {
2729
statementID string
2830
sessionID string
@@ -52,6 +54,8 @@ func newMetricsAggregator(exporter *telemetryExporter, cfg *Config) *metricsAggr
5254
}
5355

5456
// recordMetric records a metric for aggregation.
57+
//
58+
//nolint:unused // Will be used in Phase 8+
5559
func (agg *metricsAggregator) recordMetric(ctx context.Context, metric *telemetryMetric) {
5660
// Swallow all errors
5761
defer func() {
@@ -123,6 +127,8 @@ func (agg *metricsAggregator) recordMetric(ctx context.Context, metric *telemetr
123127
}
124128

125129
// completeStatement marks a statement as complete and emits aggregated metric.
130+
//
131+
//nolint:unused // Will be used in Phase 8+
126132
func (agg *metricsAggregator) completeStatement(ctx context.Context, statementID string, failed bool) {
127133
defer func() {
128134
if r := recover(); r != nil {
@@ -220,10 +226,13 @@ func (agg *metricsAggregator) close(ctx context.Context) error {
220226
}
221227

222228
// simpleError is a simple error implementation for testing.
229+
//
230+
//nolint:unused // Will be used in Phase 8+
223231
type simpleError struct {
224232
msg string
225233
}
226234

235+
//nolint:unused // Will be used in Phase 8+
227236
func (e *simpleError) Error() string {
228237
return e.msg
229238
}

telemetry/errors.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88
// isTerminalError returns true if error is terminal (non-retryable).
99
// Terminal errors indicate user errors or permanent failures that won't
1010
// be resolved by retrying the operation.
11+
//
12+
//nolint:unused // Will be used in Phase 8+
1113
func isTerminalError(err error) bool {
1214
if err == nil {
1315
return false
@@ -43,6 +45,8 @@ func isTerminalError(err error) bool {
4345

4446
// classifyError classifies an error for telemetry purposes.
4547
// Returns a string representation of the error type.
48+
//
49+
//nolint:unused // Will be used in Phase 8+
4650
func classifyError(err error) string {
4751
if err == nil {
4852
return ""
@@ -75,21 +79,28 @@ func classifyError(err error) string {
7579

7680
// isRetryableError returns true if the error is retryable.
7781
// This is the inverse of isTerminalError.
82+
//
83+
//nolint:unused // Will be used in Phase 8+
7884
func isRetryableError(err error) bool {
7985
return !isTerminalError(err)
8086
}
8187

8288
// httpError represents an HTTP error with status code.
89+
//
90+
//nolint:unused // Will be used in Phase 8+
8391
type httpError struct {
8492
statusCode int
8593
message string
8694
}
8795

96+
//nolint:unused // Will be used in Phase 8+
8897
func (e *httpError) Error() string {
8998
return e.message
9099
}
91100

92101
// newHTTPError creates a new HTTP error.
102+
//
103+
//nolint:unused // Will be used in Phase 8+
93104
func newHTTPError(statusCode int, message string) error {
94105
return &httpError{
95106
statusCode: statusCode,
@@ -98,12 +109,16 @@ func newHTTPError(statusCode int, message string) error {
98109
}
99110

100111
// isTerminalHTTPStatus returns true for non-retryable HTTP status codes.
112+
//
113+
//nolint:unused // Will be used in Phase 8+
101114
func isTerminalHTTPStatus(status int) bool {
102115
// 4xx errors (except 429) are terminal
103116
return status >= 400 && status < 500 && status != 429
104117
}
105118

106119
// extractHTTPError extracts HTTP error information if available.
120+
//
121+
//nolint:unused // Will be used in Phase 8+
107122
func extractHTTPError(err error) (*httpError, bool) {
108123
var httpErr *httpError
109124
if errors.As(err, &httpErr) {

telemetry/interceptor.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,18 @@ type Interceptor struct {
1515
}
1616

1717
// metricContext holds metric collection state in context.
18+
//
19+
//nolint:unused // Will be used in Phase 8+
1820
type metricContext struct {
1921
statementID string
2022
startTime time.Time
2123
tags map[string]interface{}
2224
}
2325

26+
//nolint:unused // Will be used in Phase 8+
2427
type contextKey int
2528

29+
//nolint:unused // Will be used in Phase 8+
2630
const metricContextKey contextKey = 0
2731

2832
// newInterceptor creates a new telemetry interceptor.
@@ -34,11 +38,15 @@ func newInterceptor(aggregator *metricsAggregator, enabled bool) *Interceptor {
3438
}
3539

3640
// withMetricContext adds metric context to the context.
41+
//
42+
//nolint:unused // Will be used in Phase 8+
3743
func withMetricContext(ctx context.Context, mc *metricContext) context.Context {
3844
return context.WithValue(ctx, metricContextKey, mc)
3945
}
4046

4147
// getMetricContext retrieves metric context from the context.
48+
//
49+
//nolint:unused // Will be used in Phase 8+
4250
func getMetricContext(ctx context.Context) *metricContext {
4351
if mc, ok := ctx.Value(metricContextKey).(*metricContext); ok {
4452
return mc
@@ -48,6 +56,8 @@ func getMetricContext(ctx context.Context) *metricContext {
4856

4957
// beforeExecute is called before statement execution.
5058
// Returns a new context with metric tracking attached.
59+
//
60+
//nolint:unused // Will be used in Phase 8+
5161
func (i *Interceptor) beforeExecute(ctx context.Context, statementID string) context.Context {
5262
if !i.enabled {
5363
return ctx
@@ -64,6 +74,8 @@ func (i *Interceptor) beforeExecute(ctx context.Context, statementID string) con
6474

6575
// afterExecute is called after statement execution.
6676
// Records the metric with timing and error information.
77+
//
78+
//nolint:unused // Will be used in Phase 8+
6779
func (i *Interceptor) afterExecute(ctx context.Context, err error) {
6880
if !i.enabled {
6981
return
@@ -98,6 +110,8 @@ func (i *Interceptor) afterExecute(ctx context.Context, err error) {
98110
}
99111

100112
// addTag adds a tag to the current metric context.
113+
//
114+
//nolint:unused // Will be used in Phase 8+
101115
func (i *Interceptor) addTag(ctx context.Context, key string, value interface{}) {
102116
if !i.enabled {
103117
return
@@ -110,6 +124,8 @@ func (i *Interceptor) addTag(ctx context.Context, key string, value interface{})
110124
}
111125

112126
// recordConnection records a connection event.
127+
//
128+
//nolint:unused // Will be used in Phase 8+
113129
func (i *Interceptor) recordConnection(ctx context.Context, tags map[string]interface{}) {
114130
if !i.enabled {
115131
return
@@ -131,6 +147,8 @@ func (i *Interceptor) recordConnection(ctx context.Context, tags map[string]inte
131147
}
132148

133149
// completeStatement marks a statement as complete and flushes aggregated metrics.
150+
//
151+
//nolint:unused // Will be used in Phase 8+
134152
func (i *Interceptor) completeStatement(ctx context.Context, statementID string, failed bool) {
135153
if !i.enabled {
136154
return

0 commit comments

Comments
 (0)