Skip to content

Commit

Permalink
Expose telemetry & crash reporting in helm (#493)
Browse files Browse the repository at this point in the history
* expose telemetry & crash reporting in helm

* address feedback
  • Loading branch information
jmorganca authored Oct 20, 2021
1 parent 4690827 commit 287f0ec
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
15 changes: 14 additions & 1 deletion helm/charts/registry/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,20 @@ spec:
- name: registry
image: {{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args: ["registry", "-c", "/var/run/infra/config/infra.yaml", "--db", "/var/run/infra/data/infra.db", "--tls-cache", "/var/run/infra/data/cache"]
args:
- "registry"
- "-c"
- "/var/run/infra/config/infra.yaml"
- "--db"
- "/var/run/infra/data/infra.db"
- "--tls-cache"
- "/var/run/infra/data/cache"
{{- if .Values.telemetry.enabled }}
- "--enable-telemetry"
{{ end }}
{{- if .Values.crashReporting.enabled }}
- "--enable-crash-reporting"
{{ end }}
env:
- name: INFRA_REGISTRY_ROOT_API_KEY
valueFrom:
Expand Down
6 changes: 6 additions & 0 deletions helm/charts/registry/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ config: null
pod:
annotations: {}

telemetry:
enabled: true

crashReporting:
enabled: true

serviceAccount:
create: true
annotations: {}
Expand Down
4 changes: 3 additions & 1 deletion internal/registry/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ func NewTelemetry(db *gorm.DB) (*Telemetry, error) {
return nil, errors.New("db cannot be nil")
}

enabled := internal.TelemetryWriteKey != ""

return &Telemetry{
enabled: true,
enabled: enabled,
client: analytics.New(internal.TelemetryWriteKey),
db: db,
}, nil
Expand Down

0 comments on commit 287f0ec

Please sign in to comment.