Skip to content

Commit

Permalink
[core] log the failed JIT workflow and detector, push DPL out only to IL
Browse files Browse the repository at this point in the history
As experienced by Uli last night, there was no indication in the message seen in the ECS GUI about which particular workflow failed and which detector does it belong to.
This adds this information and removes DPL command output from that message and sends it to Infologger (saying it can be found there).
  • Loading branch information
knopers8 authored and teo committed Jun 4, 2024
1 parent f894c3c commit c31a877
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions configuration/template/dplutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,12 @@ func jitDplGenerate(confSvc ConfigurationService, varStack map[string]string, wo
dplCmd.Dir = workflowRepo.GetCloneDir()
var dplOut []byte
dplOut, err = dplCmd.CombinedOutput()
log.Trace("DPL command out: " + string(dplOut))
if err != nil {
return "", fmt.Errorf("Failed to run DPL command: %w.\n DPL command out: %s", err, string(dplOut))
log.Errorf("failed to run DPL command due to error '%s'", err.Error())
log.Errorf("failed DPL command output: %s", string(dplOut))
return "", fmt.Errorf("failed to run DPL command due to error '%w'. See FLP Infologger for DPL command output", err)
} else {
log.Trace("DPL command out: " + string(dplOut))
}

return jitWorkflowName, nil
Expand Down Expand Up @@ -204,5 +207,10 @@ func generateDplSubworkflowFromUri(confSvc ConfigurationService, varStack map[st
return "", fmt.Errorf("JIT failed in template resolution of the dpl_command: %w", err)
}

return jitDplGenerate(confSvc, varStack, workflowRepo, "source /etc/profile.d/o2.sh && "+dplCommand)
jitWorkflowName, err = jitDplGenerate(confSvc, varStack, workflowRepo, "source /etc/profile.d/o2.sh && "+dplCommand)
if err != nil {
detector := varStack["detector"]
return "", fmt.Errorf("for JIT workflow '%s' and detector '%s': %w", dplCommandUri, detector, err)
}
return
}

0 comments on commit c31a877

Please sign in to comment.