Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the crash loop metrics to Arcane.Operator #135

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

s-vitaliy
Copy link
Contributor

@s-vitaliy s-vitaliy commented Dec 2, 2024

Resolves #134

Scope

Implemented:

  • Added an actor that periodically reports a value 1 if any stream has a crash loop status.

Since we are moving from .net to golang for the development of Arcane operator, I did not merge #125, just created a new actor like the actor that used for stream classes.

Checklist

  • GitHub issue exists for this change.
  • Unit tests added and they pass.
  • Line Coverage is at least 80%.
  • Review requested on latest commit.

@s-vitaliy s-vitaliy requested a review from a team as a code owner December 2, 2024 11:19
Copy link

github-actions bot commented Dec 2, 2024

Coverage after merging add-crash-loop-metric into main will be

73.97%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src/Extensions
   KubernetesObjectExtensions.cs100%100%100%100%
   StreamClassPhaseExtensions.cs83.33%50%100%100%17
   V1JobExtensions.cs76.97%59.09%88.24%83.52%105, 105, 126, 126, 131, 136, 136, 141, 146, 146, 151, 52–53, 53, 53, 53, 53–55, 58–59, 68, 68, 75, 83–84, 84, 84, 84, 84–87
src/Models/Api
   CustomResourceApiRequest.cs100%100%100%100%
   ResourceEvent.cs100%100%100%100%
src/Models/Base
   KubernetesCommands.cs75%100%75%75%29–30
src/Models/Commands
   StreamClassCommands.cs75%100%75%75%60
   StreamDefinitionCommands.cs89.74%100%92.86%88%126–128
   StreamingJobCommands.cs100%100%100%100%
src/Models/Resources/Status/V1Alpha1
   V1Alpha1StreamStatus.cs100%100%100%100%
src/Models/Resources/StreamClass/Base
   IStreamClass.cs100%100%100%100%
src/Models/Resources/StreamClass/V1Beta1
   V1Beta1StreamClassSpec.cs85.71%100%85.71%85.71%12
src/Models/Resources/StreamDefinitions/Base
   IStreamDefinition.cs90%83.33%100%100%29
src/Services/CommandHandlers
   AnnotationCommandHandler.cs47.89%16.67%75%49.18%39–42, 59–62, 67–71, 71, 71–78, 78, 78–90
   StreamingJobCommandHandler.cs86.46%66.67%100%90.28%111, 111, 114, 50, 54, 57, 60, 83–88
   UpdateStatusCommandHandler.cs91.14%75%100%91.43%102–103, 44–47, 85
src/Services/HostedServices
   HostedStreamingJobOperatorService.cs0%0%0%0%16–24, 27–29, 29, 29–36, 39–42
src/Services/Metrics
   CrashLoopReporterService.cs0%100%0%0%16–23, 26–28, 31–33
   DeclaredMetrics.cs73.17%60%80%76.92%34–39, 41, 41, 41, 41
   MetricsReporter.cs73.53%50%75%75%36–39, 50–53
src/Services/Metrics/Actors
   CrashLoopMetricsPublisherActor.cs100%100%100%100%
   MetricsPublisherActor.cs53.57%25%55.56%55.81%25, 42, 48, 53, 72–78, 82–83, 83, 83–86, 92–95
src/Services/Operators
   StreamClassOperatorService.cs93.06%62.50%100%96.55%103, 105, 80, 80, 84
   StreamingJobOperatorService.cs69.93%57.14%85.71%74.04%100–106, 141–145, 150, 154, 154, 154, 159–160, 78, 78, 78, 80, 83, 88–91, 91, 91–93, 93, 93, 93, 93–99, 99, 99, 99, 99
   StreamOperatorService.cs84.28%76.79%90.91%86.42%100–103, 111–115, 177–178, 178, 178, 180–181, 198–202, 218, 220, 224, 224, 224, 230–231, 75–76, 76, 76–77, 81–83
