Skip to content

Commit

Permalink
Merge pull request #125 from gsunner/usage-metrics
Browse files Browse the repository at this point in the history
Anonymous usage metrics collection
  • Loading branch information
ukclivecox authored Mar 27, 2018
2 parents 462dc3f + 331fd45 commit 5b26ede
Show file tree
Hide file tree
Showing 12 changed files with 328 additions and 552 deletions.
69 changes: 69 additions & 0 deletions docs/developer/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,72 @@ To be completed.

- [github-changelog-generator](https://github.com/skywinder/github-changelog-generator)
- [Grip - Local Markdown viewer](https://github.com/joeyespo/grip)

## Usage Reporting

An important part of the development process is to better understand the real user environment that the application will run in.

We provide an option to use an anonymous metrics collection tool provided by the Kubernetes project called [Spartakus](https://github.com/kubernetes-incubator/spartakus).

### Enable Usage Reporting

To help support the development of seldon-core, the voluntary reporting of usage data can be enabled whenever the "seldon-core-crd" helm chart is used by setting the "--set usage_metrics.enabled=true" option.

```bash
helm install seldon-core-crd --name seldon-core-crd \
--repo https://storage.googleapis.com/seldon-charts --set usage_metrics.enabled=true
```

The information that is reported is anonymous and only contains some information about each node in the cluster, including OS version, kubelet version, docker version, and CPU and memory capacity.

An example of what's reported:
```json
{
"clusterID": "846db7e9-c861-43d7-8d08-31578af59878",
"extensions": [
{
"name": "seldon-core-version",
"value": "0.1.5"
}
],
"masterVersion": "v1.9.3-gke.0",
"nodes": [
{
"architecture": "amd64",
"capacity": [
{
"resource": "cpu",
"value": "4"
},
{
"resource": "memory",
"value": "15405960Ki"
},
{
"resource": "pods",
"value": "110"
}
],
"cloudProvider": "gce",
"containerRuntimeVersion": "docker://17.3.2",
"id": "33082e677f61a199c195553e52bbd65a",
"kernelVersion": "4.4.111+",
"kubeletVersion": "v1.9.3-gke.0",
"operatingSystem": "linux",
"osImage": "Container-Optimized OS from Google"
}
],
"timestamp": "1522059083",
"version": "v1.0.0-5d3377f6946c3ce9159cc9e7589cfbf1de26e0df"
}
```

### Disable Usage Reporting

Reporting of usage data is disabled by default, just use "seldon-core-crd" as normal.

```bash
helm install seldon-core-crd --name seldon-core-crd \
--repo https://storage.googleapis.com/seldon-charts
```

9 changes: 6 additions & 3 deletions docs/getting_started/minikube.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,15 @@ You can now start Seldon Core in your minikube cluster.
helm init
```

1. Seldon Core uses helm charts to start which are stored in google storage. To start Seldon Core using helm install the CRD and then the core components:
2. Seldon Core uses helm charts to start, which are stored in google storage.
Use the charts to install the CRD and then the core components. Enabling reporting of anonymous usage metrics is optional, see [Usage Reporting](/docs/developer/readme.md#usage-reporting).


```bash
helm install seldon-core-crd --name seldon-core-crd --repo https://storage.googleapis.com/seldon-charts
helm install seldon-core-crd --name seldon-core-crd \
--repo https://storage.googleapis.com/seldon-charts --set usage_metrics.enabled=true
helm install seldon-core --name seldon-core \
--repo https://storage.googleapis.com/seldon-charts
--repo https://storage.googleapis.com/seldon-charts
```

Seldon Core should now be running on your cluster. You can verify if all the pods are up and running typing on command line ```helm status seldon-core``` or ```kubectl get pods```
Expand Down
16 changes: 16 additions & 0 deletions helm-charts/seldon-core-crd/templates/spartakus-config-map.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if .Values.usage_metrics.enabled }}
{
"apiVersion": "v1",
"data": {
"spartakus.volunteer.clusterid": "{{ default uuidv4 .Values.usage_metrics.clusterid }}",
"spartakus.volunteer.database": "{{ .Values.usage_metrics.database }}",
"spartakus.volunteer.extensions": "{\"seldon-core-version\":\"{{ .Chart.Version }}\"}"
},
"kind": "ConfigMap",
"metadata": {
"name": "seldon-spartakus-config",
"namespace": "kube-system"
}
}
{{- end }}

57 changes: 57 additions & 0 deletions helm-charts/seldon-core-crd/templates/spartakus-rbac.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{{- if .Values.usage_metrics.enabled }}
{
"apiVersion": "v1",
"items": [
{
"apiVersion": "v1",
"kind": "ServiceAccount",
"metadata": {
"name": "seldon-spartakus-volunteer",
"namespace": "kube-system"
}
},
{
"apiVersion": "rbac.authorization.k8s.io/v1beta1",
"kind": "ClusterRole",
"metadata": {
"name": "seldon-spartakus-volunteer"
},
"rules": [
{
"apiGroups": [
""
],
"resources": [
"nodes"
],
"verbs": [
"list"
]
}
]
},
{
"apiVersion": "rbac.authorization.k8s.io/v1beta1",
"kind": "ClusterRoleBinding",
"metadata": {
"name": "seldon-spartakus-volunteer"
},
"roleRef": {
"apiGroup": "rbac.authorization.k8s.io",
"kind": "ClusterRole",
"name": "seldon-spartakus-volunteer"
},
"subjects": [
{
"kind": "ServiceAccount",
"name": "seldon-spartakus-volunteer",
"namespace": "kube-system"
}
]
}
],
"kind": "List",
"metadata": {}
}
{{- end }}

Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{{- if .Values.usage_metrics.enabled }}
{
"apiVersion": "extensions/v1beta1",
"kind": "Deployment",
"metadata": {
"name": "seldon-spartakus-volunteer",
"namespace": "kube-system"
},
"spec": {
"replicas": 1,
"template": {
"metadata": {
"labels": {
"app": "seldon-spartakus-volunteer"
}
},
"spec": {
"containers": [
{
"args": [
"volunteer",
"--cluster-id=$(SPARTAKUS_VOLUNTEER_CLUSTERID)",
"--database=$(SPARTAKUS_VOLUNTEER_DATABASE)",
"--extensions=/etc/config/spartakus.volunteer.extensions"
],
"env": [
{
"name": "SPARTAKUS_VOLUNTEER_CLUSTERID",
"valueFrom": {
"configMapKeyRef": {
"key": "spartakus.volunteer.clusterid",
"name": "seldon-spartakus-config"
}
}
},
{
"name": "SPARTAKUS_VOLUNTEER_DATABASE",
"valueFrom": {
"configMapKeyRef": {
"key": "spartakus.volunteer.database",
"name": "seldon-spartakus-config"
}
}
}
],
"image": "gcr.io/google_containers/spartakus-amd64:v1.1.0",
"name": "seldon-spartakus-volunteer",
"volumeMounts": [
{
"mountPath": "/etc/config",
"name": "seldon-spartakus-config-volume"
}
]
}
],
"serviceAccountName": "seldon-spartakus-volunteer",
"volumes": [
{
"configMap": {
"name": "seldon-spartakus-config"
},
"name": "seldon-spartakus-config-volume"
}
]
}
}
}
}
{{- end }}

4 changes: 4 additions & 0 deletions helm-charts/seldon-core-crd/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
usage_metrics:
enabled: false
database: http://seldon-core-stats.seldon.io

Loading

0 comments on commit 5b26ede

Please sign in to comment.