Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Add revision key to exported log fields (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
EngHabu authored Dec 18, 2019
1 parent c0c53d1 commit ee0dc82
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions contextutils/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,20 @@ import (
type Key string

const (
AppNameKey Key = "app_name"
NamespaceKey Key = "ns"
TaskTypeKey Key = "tasktype"
ProjectKey Key = "project"
DomainKey Key = "domain"
WorkflowIDKey Key = "wf"
NodeIDKey Key = "node"
TaskIDKey Key = "task"
ExecIDKey Key = "exec_id"
JobIDKey Key = "job_id"
PhaseKey Key = "phase"
RoutineLabelKey Key = "routine"
LaunchPlanIDKey Key = "lp"
AppNameKey Key = "app_name"
NamespaceKey Key = "ns"
TaskTypeKey Key = "tasktype"
ProjectKey Key = "project"
DomainKey Key = "domain"
WorkflowIDKey Key = "wf"
NodeIDKey Key = "node"
TaskIDKey Key = "task"
ExecIDKey Key = "exec_id"
JobIDKey Key = "job_id"
PhaseKey Key = "phase"
RoutineLabelKey Key = "routine"
LaunchPlanIDKey Key = "lp"
ResourceVersionKey Key = "res_ver"
)

func (k Key) String() string {
Expand All @@ -40,6 +41,12 @@ var logKeys = []Key{
PhaseKey,
RoutineLabelKey,
LaunchPlanIDKey,
ResourceVersionKey,
}

// Gets a new context with the resource version set.
func WithResourceVersion(ctx context.Context, resourceVersion string) context.Context {
return context.WithValue(ctx, ResourceVersionKey, resourceVersion)
}

// Gets a new context with namespace set.
Expand Down

0 comments on commit ee0dc82

Please sign in to comment.