-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some metrics about the release count (#34)
* Add some metrics about the release count * Put a feature description about the metrics
- Loading branch information
1 parent
bb7cd61
commit 836061a
Showing
6 changed files
with
91 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package controllers | ||
|
||
import ( | ||
"github.com/prometheus/client_golang/prometheus" | ||
"sigs.k8s.io/controller-runtime/pkg/metrics" | ||
) | ||
|
||
var ( | ||
releaserTagActionCount = prometheus.NewCounter( | ||
prometheus.CounterOpts{ | ||
Name: "releaser_tag_total", | ||
Help: "Number of tag actions", | ||
}, | ||
) | ||
releaserReleaseActionCount = prometheus.NewCounter( | ||
prometheus.CounterOpts{ | ||
Name: "releaser_release_total", | ||
Help: "Number of release actions", | ||
}, | ||
) | ||
releaserPreReleaseActionCount = prometheus.NewCounter( | ||
prometheus.CounterOpts{ | ||
Name: "releaser_prerelease_total", | ||
Help: "Number of preRelease actions", | ||
}, | ||
) | ||
releaserGitOpsCount = prometheus.NewCounter( | ||
prometheus.CounterOpts{ | ||
Name: "releaser_gitops_total", | ||
Help: "Number of using GitOps way", | ||
}, | ||
) | ||
) | ||
|
||
func init() { | ||
// Register custom metrics with the global prometheus registry | ||
metrics.Registry.MustRegister(releaserTagActionCount, | ||
releaserPreReleaseActionCount, | ||
releaserReleaseActionCount, | ||
releaserGitOpsCount) | ||
} | ||
|
||
func increaseTagActionCount() { | ||
releaserTagActionCount.Inc() | ||
} | ||
|
||
func increasePreReleaseActionCount() { | ||
releaserPreReleaseActionCount.Inc() | ||
} | ||
|
||
func increaseReleaseActionCount() { | ||
releaserReleaseActionCount.Inc() | ||
} | ||
|
||
func increaseGitOpsCount() { | ||
releaserGitOpsCount.Inc() | ||
} |
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