Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#897 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@AnKiT-GaRG2 がすでに取り組んでいます。

2026年10月27日 から。

  • #898 @AnKiT-GaRG2 による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
typescript
領域
data

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
TypeScript
スター
33
フォーク
91
平均マージ
1日 17時間
マージ済み PR(30日)
37

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

perses/plugins のほかの issue

perses/plugins の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。