Skip to content

Commit

Permalink
Merge pull request #147 from fluxcd/trace-events
Browse files Browse the repository at this point in the history
Add trace event type
  • Loading branch information
stefanprodan authored Aug 26, 2021
2 parents 6a82b83 + 487f832 commit d726dea
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion runtime/events/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// Package events provides a Recorder and additional helpers to record Kubernetes Events on a external HTTP endpoint.
// Package events provides a Recorder and additional helpers to record Kubernetes Events on an external HTTP endpoint.
package events
7 changes: 5 additions & 2 deletions runtime/events/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ import (

// These constants define valid event severity values.
const (
// EventSeverityTrace represents a trace event, usually
// informing about actions taken during reconciliation.
EventSeverityTrace string = "trace"
// EventSeverityInfo represents an informational event, usually
// informing about changes.
EventSeverityInfo string = "info"
Expand All @@ -38,8 +41,8 @@ type Event struct {
// +required
InvolvedObject corev1.ObjectReference `json:"involvedObject"`

// Severity type of this event (info, error)
// +kubebuilder:validation:Enum=info;error
// Severity type of this event (trace, info, error)
// +kubebuilder:validation:Enum=trace,info;error
// +required
Severity string `json:"severity"`

Expand Down
7 changes: 7 additions & 0 deletions runtime/events/recorder.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ func (r *Recorder) Eventf(
metadata map[string]string,
severity, reason string,
messageFmt string, args ...interface{}) error {

// Do not send trace events to notification controller,
// traces are persisted as Kubernetes events only.
if severity == EventSeverityTrace {
return nil
}

if r.Client == nil {
return fmt.Errorf("retryable HTTP client has not been initialized")
}
Expand Down

0 comments on commit d726dea

Please sign in to comment.