From 9ba56d91b3879fae6691050e041eb57f10b7a7b9 Mon Sep 17 00:00:00 2001 From: Harnish Chavda <118714680+harnish-elastic@users.noreply.github.com> Date: Thu, 28 Nov 2024 12:19:43 +0530 Subject: [PATCH] revert error handling changes (#11650) --- packages/mongodb_atlas/changelog.yml | 5 +++++ .../data_stream/disk/agent/stream/input.yml.hbs | 10 +++++----- .../data_stream/hardware/agent/stream/input.yml.hbs | 4 ++-- .../data_stream/process/agent/stream/input.yml.hbs | 4 ++-- packages/mongodb_atlas/manifest.yml | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/packages/mongodb_atlas/changelog.yml b/packages/mongodb_atlas/changelog.yml index 8a3f9303403..947cc16fef0 100644 --- a/packages/mongodb_atlas/changelog.yml +++ b/packages/mongodb_atlas/changelog.yml @@ -1,4 +1,9 @@ # newer versions go on top +- version: "0.0.10" + changes: + - description: Fix single event object returned by evaluation error for hardware, process and disk data streams. + type: bugfix + link: https://github.com/elastic/integrations/pull/11650 - version: "0.0.9" changes: - description: MongoDB Atlas integration package with "disk" data stream. diff --git a/packages/mongodb_atlas/data_stream/disk/agent/stream/input.yml.hbs b/packages/mongodb_atlas/data_stream/disk/agent/stream/input.yml.hbs index 755307f9a21..9df06e94175 100644 --- a/packages/mongodb_atlas/data_stream/disk/agent/stream/input.yml.hbs +++ b/packages/mongodb_atlas/data_stream/disk/agent/stream/input.yml.hbs @@ -123,7 +123,7 @@ program: | }, }).do_request().as(res, (res.StatusCode == 200) ? { - "events": bytes(res.Body).decode_json().as(f, + "events": [bytes(res.Body).decode_json().as(f, f.with( { "response": zip( @@ -133,7 +133,7 @@ program: | ), } ).drop(["measurements", "links"]) - ), + )], "disk_list": (int(state.disk_next) + 1 < size(state.disk_list)) ? state.disk_list : [], "disk_next": (int(state.disk_next) + 1 < size(state.disk_list)) ? (int(state.disk_next) + 1) : 0, "disk_page_num": state.disk_page_num, @@ -159,8 +159,8 @@ program: | ), }, }, - "want_more": false, - } + "want_more": false, + } + ) ) ) - ) diff --git a/packages/mongodb_atlas/data_stream/hardware/agent/stream/input.yml.hbs b/packages/mongodb_atlas/data_stream/hardware/agent/stream/input.yml.hbs index 6c702746662..89809a9ec95 100644 --- a/packages/mongodb_atlas/data_stream/hardware/agent/stream/input.yml.hbs +++ b/packages/mongodb_atlas/data_stream/hardware/agent/stream/input.yml.hbs @@ -54,13 +54,13 @@ program: | "Accept": ["application/vnd.atlas." + string(now.getFullYear()) + "-01-01+json"] } }).do_request().as(res, { - "events": bytes(res.Body).decode_json().as(f, f.with({"hardware": zip( + "events": [bytes(res.Body).decode_json().as(f, f.with({"hardware": zip( //Combining measurement names and actual values of measurement to generate `key : value` pairs. f.hardwareMeasurements.map(m, m.name), f.hardwareMeasurements.map(m, m.dataPoints.map(d, d.value).as(v, size(v) == 0 ? null : v[0]))), "status": zip( f.statusMeasurements.map(m, m.name), - f.statusMeasurements.map(m, m.dataPoints.map(d, d.value).as(v, size(v) == 0 ? null : v[0])))}).drop(["hardwareMeasurements","statusMeasurements", "links"])), + f.statusMeasurements.map(m, m.dataPoints.map(d, d.value).as(v, size(v) == 0 ? null : v[0])))}).drop(["hardwareMeasurements","statusMeasurements", "links"]))], "hostlist": (int(state.next)+1) < size(state.hostlist) ? state.hostlist : [], "next": (int(state.next)+1) < size(state.hostlist) ? (int(state.next)+1) : 0, "want_more": (int(state.next)+1) < size(state.hostlist) || state.page_num != 1, diff --git a/packages/mongodb_atlas/data_stream/process/agent/stream/input.yml.hbs b/packages/mongodb_atlas/data_stream/process/agent/stream/input.yml.hbs index 13b657fa2e4..89d5272a9e0 100644 --- a/packages/mongodb_atlas/data_stream/process/agent/stream/input.yml.hbs +++ b/packages/mongodb_atlas/data_stream/process/agent/stream/input.yml.hbs @@ -54,11 +54,11 @@ program: | "Accept": ["application/vnd.atlas." + string(now.getFullYear()) + "-01-01+json"] } }).do_request().as(res, { - "events": bytes(res.Body).decode_json().as(f, f.with({"response": zip( + "events": [bytes(res.Body).decode_json().as(f, f.with({"response": zip( //Combining measurement names and actual values of measurement to generate `key : value` pairs. f.measurements.map(m, m.name), f.measurements.map(m, m.dataPoints.map(d, d.value).as(v, size(v) == 0 ? null : v[0])) - )}).drop(["measurements", "links"])), + )}).drop(["measurements", "links"]))], "hostlist": (int(state.next)+1) < size(state.hostlist) ? state.hostlist : [], "next": (int(state.next)+1) < size(state.hostlist) ? (int(state.next)+1) : 0, "want_more": (int(state.next)+1) < size(state.hostlist) || state.page_num != 1, diff --git a/packages/mongodb_atlas/manifest.yml b/packages/mongodb_atlas/manifest.yml index 0eb7781c002..4eeaef674fa 100644 --- a/packages/mongodb_atlas/manifest.yml +++ b/packages/mongodb_atlas/manifest.yml @@ -1,7 +1,7 @@ format_version: 3.0.3 name: mongodb_atlas title: "MongoDB Atlas" -version: 0.0.9 +version: 0.0.10 source: license: "Elastic-2.0" description: This Elastic integration collects logs and metrics from MongoDB Atlas instance.