Skip to content

Commit 6484f94

Browse files
committed
Shorten the comments and changelog added by this change
Several comments restated the code or carried the reasoning behind an earlier revision, which belongs in the commit messages. Each one now states the API behaviour or decision the code depends on and stops there. The changelog entry explained the mechanism at length; it now names the fix and keeps the regression for unsupported endpoint types.
1 parent 200afa8 commit 6484f94

8 files changed

Lines changed: 17 additions & 20 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
direct: Fixed `telemetry_config` on model serving endpoints never converging, and edits to it being planned and then silently dropped. The backend creates a telemetry profile from `table_names` and returns only the resulting `telemetry_profile_id`, so every `bundle plan` after a deploy reported an update, and the deploy that followed made no telemetry call at all. Wiring the telemetry API also means a `telemetry_config` on an endpoint that serves nothing or only external models now fails on a deploy that applies the field, with the error that API returns (create still drops the field) ([#6106](https://github.com/databricks/cli/pull/6106)).
1+
direct: Fixed model serving `telemetry_config` drift and applied planned telemetry updates. Unsupported endpoint types now fail when telemetry is applied; create may still succeed because it drops the field ([#6106](https://github.com/databricks/cli/pull/6106)).

acceptance/bundle/invariant/migrate/test.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,5 @@ EnvMatrixExclude.no_pydabs_1000_tasks = ["INPUT_CONFIG=job_pydabs_1000_tasks.yml
3838
# volume schema_name ("inconsistent final plan"). Covered by no_drift on direct.
3939
EnvMatrixExclude.no_volume_uppercase = ["INPUT_CONFIG=volume_uppercase_name.yml.tmpl"]
4040

41-
# The TF provider types sampling_fraction as an integer, so the terraform seed
42-
# deploy truncates 0.5 to 0 and the plan never converges. Covered by no_drift.
41+
# Terraform types sampling_fraction as an integer and truncates 0.5; covered by no_drift.
4342
EnvMatrixExclude.no_model_serving_endpoint_telemetry = ["INPUT_CONFIG=model_serving_endpoint_telemetry.yml.tmpl"]

acceptance/bundle/invariant/test.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ no_external_volume_on_cloud = ["CONFIG_Cloud=true", "INPUT_CONFIG=volume_externa
117117
# it here to keep the cloud invariant runs from timing out. Still exercised locally.
118118
no_vector_search_index_on_cloud = ["CONFIG_Cloud=true", "INPUT_CONFIG=vector_search_index.yml.tmpl"]
119119

120-
# Unlike model_serving_endpoint.yml.tmpl, this config serves a real model, which
121-
# telemetry_config requires and the cloud test environment does not provision.
120+
# Telemetry requires a real model, which cloud invariant tests do not provision.
122121
no_model_serving_endpoint_telemetry_on_cloud = ["CONFIG_Cloud=true", "INPUT_CONFIG=model_serving_endpoint_telemetry.yml.tmpl"]
123122

124123
# Fake SQL endpoint for local tests
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
RecordRequests = true
22

3-
# Direct engine only, where the classification lives.
3+
# Telemetry classification is direct-engine-specific.
44
EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
RecordRequests = true
22

3-
# Direct engine only, where the DoUpdate wait lives.
3+
# Telemetry updates are direct-engine-specific.
44
EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"]

bundle/direct/dresources/model_serving_endpoint.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ func (r *ResourceModelServingEndpoint) updateNotifications(ctx context.Context,
247247
return nil
248248
}
249249

250-
// updateTelemetryConfig applies telemetry_config; a nil config removes it.
250+
// updateTelemetryConfig removes telemetry when telemetryConfig is nil.
251251
func (r *ResourceModelServingEndpoint) updateTelemetryConfig(ctx context.Context, id string, telemetryConfig *serving.TelemetryConfig) error {
252252
req := serving.PatchTelemetryConfigRequest{
253253
Name: id,
@@ -358,8 +358,7 @@ func (r *ResourceModelServingEndpoint) DoUpdate(ctx context.Context, id string,
358358
}
359359

360360
if entry.Changes.HasChange(pathTelemetryConfig) {
361-
// The telemetry API rejects an endpoint still applying an update, and
362-
// WaitAfterUpdate runs too late to order the earlier calls with this patch.
361+
// The telemetry API rejects endpoints with an update in progress.
363362
_, err = r.waitForEndpointReady(ctx, id)
364363
if err != nil {
365364
return nil, err

bundle/direct/dresources/resources.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ resources:
285285
# Accepted on write but not returned by GET.
286286
- field: config.served_entities[*].burst_scaling_enabled
287287
reason: input_only
288-
# Consumed to build a profile and never returned; inference_table_config round-trips so it is not listed.
288+
# table_names creates a profile and is not returned; inference_table_config round-trips.
289289
- field: telemetry_config.table_names
290290
reason: input_only
291291
# Write-only secrets: the backend stores them and returns the reference field, not the plaintext.
@@ -319,7 +319,7 @@ resources:
319319
- field: rate_limits
320320
reason: not_implemented
321321
backend_defaults:
322-
# Subtree, not only telemetry_profile_id: a remote-only config is one change on the parent path.
322+
# Remote-only telemetry is reported as a change at this parent path.
323323
- field: telemetry_config
324324

325325
# https://github.com/databricks/terraform-provider-databricks/blob/4eba541abe1a9f50993ea7b9dd83874207e224a1/serving/resource_model_serving.go#L383

libs/testserver/serving_endpoints.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ func servedEntitiesInputToOutput(input []serving.ServedEntityInput) []serving.Se
3535
return entities
3636
}
3737

38-
// applyTelemetryConfig mirrors the backend: table_names is consumed and not echoed;
39-
// naming neither table_names nor telemetry_profile_id discards the config.
38+
// applyTelemetryConfig consumes table_names and discards configs that identify no profile.
4039
func applyTelemetryConfig(previous, config *serving.TelemetryConfig) *serving.TelemetryConfig {
4140
if config == nil {
4241
return nil
@@ -62,8 +61,7 @@ func applyTelemetryConfig(previous, config *serving.TelemetryConfig) *serving.Te
6261
return &applied
6362
}
6463

65-
// telemetrySupported is true only for custom served models; otherwise it returns the
66-
// endpoint type the backend names when rejecting (NO_CONFIG / EXTERNAL_MODELS).
64+
// telemetrySupported returns the unsupported endpoint type when telemetry cannot be applied.
6765
func telemetrySupported(endpoint serving.ServingEndpointDetailed) (string, bool) {
6866
if endpoint.Config == nil || len(endpoint.Config.ServedEntities) == 0 {
6967
return "NO_CONFIG", false
@@ -276,7 +274,7 @@ func (s *FakeWorkspace) ServingEndpointCreate(req Request) Response {
276274
ForceSendFields: append(createReq.ForceSendFields, "PermissionLevel", "RouteOptimized", "Description"),
277275
}
278276

279-
// Unlike the telemetry API, create drops telemetry it cannot apply instead of failing.
277+
// Create drops unsupported telemetry, while the telemetry API rejects it.
280278
if _, ok := telemetrySupported(endpoint); !ok {
281279
endpoint.TelemetryConfig = nil
282280
}
@@ -288,7 +286,7 @@ func (s *FakeWorkspace) ServingEndpointCreate(req Request) Response {
288286
}
289287
}
290288

291-
// ServingEndpointGet reports an in-progress update once, then settles so a poller converges.
289+
// ServingEndpointGet reports an in-progress update once before settling it.
292290
func (s *FakeWorkspace) ServingEndpointGet(name string) Response {
293291
defer s.LockUnlock()()
294292

@@ -313,6 +311,7 @@ func (s *FakeWorkspace) ServingEndpointGet(name string) Response {
313311
return Response{Body: endpoint}
314312
}
315313

314+
// endpointUpdating reports whether a config update is in progress.
316315
func endpointUpdating(endpoint serving.ServingEndpointDetailed) bool {
317316
return endpoint.State != nil && endpoint.State.ConfigUpdate == serving.EndpointStateConfigUpdateInProgress
318317
}
@@ -364,7 +363,7 @@ func (s *FakeWorkspace) ServingEndpointUpdate(req Request, name string) Response
364363

365364
endpoint.Config = config
366365
endpoint.LastUpdatedTimestamp = nowMilli()
367-
// Leave IN_PROGRESS until the next GET settles it; a same-pass telemetry PATCH must see that.
366+
// Keep the update in progress until GET observes it.
368367
endpoint.State = &serving.EndpointState{
369368
ConfigUpdate: serving.EndpointStateConfigUpdateInProgress,
370369
Ready: serving.EndpointStateReadyNotReady,
@@ -446,6 +445,7 @@ func (s *FakeWorkspace) ServingEndpointUpdateNotifications(req Request, name str
446445
}
447446
}
448447

448+
// ServingEndpointPatchTelemetryConfig applies telemetry after validating endpoint state.
449449
func (s *FakeWorkspace) ServingEndpointPatchTelemetryConfig(req Request, name string) Response {
450450
defer s.LockUnlock()()
451451

@@ -476,7 +476,7 @@ func (s *FakeWorkspace) ServingEndpointPatchTelemetryConfig(req Request, name st
476476
}
477477
}
478478

479-
// The telemetry API refuses to run while an earlier update is still applying.
479+
// The telemetry API returns 409 while another update is in progress.
480480
if endpointUpdating(endpoint) {
481481
return Response{
482482
StatusCode: 409,

0 commit comments

Comments
 (0)