mirror of https://github.com/databricks/cli.git
remove frontend wrapper
This commit is contained in:
parent
9fb2c66c4a
commit
4fc8c37376
|
@ -33,23 +33,19 @@ func (wrapper *apiClientWrapper) Do(ctx context.Context, method, path string,
|
|||
}
|
||||
|
||||
func TestTelemetryLogger(t *testing.T) {
|
||||
events := []telemetry.FrontendLogEntry{
|
||||
events := []telemetry.DatabricksCliLog{
|
||||
{
|
||||
DatabricksCliLog: telemetry.DatabricksCliLog{
|
||||
CliTestEvent: &events.CliTestEvent{
|
||||
Name: events.DummyCliEnumValue1,
|
||||
},
|
||||
CliTestEvent: &events.CliTestEvent{
|
||||
Name: events.DummyCliEnumValue1,
|
||||
},
|
||||
},
|
||||
{
|
||||
DatabricksCliLog: telemetry.DatabricksCliLog{
|
||||
BundleInitEvent: &events.BundleInitEvent{
|
||||
Uuid: uuid.New().String(),
|
||||
TemplateName: "abc",
|
||||
TemplateEnumArgs: map[string]string{
|
||||
"a": "b",
|
||||
"c": "d",
|
||||
},
|
||||
BundleInitEvent: &events.BundleInitEvent{
|
||||
Uuid: uuid.New().String(),
|
||||
TemplateName: "abc",
|
||||
TemplateEnumArgs: map[string]string{
|
||||
"a": "b",
|
||||
"c": "d",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -18,14 +18,16 @@ type DatabricksApiClient interface {
|
|||
visitors ...func(*http.Request) error) error
|
||||
}
|
||||
|
||||
func Log(ctx context.Context, event FrontendLogEntry) error {
|
||||
func Log(ctx context.Context, event DatabricksCliLog) error {
|
||||
l := fromContext(ctx)
|
||||
|
||||
FrontendLog := FrontendLog{
|
||||
// The telemetry endpoint deduplicates logs based on the FrontendLogEventID.
|
||||
// This it's important to generate a unique ID for each log event.
|
||||
FrontendLogEventID: uuid.New().String(),
|
||||
Entry: event,
|
||||
Entry: FrontendLogEntry{
|
||||
DatabricksCliLog: event,
|
||||
},
|
||||
}
|
||||
|
||||
protoLog, err := json.Marshal(FrontendLog)
|
||||
|
|
|
@ -68,9 +68,9 @@ func TestTelemetryLoggerFlushesEvents(t *testing.T) {
|
|||
ctx := ContextWithLogger(context.Background())
|
||||
|
||||
for _, v := range []events.DummyCliEnum{events.DummyCliEnumValue1, events.DummyCliEnumValue2, events.DummyCliEnumValue2, events.DummyCliEnumValue3} {
|
||||
err := Log(ctx, FrontendLogEntry{DatabricksCliLog: DatabricksCliLog{
|
||||
err := Log(ctx, DatabricksCliLog{
|
||||
CliTestEvent: &events.CliTestEvent{Name: v},
|
||||
}})
|
||||
})
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
|
@ -102,9 +102,9 @@ func TestTelemetryLoggerFlushExitsOnTimeout(t *testing.T) {
|
|||
ctx := ContextWithLogger(context.Background())
|
||||
|
||||
for _, v := range []events.DummyCliEnum{events.DummyCliEnumValue1, events.DummyCliEnumValue2, events.DummyCliEnumValue2, events.DummyCliEnumValue3} {
|
||||
err := Log(ctx, FrontendLogEntry{DatabricksCliLog: DatabricksCliLog{
|
||||
err := Log(ctx, DatabricksCliLog{
|
||||
CliTestEvent: &events.CliTestEvent{Name: v},
|
||||
}})
|
||||
})
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
|
|
|
@ -124,9 +124,7 @@ func (t *Template) logTelemetry(ctx context.Context) error {
|
|||
},
|
||||
}
|
||||
|
||||
return telemetry.Log(ctx, telemetry.FrontendLogEntry{
|
||||
DatabricksCliLog: event,
|
||||
})
|
||||
return telemetry.Log(ctx, event)
|
||||
}
|
||||
|
||||
// This function materializes the input templates as a project, using user defined
|
||||
|
|
Loading…
Reference in New Issue