src/Services/Repositories/CustomResources
   StreamClassRepository.cs92.86%50%100%95.45%30, 32
   StreamDefinitionRepository.cs0%100%0%0%21–24, 29–34, 36–39, 42–49, 51–52, 56–61
   StreamingJobTemplateRepository.cs0%0%0%0%21–28, 32–34, 34, 34, 34, 34, 34, 34, 34, 34–37, 40–54
src/Services/Repositories/StreamingJob
   StreamingJobRepository.cs58.82%100%66.67%57.14%33–38

Copy link

github-actions bot commented Dec 2, 2024

Coverage after merging add-crash-loop-metric into main will be

74.17%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src/Extensions
   KubernetesObjectExtensions.cs100%100%100%100%
   StreamClassPhaseExtensions.cs83.33%50%100%100%17
   V1JobExtensions.cs76.97%59.09%88.24%83.52%105, 105, 126, 126, 131, 136, 136, 141, 146, 146, 151, 52–53, 53, 53, 53, 53–55, 58–59, 68, 68, 75, 83–84, 84, 84, 84, 84–87
src/Models/Api
   CustomResourceApiRequest.cs100%100%100%100%
   ResourceEvent.cs100%100%100%100%
src/Models/Base
   KubernetesCommands.cs75%100%75%75%29–30
src/Models/Commands
   StreamClassCommands.cs75%100%75%75%60
   StreamDefinitionCommands.cs89.74%100%92.86%88%126–128
   StreamingJobCommands.cs100%100%100%100%
src/Models/Resources/Status/V1Alpha1
   V1Alpha1StreamStatus.cs100%100%100%100%
src/Models/Resources/StreamClass/Base
   IStreamClass.cs100%100%100%100%
src/Models/Resources/StreamClass/V1Beta1
   V1Beta1StreamClassSpec.cs85.71%100%85.71%85.71%12
src/Models/Resources/StreamDefinitions/Base
   IStreamDefinition.cs90%83.33%100%100%29
src/Services/CommandHandlers
   AnnotationCommandHandler.cs47.89%16.67%75%49.18%39–42, 59–62, 67–71, 71, 71–78, 78, 78–90
   StreamingJobCommandHandler.cs88.54%72.22%100%91.67%111, 111, 114, 50, 60, 83–88
   UpdateStatusCommandHandler.cs91.14%75%100%91.43%102–103, 44–47, 85
src/Services/HostedServices
   HostedStreamingJobOperatorService.cs0%0%0%0%16–24, 27–29, 29, 29–36, 39–42
src/Services/Metrics
   CrashLoopReporterService.cs0%100%0%0%16–23, 26–28, 31–33
   DeclaredMetrics.cs73.17%60%80%76.92%34–39, 41, 41, 41, 41
   MetricsReporter.cs73.53%50%75%75%36–39, 50–53
src/Services/Metrics/Actors
   CrashLoopMetricsPublisherActor.cs100%100%100%100%
   MetricsPublisherActor.cs53.57%25%55.56%55.81%25, 42, 48, 53, 72–78, 82–83, 83, 83–86, 92–95
src/Services/Operators
   StreamClassOperatorService.cs93.06%62.50%100%96.55%103, 105, 80, 80, 84
   StreamingJobOperatorService.cs69.93%57.14%85.71%74.04%100–106, 141–145, 150, 154, 154, 154, 159–160, 78, 78, 78, 80, 83, 88–91, 91, 91–93, 93, 93, 93, 93–99, 99, 99, 99, 99
   StreamOperatorService.cs84.28%76.79%90.91%86.42%100–103, 111–115, 177–178, 178, 178, 180–181, 198–202, 218, 220, 224, 224, 224, 230–231, 75–76, 76, 76–77, 81–83
src/Services/Repositories/CustomResources
   StreamClassRepository.cs100%100%100%100%
   StreamDefinitionRepository.cs0%100%0%0%21–24, 29–34, 36–39, 42–49, 51–52, 56–61
   StreamingJobTemplateRepository.cs0%0%0%0%21–28, 32–34, 34, 34, 34, 34, 34, 34, 34, 34–37, 40–54
