generated from kyma-project/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!-- Thank you for your contribution. Before you submit the pull request: 1. Follow contributing guidelines, templates, the recommended Git workflow, and any related documentation. 2. Read and submit the required Contributor Licence Agreements (https://github.com/kyma-project/community/blob/main/CONTRIBUTING.md#agreements-and-licenses). 3. Test your changes and attach their results to the pull request. 4. Update the relevant documentation. If the pull request requires a decision, follow the [decision-making process](https://github.com/kyma-project/community/blob/main/governance.md) and replace the PR template with the [decision record template](https://github.com/kyma-project/community/blob/main/.github/ISSUE_TEMPLATE/decision-record.md). --> **Description** Initial metrics PR, more metrics will be added when dashboard is connected **Related issue(s)** <!-- If you refer to a particular issue, provide its number. For example, `Resolves #123`, `Fixes #43`, or `See also #33`. --> #28
- Loading branch information
Showing
12 changed files
with
120 additions
and
20 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,23 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
control-plane: compass-manager | ||
app.kubernetes.io/name: metrics | ||
app.kubernetes.io/instance: compass-manager | ||
app.kubernetes.io/component: compass-manager.kyma-project.io | ||
app.kubernetes.io/created-by: compass-manager | ||
app.kubernetes.io/part-of: compass-manager | ||
app.kubernetes.io/managed-by: kustomize | ||
name: compass-manager-metrics | ||
namespace: kcp-system | ||
spec: | ||
ports: | ||
- name: metrics | ||
port: 8080 | ||
protocol: TCP | ||
appProtocol: http | ||
targetPort: metrics | ||
selector: | ||
app.kubernetes.io/name: compass-manager | ||
app.kubernetes.io/component: compass-manager.kyma-project.io |
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,43 @@ | ||
package metrics | ||
|
||
import ( | ||
"github.com/prometheus/client_golang/prometheus" | ||
"sigs.k8s.io/controller-runtime/pkg/metrics" | ||
) | ||
|
||
type Metrics struct { | ||
configured prometheus.Counter | ||
registered prometheus.Counter | ||
unregistered prometheus.Counter | ||
} | ||
|
||
func NewMetrics() Metrics { | ||
m := Metrics{ | ||
configured: prometheus.NewCounter(prometheus.CounterOpts{ | ||
Name: "configure_counter", | ||
Help: "Number of cluster configured", | ||
}), | ||
registered: prometheus.NewCounter(prometheus.CounterOpts{ | ||
Name: "register_counter", | ||
Help: "Number of cluster registered", | ||
}), | ||
unregistered: prometheus.NewCounter(prometheus.CounterOpts{ | ||
Name: "unregister_counter", | ||
Help: "Number of cluster unregistered", | ||
}), | ||
} | ||
metrics.Registry.MustRegister(m.configured, m.registered, m.unregistered) | ||
return m | ||
} | ||
|
||
func (m Metrics) IncConfigure() { | ||
m.configured.Inc() | ||
} | ||
|
||
func (m Metrics) IncRegister() { | ||
m.registered.Inc() | ||
} | ||
|
||
func (m Metrics) IncUnregister() { | ||
m.unregistered.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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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