You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 61ae05f
Browse filesBrowse the repository at this point in the historyBrowse files
- First set of metrics added using informers cache.
- Added flag for switching off metrics via helm and env vars.
- Added a documentation section about metrics and usage.
pflag.String(sidecarImageFlag, viper.GetString(sidecarImageFlag), "Flag to overwrite the GameServer sidecar image that is used. Can also use SIDECAR env variable")
150
179
pflag.String(sidecarCPULimitFlag, viper.GetString(sidecarCPULimitFlag), "Flag to overwrite the GameServer sidecar container's cpu limit. Can also use SIDECAR_CPU_LIMIT env variable")
@@ -154,6 +183,8 @@ func parseEnvFlags() config {
154
183
pflag.Int32(maxPortFlag, 0, "Required. The maximum port that that a GameServer can be allocated to. Can also use MAX_PORT env variable")
155
184
pflag.String(keyFileFlag, viper.GetString(keyFileFlag), "Optional. Path to the key file")
156
185
pflag.String(certFileFlag, viper.GetString(certFileFlag), "Optional. Path to the crt file")
186
+
pflag.String(kubeconfigFlag, viper.GetString(kubeconfigFlag), "Optional. kubeconfig to run the controller out of the cluster. Only use it for debugging as webhook won't works.")
187
+
pflag.Bool(enableMetricsFlag, viper.GetBool(enableMetricsFlag), "Flag to activate metrics of Agones. Can also use METRICS env variable.")
Agones controller exposes metrics via [OpenCensus](https://opencensus.io/). OpenCensus is a single distribution of libraries that collect metrics and distributed traces from your services, we only use it for metrics but it will allow us to support multiple exporters in the future.
4
+
5
+
We choose to start with Prometheus as this is the most popular with Kubernetes but it is also compatible with Stackdriver.
6
+
If you need another exporter, check the [list of supported](https://opencensus.io/exporters/supported-exporters/go/) exporters. It should be pretty straightforward to register a new one.(Github PR are more than welcomed)
7
+
8
+
We plan to support multiple exporters in the future via environement variables and helm flags.
9
+
10
+
## Backend integrations
11
+
12
+
### Prometheus
13
+
14
+
If you are running a [Prometheus](https://prometheus.io/) intance you just need to ensure that metrics and kubernetes service discovery are enabled. (helm chart values `agones.metrics.enabled` and `agones.metrics.prometheusServiceDiscovery`). This will automatically add annotations required by Prometheus to discover Agones metrics and start collecting them. (see [example](https://github.com/prometheus/prometheus/tree/master/documentation/examples/kubernetes-rabbitmq))
15
+
16
+
### Prometheus Operator
17
+
18
+
If you have [Prometheus operator](https://github.com/coreos/prometheus-operator) installed in your cluster, make sure to add a [`ServiceMonitor`](https://github.com/coreos/prometheus-operator/blob/v0.17.0/Documentation/api.md#servicemonitorspec) to discover Agones metrics as shown below:
19
+
20
+
```yaml
21
+
apiVersion: monitoring.coreos.com/v1
22
+
kind: ServiceMonitor
23
+
metadata:
24
+
name: agones
25
+
labels:
26
+
app: agones
27
+
spec:
28
+
selector:
29
+
matchLabels:
30
+
stable.agones.dev/role: controller
31
+
endpoints:
32
+
- port: web
33
+
```
34
+
35
+
Finally include that `ServiceMonitor` in your [Prometheus instance CRD](https://github.com/coreos/prometheus-operator/blob/v0.17.0/Documentation/user-guides/getting-started.md#include-servicemonitors), this is usually done by adding a label to the `ServiceMonitor` above that is matched by the prometheus instance of your choice.
36
+
37
+
### Stackdriver
38
+
39
+
We don't yet support the [OpenCensus Stackdriver exporter](https://opencensus.io/exporters/supported-exporters/go/stackdriver/) but you can still use the Prometheus Stackdriver integration by following these [instructions](https://cloud.google.com/monitoring/kubernetes-engine/prometheus).
40
+
Annotations required by this integration can be activated by setting the `agones.metrics.prometheusServiceDiscovery` to true (default) via the [helm chart value](../install/helm/README.md#configuration).
| agones_gameservers_count | The number of gameservers per fleet and status | gauge |
47
+
| agones_fleet_allocations_count | The number of fleet allocations per fleet | gauge |
48
+
| agones_gameservers_total | The total of gameservers per fleet and status | counter |
49
+
| agones_fleet_allocations_total | The total of fleet allocations per fleet | counter |
50
+
| agones_fleets_replicas_count | The number of replicas per fleet (total, desired, ready, allocated) | gauge |
51
+
| agones_fleet_autoscalers_able_to_scale | The fleet autoscaler can access the fleet to scale | gauge |
52
+
| agones_fleet_autoscalers_buffer_limits | he limits of buffer based fleet autoscalers (min, max) | gauge |
53
+
| agones_fleet_autoscalers_buffer_size | The buffer size of fleet autoscalers (count or percentage) | gauge |
54
+
| agones_fleet_autoscalers_current_replicas_count | The current replicas count as seen by autoscalers | gauge |
55
+
| agones_fleet_autoscalers_desired_replicas_count | The desired replicas count as seen by autoscalers | gauge |
56
+
| agones_fleet_autoscalers_limited | The fleet autoscaler is capped (1) | gauge |
57
+
58
+
## Dashboard
59
+
60
+
Grafana and Stackdriver - Coming Soon
61
+
62
+
## Adding more metrics
63
+
64
+
If you want to contribute and add more metrics we recommend to use shared informers (cache) as it is currently implemented in the [metrics controller](../pkg/metrics/controller.go). Using shared informers allows to keep metrics code in one place and doesn't overload the Kubernetes API.
65
+
66
+
However there is some cases where you will have to add code inside your ressource controller (eg. latency metrics), you should minize metrics code in your controller by adding specific functions in the metrics packages as shown below.
Copy file name to clipboardExpand all lines: install/helm/README.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,6 +86,8 @@ The following tables lists the configurable parameters of the Agones chart and t
86
86
|`agones.rbacEnabled`| Creates RBAC resources. Must be set for any cluster configured with RBAC |`true`|
87
87
|`agones.crds.install`| Install the CRDs with this chart. Useful to disable if you want to subchart (since crd-install hook is broken), so you can copy the CRDs into your own chart. |`true`|
88
88
|`agones.crds.cleanupOnDelete`| Run the pre-delete hook to delete all GameServers and their backing Pods when deleting the helm chart, so that all CRDs can be removed on chart deletion |`true`|
89
+
|`agones.metrics.enabled`| Enables controller metrics on port `8080` and path `/metrics`|`true`|
90
+
|`agones.metrics.prometheusServiceDiscovery`| Adds annotations for Prometheus ServiceDiscovery (and also Strackdriver) |`true`|
89
91
|`agones.serviceaccount.controller`| Service account name for the controller |`agones-controller`|
90
92
|`agones.serviceaccount.sdk`| Service account name for the sdk |`agones-sdk`|
91
93
|`agones.image.registry`| Global image registry for all images |`gcr.io/agones-images`|
@@ -99,7 +101,7 @@ The following tables lists the configurable parameters of the Agones chart and t
99
101
|`agones.image.sdk.alwaysPull`| Tells if the sdk image should always be pulled |`false`|
100
102
|`agones.image.ping.name`| ( ⚠️ development feature ⚠️ ) Image name for the ping service |`agones-ping`|
101
103
|`agones.image.ping.pullPolicy`| ( ⚠️ development feature ⚠️ ) Image pull policy for the ping service |`IfNotPresent`|
102
-
|`agones.controller.healthCheck.http.port`| Port to use for liveness probe service|`8080`|
104
+
|`agones.controller.http.port`| Port to use for liveness probe service and metrics|`8080`|
103
105
|`agones.controller.healthCheck.initialDelaySeconds`| Initial delay before performing the first probe (in seconds) |`3`|
104
106
|`agones.controller.healthCheck.periodSeconds`| Seconds between every liveness probe (in seconds) |`3`|
105
107
|`agones.controller.healthCheck.failureThreshold`| Number of times before giving up (in seconds) |`3`|
0 commit comments