From a743139f8372ae968c5082da9c501461ff6630ec Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Fri, 3 Jan 2025 16:31:49 +0530 Subject: [PATCH] remove final telemetry bits --- libs/template/config.go | 21 ------------------- libs/template/config_test.go | 39 ------------------------------------ 2 files changed, 60 deletions(-) diff --git a/libs/template/config.go b/libs/template/config.go index 34eee065c..8e7695b91 100644 --- a/libs/template/config.go +++ b/libs/template/config.go @@ -5,7 +5,6 @@ import ( "errors" "fmt" "io/fs" - "slices" "github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/jsonschema" @@ -274,23 +273,3 @@ func (c *config) validate() error { } return nil } - -// Return enum values selected by the user during template initialization. These -// values are safe to send over in telemetry events due to their limited cardinality. -func (c *config) enumValues() map[string]string { - res := map[string]string{} - for k, p := range c.schema.Properties { - if p.Type != jsonschema.StringType { - continue - } - if p.Enum == nil { - continue - } - v := c.values[k] - - if slices.Contains(p.Enum, v) { - res[k] = v.(string) - } - } - return res -} diff --git a/libs/template/config_test.go b/libs/template/config_test.go index 3f971a862..515a0b9f5 100644 --- a/libs/template/config_test.go +++ b/libs/template/config_test.go @@ -564,42 +564,3 @@ func TestPromptIsSkippedAnyOf(t *testing.T) { assert.True(t, skip) assert.Equal(t, "hello-world", c.values["xyz"]) } - -func TestConfigEnumValues(t *testing.T) { - c := &config{ - schema: &jsonschema.Schema{ - Properties: map[string]*jsonschema.Schema{ - "a": { - Type: jsonschema.StringType, - }, - "b": { - Type: jsonschema.BooleanType, - }, - "c": { - Type: jsonschema.StringType, - Enum: []any{"v1", "v2"}, - }, - "d": { - Type: jsonschema.StringType, - Enum: []any{"v3", "v4"}, - }, - "e": { - Type: jsonschema.StringType, - Enum: []any{"v5", "v6"}, - }, - }, - }, - values: map[string]any{ - "a": "w1", - "b": false, - "c": "v1", - "d": "v3", - "e": "v7", - }, - } - - assert.Equal(t, map[string]string{ - "c": "v1", - "d": "v3", - }, c.enumValues()) -}