зеркало из https://github.com/Azure/ARO-RP.git
Add field ClusterDeploymentNamespace in ServiceLogs (#2957)
JIRA: https://issues.redhat.com/browse/ARO-3309
This commit is contained in:
Родитель
f1d9035d14
Коммит
d82d4f53a1
|
@ -53,6 +53,7 @@ func (ocb *openShiftClusterBackend) try(ctx context.Context) (bool, error) {
|
|||
log = utillog.EnrichWithResourceID(log, doc.OpenShiftCluster.ID)
|
||||
log = utillog.EnrichWithCorrelationData(log, doc.CorrelationData)
|
||||
log = utillog.EnrichWithClusterVersion(log, doc.OpenShiftCluster.Properties.ClusterProfile.Version)
|
||||
log = utillog.EnrichWithClusterDeploymentNamespace(log, doc.OpenShiftCluster.Properties.HiveProfile.Namespace)
|
||||
|
||||
if doc.Dequeues > maxDequeueCount {
|
||||
err := fmt.Errorf("dequeued %d times, failing", doc.Dequeues)
|
||||
|
|
|
@ -161,6 +161,17 @@ func EnrichWithResourceID(log *logrus.Entry, resourceID string) *logrus.Entry {
|
|||
})
|
||||
}
|
||||
|
||||
// EnrichWithClusterDeploymentNamespace sets log fields based on hiveProfile.Namespace
|
||||
func EnrichWithClusterDeploymentNamespace(log *logrus.Entry, clusterDeploymentNamespace string) *logrus.Entry {
|
||||
if clusterDeploymentNamespace == "" {
|
||||
return log
|
||||
}
|
||||
|
||||
return log.WithFields(logrus.Fields{
|
||||
"cluster_deployment_namespace": strings.ToLower(clusterDeploymentNamespace),
|
||||
})
|
||||
}
|
||||
|
||||
// EnrichWithClusterVersion set log fields based on cluster version
|
||||
func EnrichWithClusterVersion(log *logrus.Entry, version string) *logrus.Entry {
|
||||
if version == "" {
|
||||
|
|
Загрузка…
Ссылка в новой задаче