telemetry

package
v1.227.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LibraryRepository string

LibraryRepository that is passed into with -ldflags

Functions

This section is empty.

Types

type BaseData

type BaseData struct {
	// SWA receives the fields custom1 - custom30 and e_a, e_2 - e_30 for custom values.
	ActionName      string `json:"action_name"`
	EventType       string `json:"event_type"`
	SiteID          string `json:"idsite"`
	URL             string `json:"url"`
	StepName        string `json:"e_3"` // set by step generator
	StageName       string `json:"e_10"`
	PipelineURLHash string `json:"e_4"`  // defaults to sha1 of provider.GetBuildURL()
	BuildURLHash    string `json:"e_5"`  // defaults to sha1 of provider.GetJobURL()
	Orchestrator    string `json:"e_14"` // defaults to provider.OrchestratorType()
}

BaseData object definition containing the base data and it's mapping information

type BaseMetaData

type BaseMetaData struct {
	// SWA receives the fields custom1 - custom30 and e_a, e_2 - e_30 for custom values.
	StepNameLabel        string `json:"custom3"`
	StageNameLabel       string `json:"custom10"`
	PipelineURLHashLabel string `json:"custom4"`
	BuildURLHashLabel    string `json:"custom5"`
	DurationLabel        string `json:"custom11,omitempty"`
	ExitCodeLabel        string `json:"custom12,omitempty"`
	ErrorCategoryLabel   string `json:"custom13,omitempty"`
	OrchestratorLabel    string `json:"custom14,omitempty"`
	PiperCommitHashLabel string `json:"custom15,omitempty"`
}

BaseMetaData object definition containing the labels for the base data, and it's mapping information

type CustomData

type CustomData struct {
	// SWA receives the fields custom1 - custom30 and e_a, e_2 - e_30 for custom values.
	// Piper uses the values custom11 - custom25 & e_11 - e_25 for library related reporting
	// and custom26 - custom30 & e_26 - e_30 for step  related reporting.
	Duration        string `json:"e_11,omitempty"`
	ErrorCode       string `json:"e_12,omitempty"`
	ErrorCategory   string `json:"e_13,omitempty"`
	PiperCommitHash string `json:"e_15,omitempty"`
	Custom1Label    string `json:"custom26,omitempty"`
	Custom2Label    string `json:"custom27,omitempty"`
	Custom3Label    string `json:"custom28,omitempty"`
	Custom4Label    string `json:"custom29,omitempty"`
	Custom5Label    string `json:"custom30,omitempty"`
	Custom1         string `json:"e_26,omitempty"`
	Custom2         string `json:"e_27,omitempty"`
	Custom3         string `json:"e_28,omitempty"`
	Custom4         string `json:"e_29,omitempty"`
	Custom5         string `json:"e_30,omitempty"`
}

CustomData object definition containing the data that can be set by a step, and it's mapping information

type Data

type Data struct {
	BaseData
	BaseMetaData
	CustomData
}

Data object definition containing all telemetry data

type StepTelemetryData

type StepTelemetryData struct {
	StepStartTime   string                 `json:"StepStartTime"`
	PipelineURLHash string                 `json:"PipelineURLHash"`
	BuildURLHash    string                 `json:"BuildURLHash"`
	StageName       string                 `json:"StageName"`
	StepName        string                 `json:"StepName"`
	ErrorCode       string                 `json:"ErrorCode"`
	StepDuration    string                 `json:"StepDuration"`
	ErrorCategory   string                 `json:"ErrorCategory"`
	CorrelationID   string                 `json:"CorrelationID"`
	PiperCommitHash string                 `json:"PiperCommitHash"`
	ErrorDetail     map[string]interface{} `json:"ErrorDetail"`
}

StepTelemetryData definition for telemetry reporting and monitoring

type Telemetry

type Telemetry struct {
	CustomReportingDsn   string
	CustomReportingToken string

	BaseURL  string
	Endpoint string
	SiteID   string
	// contains filtered or unexported fields
}

Telemetry struct which holds necessary infos about telemetry

func (*Telemetry) GetData

func (t *Telemetry) GetData() Data

GetData returns telemetryData

func (*Telemetry) Initialize

func (t *Telemetry) Initialize(telemetryDisabled bool, stepName string)

Initialize sets up the base telemetry data and is called in generated part of the steps

func (*Telemetry) Send

func (t *Telemetry) Send()

Send telemetry information to SWA

func (*Telemetry) SetData

func (t *Telemetry) SetData(customData *CustomData)

SetData sets the custom telemetry data and base data into the Data object

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL