This is an automated email from the ASF dual-hosted git repository.

wu-sheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-horizon-ui.git


The following commit(s) were added to refs/heads/main by this push:
     new 86fd30f  fix: network-profiling create — use OAP-schema settings field 
names
86fd30f is described below

commit 86fd30f4b5d656f9213e1f49cd572d52aba874c1
Author: Wu Sheng <[email protected]>
AuthorDate: Wed May 20 09:09:23 2026 +0800

    fix: network-profiling create — use OAP-schema settings field names
    
    OAP defines `EBPFNetworkDataCollectingSettings` as:
      requireCompleteRequest: Boolean!
      maxRequestSize: Int
      requireCompleteResponse: Boolean!
      maxResponseSize: Int
    
    We were sending `requireRequest` / `requireResponse`, so
    `createEBPFNetworkProfiling` rejected the variables with:
      "The variables input contains a field name 'requireRequest' that
       is not defined for input object type 'EBPFNetworkDataCollectingSettings'"
    
    Booster-ui uses the schema names (NewTask.vue: requireCompleteRequest /
    requireCompleteResponse, hardcoded to true). Match that.
    
    Changes:
      - packages/api-client/src/ebpf.ts: rename the two flags on
        `NetworkProfilingSampling.settings`; declare them non-optional to
        mirror the OAP `Boolean!`. Also surface `maxRequestSize` /
        `maxResponseSize` for future use (optional caps; omit to collect
        the whole payload).
      - LayerNetworkProfilingView: rename the two v-model paths, drop the
        `settings!` non-null assertion now that settings is required, and
        make `addSampling()` seed the settings block with sensible
        defaults (capture-both = true). Previously a row added via the
        "+ add another sampling rule" button had no settings at all,
        which would have hit the same 400 even after the name fix.
---
 .../ui/src/layer/profiling/LayerNetworkProfilingView.vue | 16 ++++++++++++----
 packages/api-client/src/ebpf.ts                          | 13 +++++++++----
 2 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/apps/ui/src/layer/profiling/LayerNetworkProfilingView.vue 
b/apps/ui/src/layer/profiling/LayerNetworkProfilingView.vue
index 32f46c6..f24a0c6 100644
--- a/apps/ui/src/layer/profiling/LayerNetworkProfilingView.vue
+++ b/apps/ui/src/layer/profiling/LayerNetworkProfilingView.vue
@@ -143,11 +143,19 @@ async function keepAlive(): Promise<void> {
 // ── New task modal ────────────────────────────────────────────────
 const showNewTask = ref(false);
 const newTaskError = ref<string | null>(null);
+// OAP's `EBPFNetworkDataCollectingSettings.requireCompleteRequest` and
+// `requireCompleteResponse` are `Boolean!` — non-null. Every sampling
+// row MUST carry the settings block, otherwise
+// `createEBPFNetworkProfiling` 400s with a schema validation error.
+const DEFAULT_SETTINGS = (): NetworkProfilingSampling['settings'] => ({
+  requireCompleteRequest: true,
+  requireCompleteResponse: true,
+});
 const samplings = ref<NetworkProfilingSampling[]>([
-  { uriRegex: '', minDuration: 0, when4xx: true, when5xx: true, settings: { 
requireRequest: true, requireResponse: true } },
+  { uriRegex: '', minDuration: 0, when4xx: true, when5xx: true, settings: 
DEFAULT_SETTINGS() },
 ]);
 function addSampling(): void {
-  samplings.value.push({ minDuration: 0, when4xx: false, when5xx: false });
+  samplings.value.push({ minDuration: 0, when4xx: false, when5xx: false, 
settings: DEFAULT_SETTINGS() });
 }
 function removeSampling(i: number): void {
   samplings.value.splice(i, 1);
@@ -334,8 +342,8 @@ function fmtTime(ms: number): string {
           <div class="check-row">
             <label class="cb"><input type="checkbox" v-model="s.when4xx" /> 
when 4xx</label>
             <label class="cb"><input type="checkbox" v-model="s.when5xx" /> 
when 5xx</label>
-            <label class="cb"><input type="checkbox" 
v-model="s.settings!.requireRequest" /> capture request</label>
-            <label class="cb"><input type="checkbox" 
v-model="s.settings!.requireResponse" /> capture response</label>
+            <label class="cb"><input type="checkbox" 
v-model="s.settings.requireCompleteRequest" /> capture request</label>
+            <label class="cb"><input type="checkbox" 
v-model="s.settings.requireCompleteResponse" /> capture response</label>
           </div>
         </div>
         <button class="btn-secondary" type="button" @click="addSampling">+ add 
another sampling rule</button>
diff --git a/packages/api-client/src/ebpf.ts b/packages/api-client/src/ebpf.ts
index f1df6e4..bfbe6cc 100644
--- a/packages/api-client/src/ebpf.ts
+++ b/packages/api-client/src/ebpf.ts
@@ -164,10 +164,15 @@ export interface NetworkProfilingSampling {
   when4xx?: boolean;
   when5xx?: boolean;
   minDuration?: number;
-  /** OAP enum: HEADER, BODY (text), STATUS, etc. */
-  settings?: {
-    requireRequest?: boolean;
-    requireResponse?: boolean;
+  /** Mirrors OAP's `EBPFNetworkDataCollectingSettings` input. The two
+   *  require flags are non-null on the OAP side (`Boolean!`); the max
+   *  sizes are optional caps — omit to collect the whole request/
+   *  response. */
+  settings: {
+    requireCompleteRequest: boolean;
+    requireCompleteResponse: boolean;
+    maxRequestSize?: number;
+    maxResponseSize?: number;
   };
 }
 

Reply via email to