This repository has been archived by the owner on Jan 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Ensure USQL tile processing always produces an indicator (#710)
* Parse tile title first Signed-off-by: Arthur Pitman <[email protected]> * Move TileResult to own file Signed-off-by: Arthur Pitman <[email protected]> * Renaming file Signed-off-by: Arthur Pitman <[email protected]> * Introduce helper functions Signed-off-by: Arthur Pitman <[email protected]> * Use helper functions Signed-off-by: Arthur Pitman <[email protected]> * Use helper functions Signed-off-by: Arthur Pitman <[email protected]> * Use helper functions Signed-off-by: Arthur Pitman <[email protected]> * Use helper functions Signed-off-by: Arthur Pitman <[email protected]> * Remove redundant code Signed-off-by: Arthur Pitman <[email protected]> * Produce tile result on query error Signed-off-by: Arthur Pitman <[email protected]> * Remove redundant comments Signed-off-by: Arthur Pitman <[email protected]> * Create tile result in own function Signed-off-by: Arthur Pitman <[email protected]> * Process visualization types separately Signed-off-by: Arthur Pitman <[email protected]> * Introduce dashboard tile type constants Signed-off-by: Arthur Pitman <[email protected]> * Introduce visualization type constants Signed-off-by: Arthur Pitman <[email protected]> * Clean indicator name Signed-off-by: Arthur Pitman <[email protected]> * Add test Signed-off-by: Arthur Pitman <[email protected]> * Add test Signed-off-by: Arthur Pitman <[email protected]> * Add test Signed-off-by: Arthur Pitman <[email protected]> * Add test Signed-off-by: Arthur Pitman <[email protected]> * Add test Signed-off-by: Arthur Pitman <[email protected]> * Add test Signed-off-by: Arthur Pitman <[email protected]> * Add test Signed-off-by: Arthur Pitman <[email protected]> * Add test Signed-off-by: Arthur Pitman <[email protected]> * Add test Signed-off-by: Arthur Pitman <[email protected]> * Add test Signed-off-by: Arthur Pitman <[email protected]> * Add test Signed-off-by: Arthur Pitman <[email protected]> * Add tests Signed-off-by: Arthur Pitman <[email protected]> * Add comment to exported type Signed-off-by: Arthur Pitman <[email protected]>
- Loading branch information
1 parent
d8c29cf
commit b3ca3d1
Showing
37 changed files
with
1,187 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package dashboard | ||
|
||
import ( | ||
keptnapi "github.com/keptn/go-utils/pkg/lib" | ||
keptnv2 "github.com/keptn/go-utils/pkg/lib/v0_2_0" | ||
) | ||
|
||
// TileResult stores the result of processing a dashboard tile and retrieving the SLIResult. | ||
type TileResult struct { | ||
sliResult *keptnv2.SLIResult | ||
objective *keptnapi.SLO | ||
sliName string | ||
sliQuery string | ||
} | ||
|
||
func newUnsuccessfulTileResult(indicatorName string, message string) TileResult { | ||
return TileResult{ | ||
sliResult: &keptnv2.SLIResult{ | ||
Metric: indicatorName, | ||
Success: false, | ||
Message: message, | ||
}, | ||
sliName: indicatorName, | ||
} | ||
} | ||
|
||
func newUnsuccessfulTileResultFromSLODefinition(sloDefinition *keptnapi.SLO, message string) TileResult { | ||
return TileResult{ | ||
sliResult: &keptnv2.SLIResult{ | ||
Metric: sloDefinition.SLI, | ||
Value: 0, | ||
Success: false, | ||
Message: message, | ||
}, | ||
objective: sloDefinition, | ||
sliName: sloDefinition.SLI, | ||
} | ||
} | ||
|
||
func newUnsuccessfulTileResultFromSLODefinitionAndSLIQuery(sloDefinition *keptnapi.SLO, sliQuery string, message string) TileResult { | ||
return TileResult{ | ||
sliResult: &keptnv2.SLIResult{ | ||
Metric: sloDefinition.SLI, | ||
Value: 0, | ||
Success: false, | ||
Message: message, | ||
}, | ||
objective: sloDefinition, | ||
sliName: sloDefinition.SLI, | ||
sliQuery: sliQuery, | ||
} | ||
} |
Oops, something went wrong.