diff --git a/integration/libs/telemetry/telemetry_test.go b/integration/libs/telemetry/telemetry_test.go index d65a7df5c..830b1f0cc 100644 --- a/integration/libs/telemetry/telemetry_test.go +++ b/integration/libs/telemetry/telemetry_test.go @@ -40,20 +40,22 @@ func TestTelemetryLogger(t *testing.T) { }) // Log some events. - telemetry.Log(ctx, telemetry.FrontendLogEntry{ + err := telemetry.Log(ctx, telemetry.FrontendLogEntry{ DatabricksCliLog: telemetry.DatabricksCliLog{ CliTestEvent: telemetry.CliTestEvent{ Name: telemetry.DummyCliEnumValue1, }, }, }) - telemetry.Log(ctx, telemetry.FrontendLogEntry{ + require.NoError(t, err) + err = telemetry.Log(ctx, telemetry.FrontendLogEntry{ DatabricksCliLog: telemetry.DatabricksCliLog{ CliTestEvent: telemetry.CliTestEvent{ Name: telemetry.DummyCliEnumValue2, }, }, }) + require.NoError(t, err) apiClient, err := client.New(w.W.Config) require.NoError(t, err) diff --git a/libs/telemetry/logger.go b/libs/telemetry/logger.go index 35b31f9a7..2c19b4b8e 100644 --- a/libs/telemetry/logger.go +++ b/libs/telemetry/logger.go @@ -54,7 +54,8 @@ var MaxAdditionalWaitTime = 2 * time.Second // batching the logs across multiple API calls. func Flush(ctx context.Context, apiClient DatabricksApiClient) { // Set a maximum time to wait for the telemetry event to flush. - ctx, _ = context.WithTimeout(ctx, MaxAdditionalWaitTime) + ctx, cancel := context.WithTimeout(ctx, MaxAdditionalWaitTime) + defer cancel() l := fromContext(ctx) // We pass the API client as an arg to mock it in unit tests.