Repository navigation
fix(telemetry): preserve unspecified kernel enablement #497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a6c1925
19566aa
c3bc716
4f90fa8
f34be95
3368c0f
51bf6b1
866133e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 80f2aee7d884994d7b0af9a9ea6078872859a9cd | ||
| e5008635d35af1f83a88057c4cf4d97718e31ab4 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,12 +29,19 @@ static inline KernelStatusCode go_kernel_set_max_connections( | |
| } | ||
|
|
||
| static inline KernelStatusCode go_kernel_set_telemetry_config( | ||
| KernelSessionConfig* config, bool enabled, size_t batch_size, | ||
| KernelSessionConfig* config, bool has_enabled, bool enabled, size_t batch_size, | ||
| uint64_t flush_interval_ms, uint32_t max_retries, uint64_t retry_delay_ms, | ||
| uint64_t close_flush_timeout_ms) { | ||
| return kernel_session_config_set_telemetry_config( | ||
| config, enabled, batch_size, flush_interval_ms, max_retries, retry_delay_ms, | ||
| close_flush_timeout_ms); | ||
| KernelTelemetryConfig telemetry_config = { | ||
| .has_enabled = has_enabled, | ||
| .enabled = enabled, | ||
| .batch_size = batch_size, | ||
| .flush_interval_ms = flush_interval_ms, | ||
| .max_retries = max_retries, | ||
| .retry_delay_ms = retry_delay_ms, | ||
| .close_flush_timeout_ms = close_flush_timeout_ms, | ||
| }; | ||
|
jay-xiao446 marked this conversation as resolved.
|
||
| return kernel_session_config_set_telemetry_config_v2(config, &telemetry_config); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Medium — The cgo wrapper now links (Anchored to the nearest changed line — see the description for the exact location.) |
||
| } | ||
|
|
||
| static inline KernelStatusCode go_kernel_set_driver_system_configuration( | ||
|
|
@@ -485,9 +492,14 @@ func (k *KernelBackend) applyTelemetry(cfg *C.KernelSessionConfig) error { | |
| if closeFlushTimeout <= 0 { | ||
| closeFlushTimeout = defaultTelemetryCloseFlushTimeout | ||
| } | ||
| hasEnabled := t.Enabled != nil | ||
| enabled := false | ||
| if hasEnabled { | ||
| enabled = *t.Enabled | ||
| } | ||
| if err := call(func() C.KernelStatusCode { | ||
| return C.go_kernel_set_telemetry_config(cfg, | ||
| C.bool(t.Enabled), C.size_t(batchSize), C.uint64_t(flushInterval.Milliseconds()), | ||
| C.bool(hasEnabled), C.bool(enabled), C.size_t(batchSize), C.uint64_t(flushInterval.Milliseconds()), | ||
| C.uint32_t(maxRetries), C.uint64_t(retryDelay.Milliseconds()), | ||
| C.uint64_t(closeFlushTimeout.Milliseconds())) | ||
| }); err != nil { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -487,6 +487,25 @@ KernelStatusCode kernel_session_config_set_telemetry_config(KernelSessionConfig* | |
| uint64_t retry_delay_ms, | ||
| uint64_t close_flush_timeout_ms); | ||
|
|
||
| /* Optional telemetry configuration for hosts that must distinguish an omitted | ||
| * enablement setting from an explicit false. Passing `telemetry_config == NULL` | ||
| * leaves the kernel telemetry configuration unchanged. Otherwise the tuning | ||
| * fields are applied and `has_enabled` controls whether `enabled` overrides the | ||
| * workspace feature flag. The original positional setter above remains ABI | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔵 Low — The |
||
| * compatible and is equivalent to this function with `has_enabled = true`. */ | ||
| typedef struct KernelTelemetryConfig { | ||
| bool has_enabled; | ||
| bool enabled; | ||
| size_t batch_size; | ||
| uint64_t flush_interval_ms; | ||
| uint32_t max_retries; | ||
| uint64_t retry_delay_ms; | ||
| uint64_t close_flush_timeout_ms; | ||
| } KernelTelemetryConfig; | ||
|
|
||
| KernelStatusCode kernel_session_config_set_telemetry_config_v2( | ||
| KernelSessionConfig* config, const KernelTelemetryConfig* telemetry_config); | ||
|
|
||
| /* Configure telemetry circuit-breaker behavior. `threshold` and `timeout_ms` | ||
| * must be > 0 when circuit breaking is enabled. If this setter is not called, | ||
| * the kernel keeps its default circuit-breaker policy. */ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.