[BUG] splunk: export parsing, job polling and missing values are not handled robustly

Đang mở
#897 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@AnKiT-GaRG2 đang làm issue này rồi.

Từ ngày 27/10/2026.

  • #898 của @AnKiT-GaRG2 — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
typescript
Lĩnh vực
data

Hướng nghiên cứu

Start in splunk/src/model/splunk-client.ts at exportSearch and convertResultsToTimeSeries, then read the polling loops in get-splunk-time-series-data.ts and get-splunk-log-data.ts. Reproduce the export failure with a mocked response containing a line without result, then make parse errors name the Splunk export response. Done means malformed job status throws, missing metric values become null, and tests cover each case; note that linked PR #898 already exists, so check it before starting.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Summary

A few robustness problems in the Splunk plugin make queries fail with an unhelpful error, or draw wrong data, instead of surfacing the real cause.

1. exportSearch assumes every response line carries a result

splunk/src/model/splunk-client.ts (exportSearch):

const lines = text.trim().split('\n');
const results = lines.filter((line: string) => line.trim()).map((line: string) => JSON.parse(line).result);
  • A line without a result key (for example a messages line) puts undefined into results.
  • convertResultsToTimeSeries then reads result._time on that entry and throws a TypeError, so the panel fails with an error that says nothing about Splunk.
  • A line that is not valid JSON throws a bare SyntaxError with no context.

I have not reproduced this against a live Splunk. The failure is reproducible with a mocked export response that contains a line without result.

2. A malformed job status ends polling early

In get-splunk-time-series-data.ts and get-splunk-log-data.ts, if getJobStatus returns a malformed response the loop only logs a warning and breaks, and getJobResults is then called for a job that may not be finished. That returns partial or empty results without any error.

3. Missing values become 0 in time series

convertResultsToTimeSeries uses Number(result[metricKey]) || 0. A missing or non-numeric value is plotted as 0, which draws a false data point. null (a gap) would be more accurate.

Proposed fix
  • Skip lines without a result in exportSearch, and wrap parse errors in an error that names the Splunk export response.
  • Throw a descriptive error when the job status is malformed.
  • Map missing or non-numeric values to null instead of 0.
  • Add tests for each.

I'm happy to send a PR for this.

Ngôn ngữ chính
TypeScript
Star
33
Fork
92
Merge trung bình
1 ngày 16 giờ
Pull request đã merge (30 ngày)
35

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của perses/plugins

Tất cả issue của perses/plugins

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.