From cf368e689464ea5b13c307bd34c563f933ffd394 Mon Sep 17 00:00:00 2001 From: Christopher Fenner <26137398+CCFenner@users.noreply.github.com> Date: Tue, 21 Jan 2025 09:34:29 +0100 Subject: [PATCH] chore(Splunk): expose orchestrator to Splunk (#5243) * expose orchestrator to splunk * update test case * fix format --- pkg/splunk/data.go | 1 + pkg/splunk/splunk.go | 1 + pkg/splunk/splunk_test.go | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/splunk/data.go b/pkg/splunk/data.go index 740713b89a..2debc7a8bc 100644 --- a/pkg/splunk/data.go +++ b/pkg/splunk/data.go @@ -18,6 +18,7 @@ type Details struct { type MonitoringData struct { PipelineUrlHash string `json:"PipelineUrlHash,omitempty"` BuildUrlHash string `json:"BuildUrlHash,omitempty"` + Orchestrator string `json:"Orchestrator,omitempty"` StageName string `json:"StageName,omitempty"` StepName string `json:"StepName,omitempty"` ExitCode string `json:"ExitCode,omitempty"` diff --git a/pkg/splunk/splunk.go b/pkg/splunk/splunk.go index 1ce1190516..e23a8cae44 100644 --- a/pkg/splunk/splunk.go +++ b/pkg/splunk/splunk.go @@ -114,6 +114,7 @@ func (s *Splunk) prepareTelemetry(telemetryData telemetry.Data) MonitoringData { monitoringData := MonitoringData{ PipelineUrlHash: telemetryData.PipelineURLHash, BuildUrlHash: telemetryData.BuildURLHash, + Orchestrator: telemetryData.Orchestrator, StageName: telemetryData.StageName, StepName: telemetryData.BaseData.StepName, ExitCode: telemetryData.CustomData.ErrorCode, diff --git a/pkg/splunk/splunk_test.go b/pkg/splunk/splunk_test.go index 8f7f580931..2cc9188d0a 100644 --- a/pkg/splunk/splunk_test.go +++ b/pkg/splunk/splunk_test.go @@ -354,7 +354,9 @@ func Test_prepareTelemetry(t *testing.T) { {name: "Testing prepare telemetry information", args: args{ telemetryData: telemetry.Data{ - BaseData: telemetry.BaseData{}, + BaseData: telemetry.BaseData{ + Orchestrator: "Jenkins", + }, CustomData: telemetry.CustomData{ Duration: "1234", ErrorCode: "0", @@ -365,6 +367,7 @@ func Test_prepareTelemetry(t *testing.T) { want: MonitoringData{ PipelineUrlHash: "", BuildUrlHash: "", + Orchestrator: "Jenkins", StageName: "", StepName: "", ExitCode: "0",