@@ -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+
1820type 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+
2427type contextKey int
2528
29+ //nolint:unused // Will be used in Phase 8+
2630const 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+
3743func 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+
4250func 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+
5161func (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+
6779func (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+
101115func (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+
113129func (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+
134152func (i * Interceptor ) completeStatement (ctx context.Context , statementID string , failed bool ) {
135153 if ! i .enabled {
136154 return
0 commit comments