Skip to content

Commit 1611b33

Browse files
committed
Fix gofmt formatting in telemetry files
Co-authored-by: samikshya-chand_data
1 parent d6fe18b commit 1611b33

File tree

6 files changed

+42
-43
lines changed

6 files changed

+42
-43
lines changed

telemetry/config.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ type Config struct {
4242
// Note: Telemetry is disabled by default and requires explicit opt-in.
4343
func DefaultConfig() *Config {
4444
return &Config{
45-
Enabled: false, // Disabled by default, requires explicit opt-in
46-
EnableTelemetry: false,
45+
Enabled: false, // Disabled by default, requires explicit opt-in
46+
EnableTelemetry: false,
4747
BatchSize: 100,
4848
FlushInterval: 5 * time.Second,
4949
MaxRetries: 3,
@@ -121,4 +121,3 @@ func isTelemetryEnabled(ctx context.Context, cfg *Config, host string, driverVer
121121

122122
return serverEnabled
123123
}
124-

telemetry/config_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func TestIsTelemetryEnabled_ExplicitOptOut(t *testing.T) {
200200
defer server.Close()
201201

202202
cfg := &Config{
203-
EnableTelemetry: false, // Priority 2: Explicit opt-out
203+
EnableTelemetry: false, // Priority 2: Explicit opt-out
204204
}
205205

206206
ctx := context.Background()
@@ -223,7 +223,7 @@ func TestIsTelemetryEnabled_UserOptInServerEnabled(t *testing.T) {
223223
defer server.Close()
224224

225225
cfg := &Config{
226-
EnableTelemetry: true, // User wants telemetry
226+
EnableTelemetry: true, // User wants telemetry
227227
}
228228

229229
ctx := context.Background()
@@ -251,7 +251,7 @@ func TestIsTelemetryEnabled_UserOptInServerDisabled(t *testing.T) {
251251
defer server.Close()
252252

253253
cfg := &Config{
254-
EnableTelemetry: true, // User wants telemetry
254+
EnableTelemetry: true, // User wants telemetry
255255
}
256256

257257
ctx := context.Background()
@@ -279,7 +279,7 @@ func TestIsTelemetryEnabled_ServerFlagOnly(t *testing.T) {
279279
defer server.Close()
280280

281281
cfg := &Config{
282-
EnableTelemetry: false, // Default: no explicit user preference
282+
EnableTelemetry: false, // Default: no explicit user preference
283283
}
284284

285285
ctx := context.Background()
@@ -321,7 +321,7 @@ func TestIsTelemetryEnabled_ServerError(t *testing.T) {
321321
defer server.Close()
322322

323323
cfg := &Config{
324-
EnableTelemetry: true, // User wants telemetry
324+
EnableTelemetry: true, // User wants telemetry
325325
}
326326

327327
ctx := context.Background()
@@ -343,7 +343,7 @@ func TestIsTelemetryEnabled_ServerError(t *testing.T) {
343343
// TestIsTelemetryEnabled_ServerUnreachable tests unreachable server
344344
func TestIsTelemetryEnabled_ServerUnreachable(t *testing.T) {
345345
cfg := &Config{
346-
EnableTelemetry: true, // User wants telemetry
346+
EnableTelemetry: true, // User wants telemetry
347347
}
348348

349349
ctx := context.Background()

telemetry/exporter.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,23 @@ const (
2020

2121
// telemetryExporter exports metrics to Databricks telemetry service.
2222
type telemetryExporter struct {
23-
host string
24-
driverVersion string
25-
httpClient *http.Client
23+
host string
24+
driverVersion string
25+
httpClient *http.Client
2626
circuitBreaker *circuitBreaker
27-
cfg *Config
27+
cfg *Config
2828
}
2929

3030
// telemetryMetric represents a metric to export.
3131
type telemetryMetric struct {
32-
metricType string
33-
timestamp time.Time
34-
workspaceID string
35-
sessionID string
36-
statementID string
37-
latencyMs int64
38-
errorType string
39-
tags map[string]interface{}
32+
metricType string
33+
timestamp time.Time
34+
workspaceID string
35+
sessionID string
36+
statementID string
37+
latencyMs int64
38+
errorType string
39+
tags map[string]interface{}
4040
}
4141

4242
// telemetryPayload is the JSON structure sent to Databricks.

telemetry/integration_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,10 @@ func TestIntegration_CircuitBreakerOpening(t *testing.T) {
151151
func TestIntegration_OptInPriority_ExplicitOptOut(t *testing.T) {
152152
cfg := &Config{
153153
EnableTelemetry: false, // Priority 1 (client): Explicit opt-out
154-
BatchSize: 100,
155-
FlushInterval: 5 * time.Second,
156-
MaxRetries: 3,
157-
RetryDelay: 100 * time.Millisecond,
154+
BatchSize: 100,
155+
FlushInterval: 5 * time.Second,
156+
MaxRetries: 3,
157+
RetryDelay: 100 * time.Millisecond,
158158
}
159159

160160
httpClient := &http.Client{Timeout: 5 * time.Second}

telemetry/interceptor.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,11 @@ func (i *Interceptor) RecordOperation(ctx context.Context, sessionID string, ope
188188
}()
189189

190190
metric := &telemetryMetric{
191-
metricType: "operation",
192-
timestamp: time.Now(),
193-
sessionID: sessionID,
194-
latencyMs: latencyMs,
195-
tags: map[string]interface{}{"operation_type": operationType},
191+
metricType: "operation",
192+
timestamp: time.Now(),
193+
sessionID: sessionID,
194+
latencyMs: latencyMs,
195+
tags: map[string]interface{}{"operation_type": operationType},
196196
}
197197

198198
i.aggregator.recordMetric(ctx, metric)

telemetry/request.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ type TelemetryRequest struct {
1414

1515
// TelemetryFrontendLog represents a single telemetry log entry.
1616
type TelemetryFrontendLog struct {
17-
WorkspaceID int64 `json:"workspace_id,omitempty"`
18-
FrontendLogEventID string `json:"frontend_log_event_id,omitempty"`
19-
Context *FrontendLogContext `json:"context,omitempty"`
20-
Entry *FrontendLogEntry `json:"entry,omitempty"`
17+
WorkspaceID int64 `json:"workspace_id,omitempty"`
18+
FrontendLogEventID string `json:"frontend_log_event_id,omitempty"`
19+
Context *FrontendLogContext `json:"context,omitempty"`
20+
Entry *FrontendLogEntry `json:"entry,omitempty"`
2121
}
2222

2323
// FrontendLogContext contains the client context.
@@ -72,19 +72,19 @@ type DriverConnectionParameters struct {
7272

7373
// SQLExecutionEvent contains SQL execution details.
7474
type SQLExecutionEvent struct {
75-
ResultFormat string `json:"result_format,omitempty"`
76-
ChunkCount int `json:"chunk_count,omitempty"`
77-
BytesDownloaded int64 `json:"bytes_downloaded,omitempty"`
78-
PollCount int `json:"poll_count,omitempty"`
79-
OperationDetail *OperationDetail `json:"operation_detail,omitempty"`
75+
ResultFormat string `json:"result_format,omitempty"`
76+
ChunkCount int `json:"chunk_count,omitempty"`
77+
BytesDownloaded int64 `json:"bytes_downloaded,omitempty"`
78+
PollCount int `json:"poll_count,omitempty"`
79+
OperationDetail *OperationDetail `json:"operation_detail,omitempty"`
8080
}
8181

8282
// OperationDetail contains operation-specific details.
8383
type OperationDetail struct {
84-
OperationType string `json:"operation_type,omitempty"`
85-
NOperationStatusCalls int64 `json:"n_operation_status_calls,omitempty"`
86-
OperationStatusLatencyMs int64 `json:"operation_status_latency_millis,omitempty"`
87-
IsInternalCall bool `json:"is_internal_call,omitempty"`
84+
OperationType string `json:"operation_type,omitempty"`
85+
NOperationStatusCalls int64 `json:"n_operation_status_calls,omitempty"`
86+
OperationStatusLatencyMs int64 `json:"operation_status_latency_millis,omitempty"`
87+
IsInternalCall bool `json:"is_internal_call,omitempty"`
8888
}
8989

9090
// DriverErrorInfo contains error information.

0 commit comments

Comments
 (0)