-
Notifications
You must be signed in to change notification settings - Fork 813
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 Stackdriver Exporter for Opencensus #492
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,13 +23,14 @@ Table of Contents | |
- [Installation](#installation) | ||
- [Prometheus installation](#prometheus-installation) | ||
- [Grafana installation](#grafana-installation) | ||
- [Stackdriver installation](#stackdriver-installation) | ||
- [Adding more metrics](#adding-more-metrics) | ||
|
||
## Backend integrations | ||
|
||
### Prometheus | ||
|
||
If you are running a [Prometheus](https://prometheus.io/) instance 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)) | ||
If you are running a [Prometheus](https://prometheus.io/) instance you just need to ensure that metrics and kubernetes service discovery are enabled. (helm chart values {{% feature expiryVersion="0.8.0" %}}`agones.metrics.enabled`{{% /feature %}}{{% feature publishVersion="0.8.0" %}}`agones.metrics.prometheusEnabled`{{% /feature %}} 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)) | ||
|
||
### Prometheus Operator | ||
|
||
|
@@ -54,10 +55,17 @@ Finally include that `ServiceMonitor` in your [Prometheus instance CRD](https:// | |
|
||
### Stackdriver | ||
|
||
{{% feature expiryVersion="0.8.0" %}} | ||
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). | ||
Annotations required by this integration can be activated by setting the `agones.metrics.prometheusServiceDiscovery` | ||
to true (default) via the [helm chart value]({{< relref "../Installation/helm.md" >}}). | ||
{{% /feature %}} | ||
{{% feature publishVersion="0.8.0" %}} | ||
We support the [OpenCensus Stackdriver exporter](https://opencensus.io/exporters/supported-exporters/go/stackdriver/). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You get to play with our new documentation tools! We have "shortcodes" which you can wrap content in, to hide and show previous versions. See: https://agones.dev/site/docs/contribute/ for details. TL;DR - The old version should we wrapped in:
And the new documentation should be wrapped in:
The tooling will show/hide each section appropriately as we release new versions. |
||
In order to use it you should enable [Stackdriver Monitoring API](https://cloud.google.com/monitoring/api/enable-api) in Google Cloud Console. | ||
Follow the [Stackdriver Installation steps](#stackdriver-installation) to see your metrics on Stackdriver Monitoring website. | ||
{{% /feature %}} | ||
|
||
## Metrics available | ||
|
||
|
@@ -174,6 +182,39 @@ Open a web browser to [http://127.0.0.1:3000](http://127.0.0.1:3000), you should | |
|
||
> Makefile targets `make grafana-portforward`,`make kind-grafana-portforward` and `make minikube-grafana-portforward`. | ||
|
||
{{% feature publishVersion="0.8.0" %}} | ||
### Stackdriver installation | ||
|
||
In order to use [Stackdriver monitoring](https://app.google.stackdriver.com) you should [enable Stackdriver Monitoring API](https://cloud.google.com/monitoring/api/enable-api) on Google Cloud Console. You need to grant all the necessary permissions to the users (see [Access Control Guide](https://cloud.google.com/monitoring/access-control)). Stackdriver exporter uses a strategy called Application Default Credentials (ADC) to find your application's credentials. Details could be found here [Setting Up Authentication for Server to Server Production Applications](https://cloud.google.com/docs/authentication/production). | ||
|
||
Note that Stackdriver monitoring is enabled by default on GKE clusters, however you can follow this [guide](https://cloud.google.com/kubernetes-engine/docs/how-to/monitoring#enabling_stackdriver_monitoring) if it was disabled on your GKE cluster. | ||
|
||
Default metrics exporter is Prometheus. If you are using the [Helm installation]({{< ref "/docs/Installation/helm.md" >}}), you can install or upgrade Agones to use Stackdriver, using the following chart parameters: | ||
``` | ||
helm upgrade --install --wait --set agones.metrics.stackdriverEnabled=true --set agones.metrics.prometheusEnabled=false --set agones.metrics.prometheusServiceDiscovery=false my-release-name agones/agones | ||
``` | ||
|
||
With this configuration only Stackdriver exporter would be used instead of Prometheus exporter. | ||
|
||
Create a Fleet or a Gameserver in order to check that connection with stackdriver API is configured properly and so that you will be able to see the metrics data. | ||
|
||
Visit [Stackdriver monitoring](https://app.google.stackdriver.com) website, select your project, or choose `Create a new Workspace` and select GCP project where your cluster resides. In [Stackdriver metrics explorer](https://cloud.google.com/monitoring/charts/metrics-explorer) you should be able to find new metrics with prefix `agones/` (resource type is `Global`) after a couple of minutes. Choose the metrics you are interested in and add to a single or separate graphs. You can create multiple graphs, save them into your dashboard and use various aggregation parameters and reducers for each graph. | ||
|
||
Example of the dashboard appearance is provided below: | ||
|
||
![stackdriver monitoring dashboard](../../../images/stackdriver-metrics-dashboard.png) | ||
|
||
Currently there exists only manual way of configuring Stackdriver Dashboard. So it is up to you to set an Alignment Period (minimal is 1 minute), GroupBy, Filter parameters and other graph settings. | ||
|
||
#### Troubleshooting | ||
If you can't see Agones metrics you should have a look at the controller logs for connection errors. Also ensure that your cluster has the necessary credentials to interact with Stackdriver Monitoring. You can configure `stackdriverProjectID` manually, if the automatic discovery is not working. | ||
|
||
Permissions problem example from controller logs: | ||
``` | ||
Failed to export to Stackdriver: rpc error: code = PermissionDenied desc = Permission monitoring.metricDescriptors.create denied (or the resource may not exist). | ||
``` | ||
{{% /feature %}} | ||
|
||
## Adding more metrics | ||
|
||
If you want to contribute and add more metrics we recommend to use shared informers (cache) as it is currently implemented in the {{< ghlink href="pkg/metrics/controller.go" branch="master" >}}metrics controller{{< /ghlink >}}. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch 👍