src/Services/Repositories/StreamingJob
   StreamingJobRepository.cs58.82%100%66.67%57.14%33–38

Copy link

github-actions bot commented Dec 2, 2024

Coverage after merging add-crash-loop-metric into main will be

74.17%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src/Extensions
   KubernetesObjectExtensions.cs100%100%100%100%
   StreamClassPhaseExtensions.cs83.33%50%100%100%17
   V1JobExtensions.cs76.97%59.09%88.24%83.52%105, 105, 126, 126, 131, 136, 136, 141, 146, 146, 151, 52–53, 53, 53, 53, 53–55, 58–59, 68, 68, 75, 83–84, 84, 84, 84, 84–87
src/Models/Api
   CustomResourceApiRequest.cs100%100%100%100%
   ResourceEvent.cs100%100%100%100%
src/Models/Base
   KubernetesCommands.cs75%100%75%75%29–30
src/Models/Commands
   StreamClassCommands.cs75%100%75%75%60
   StreamDefinitionCommands.cs89.74%100%92.86%88%126–128
   StreamingJobCommands.cs100%100%100%100%
src/Models/Resources/Status/V1Alpha1
   V1Alpha1StreamStatus.cs100%100%100%100%
src/Models/Resources/StreamClass/Base
   IStreamClass.cs100%100%100%100%
src/Models/Resources/StreamClass/V1Beta1
   V1Beta1StreamClassSpec.cs85.71%100%85.71%85.71%12
src/Models/Resources/StreamDefinitions/Base
   IStreamDefinition.cs90%83.33%100%100%29
src/Services/CommandHandlers
   AnnotationCommandHandler.cs47.89%16.67%75%49.18%39–42, 59–62, 67–71, 71, 71–78, 78, 78–90
   StreamingJobCommandHandler.cs88.54%72.22%100%91.67%111, 111, 114, 50, 60, 83–88
   UpdateStatusCommandHandler.cs91.14%75%100%91.43%102–103, 44–47, 85
src/Services/HostedServices
   HostedStreamingJobOperatorService.cs0%0%0%0%16–24, 27–29, 29, 29–36, 39–42
src/Services/Metrics
   CrashLoopReporterService.cs0%100%0%0%16–23, 26–28, 31–33
   DeclaredMetrics.cs73.17%60%80%76.92%34–39, 41, 41, 41, 41
   MetricsReporter.cs73.53%50%75%75%36–39, 50–53
src/Services/Metrics/Actors
   CrashLoopMetricsPublisherActor.cs100%100%100%100%
   MetricsPublisherActor.cs53.57%25%55.56%55.81%25, 42, 48, 53, 72–78, 82–83, 83, 83–86, 92–95
src/Services/Operators
   StreamClassOperatorService.cs93.06%62.50%100%96.55%103, 105, 80, 80, 84
   StreamingJobOperatorService.cs69.93%57.14%85.71%74.04%100–106, 141–145, 150, 154, 154, 154, 159–160, 78, 78, 78, 80, 83, 88–91, 91, 91–93, 93, 93, 93, 93–99, 99, 99, 99, 99
   StreamOperatorService.cs84.28%76.79%90.91%86.42%100–103, 111–115, 177–178, 178, 178, 180–181, 198–202, 218, 220, 224, 224, 224, 230–231, 75–76, 76, 76–77, 81–83
src/Services/Repositories/CustomResources
   StreamClassRepository.cs100%100%100%100%
   StreamDefinitionRepository.cs0%100%0%0%21–24, 29–34, 36–39, 42–49, 51–52, 56–61
   StreamingJobTemplateRepository.cs0%0%0%0%21–28, 32–34, 34, 34, 34, 34, 34, 34, 34, 34–37, 40–54
src/Services/Repositories/StreamingJob
   StreamingJobRepository.cs58.82%100%66.67%57.14%33–38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Number of crash loops as a metric
1 participant