Skip to content
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

feat(telemetry): replace GA with matomo #4140

Merged
merged 22 commits into from
Aug 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f29cb7e
feat(core/telemetry): add posthog
deviantony Jul 28, 2020
3d69d44
feat(core/telemetry): add posthog
deviantony Jul 28, 2020
d487dbd
feat(core/telemetry): add matomo
deviantony Jul 28, 2020
a8572d9
feat(core/telemetry): update matomo
deviantony Jul 28, 2020
9ff3464
feat(core/telemetry): update matomo
deviantony Jul 29, 2020
26ebbc4
feat(core/telemetry): update matomo
deviantony Jul 30, 2020
abbcd64
feat(telemetry): remove google analytics code
chiptus Aug 1, 2020
eef4d02
refactor(telemetry): move matomo code to bundle
chiptus Aug 1, 2020
c195191
refactor(telemetry): move matomo lib to assets
chiptus Aug 1, 2020
5131a8a
refactor(telemetry): depreciate --no-analytics
chiptus Aug 1, 2020
33556ad
feat(settings): introduce a setting to enable telemetry
chiptus Aug 1, 2020
ae82d19
fix(cli): fix typo
chiptus Aug 1, 2020
05efa21
feat(settings): allow toggle telemetry from settings
chiptus Aug 1, 2020
330391e
fix(settings): handle case where AuthenticationMethod is missing
chiptus Aug 1, 2020
31e7fa8
feat(admin): set telemetry on admin init
chiptus Aug 1, 2020
4ef559b
refactor(app); revert file
chiptus Aug 1, 2020
70d8154
refactor(state-manager): move optout to state manager
chiptus Aug 1, 2020
bcbcb33
feat(telemetry): set matomo url
chiptus Aug 1, 2020
8c1b453
feat(core/settings): minor UI update
deviantony Aug 3, 2020
e32f1b0
feat(core/telemetry): update custom URL
deviantony Aug 3, 2020
ac0ffcd
feat(core/telemetry): add placeholder for privacy policy
deviantony Aug 5, 2020
6941b5e
feat(core/telemetry): add privacy policy link
deviantony Aug 5, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ env:

globals:
angular: true
__CONFIG_GA_ID: true

extends:
- 'eslint:recommended'
Expand Down
1 change: 1 addition & 0 deletions api/bolt/migrator/migrate_dbversion24.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ func (m *Migrator) updateSettingsToDB25() error {
}

legacySettings.UserSessionTimeout = portainer.DefaultUserSessionTimeout
legacySettings.EnableTelemetry = true

legacySettings.AllowContainerCapabilitiesForRegularUsers = true

Expand Down
7 changes: 5 additions & 2 deletions api/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cli

import (
"errors"
"log"
"time"

"github.com/portainer/portainer/api"
Expand Down Expand Up @@ -35,7 +36,7 @@ func (*Service) ParseFlags(version string) (*portainer.CLIFlags, error) {
Data: kingpin.Flag("data", "Path to the folder where the data is stored").Default(defaultDataDirectory).Short('d').String(),
EndpointURL: kingpin.Flag("host", "Endpoint URL").Short('H').String(),
EnableEdgeComputeFeatures: kingpin.Flag("edge-compute", "Enable Edge Compute features").Bool(),
NoAnalytics: kingpin.Flag("no-analytics", "Disable Analytics in app").Default(defaultNoAnalytics).Bool(),
NoAnalytics: kingpin.Flag("no-analytics", "Disable Analytics in app (deprecated)").Default(defaultNoAnalytics).Bool(),
TLS: kingpin.Flag("tlsverify", "TLS support").Default(defaultTLS).Bool(),
TLSSkipVerify: kingpin.Flag("tlsskipverify", "Disable TLS server verification").Default(defaultTLSSkipVerify).Bool(),
TLSCacert: kingpin.Flag("tlscacert", "Path to the CA").Default(defaultTLSCACertPath).String(),
Expand Down Expand Up @@ -88,7 +89,9 @@ func (*Service) ValidateFlags(flags *portainer.CLIFlags) error {
}

func displayDeprecationWarnings(flags *portainer.CLIFlags) {

if flags.NoAnalytics != nil {
log.Println("Warning: The --no-analytics has been deprecated and will be removed in a future version of Portainer. It currently has no effect, telemetry settings are available in the Portainer settings.")
}
}

func validateEndpointURL(endpointURL string) error {
Expand Down
4 changes: 2 additions & 2 deletions api/cmd/portainer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ func loadEdgeJobsFromDatabase(dataStore portainer.DataStore, reverseTunnelServic

func initStatus(flags *portainer.CLIFlags) *portainer.Status {
return &portainer.Status{
Analytics: !*flags.NoAnalytics,
Version: portainer.APIVersion,
Version: portainer.APIVersion,
}
}

Expand All @@ -168,6 +167,7 @@ func updateSettingsFromFlags(dataStore portainer.DataStore, flags *portainer.CLI
settings.LogoURL = *flags.Logo
settings.SnapshotInterval = *flags.SnapshotInterval
settings.EnableEdgeComputeFeatures = *flags.EnableEdgeComputeFeatures
settings.EnableTelemetry = true

if *flags.Templates != "" {
settings.TemplatesURL = *flags.Templates
Expand Down
2 changes: 2 additions & 0 deletions api/http/handler/settings/settings_public.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type publicSettingsResponse struct {
EnableHostManagementFeatures bool `json:"EnableHostManagementFeatures"`
EnableEdgeComputeFeatures bool `json:"EnableEdgeComputeFeatures"`
OAuthLoginURI string `json:"OAuthLoginURI"`
EnableTelemetry bool `json:"EnableTelemetry"`
}

// GET request on /api/settings/public
Expand All @@ -43,6 +44,7 @@ func (handler *Handler) settingsPublic(w http.ResponseWriter, r *http.Request) *
AllowContainerCapabilitiesForRegularUsers: settings.AllowContainerCapabilitiesForRegularUsers,
EnableHostManagementFeatures: settings.EnableHostManagementFeatures,
EnableEdgeComputeFeatures: settings.EnableEdgeComputeFeatures,
EnableTelemetry: settings.EnableTelemetry,
OAuthLoginURI: fmt.Sprintf("%s?response_type=code&client_id=%s&redirect_uri=%s&scope=%s&prompt=login",
settings.OAuthSettings.AuthorizationURI,
settings.OAuthSettings.ClientID,
Expand Down
7 changes: 6 additions & 1 deletion api/http/handler/settings/settings_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ type settingsUpdatePayload struct {
EdgeAgentCheckinInterval *int
EnableEdgeComputeFeatures *bool
UserSessionTimeout *string
EnableTelemetry *bool
}

func (payload *settingsUpdatePayload) Validate(r *http.Request) error {
if *payload.AuthenticationMethod != 1 && *payload.AuthenticationMethod != 2 && *payload.AuthenticationMethod != 3 {
if payload.AuthenticationMethod != nil && *payload.AuthenticationMethod != 1 && *payload.AuthenticationMethod != 2 && *payload.AuthenticationMethod != 3 {
return errors.New("Invalid authentication method value. Value must be one of: 1 (internal), 2 (LDAP/AD) or 3 (OAuth)")
}
if payload.LogoURL != nil && *payload.LogoURL != "" && !govalidator.IsURL(*payload.LogoURL) {
Expand Down Expand Up @@ -164,6 +165,10 @@ func (handler *Handler) settingsUpdate(w http.ResponseWriter, r *http.Request) *
settings.AllowDeviceMappingForRegularUsers = *payload.AllowDeviceMappingForRegularUsers
}

if payload.EnableTelemetry != nil {
settings.EnableTelemetry = *payload.EnableTelemetry
}

tlsError := handler.updateTLS(settings)
if tlsError != nil {
return tlsError
Expand Down
4 changes: 2 additions & 2 deletions api/portainer.go
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ type (
EdgeAgentCheckinInterval int `json:"EdgeAgentCheckinInterval"`
EnableEdgeComputeFeatures bool `json:"EnableEdgeComputeFeatures"`
UserSessionTimeout string `json:"UserSessionTimeout"`
EnableTelemetry bool `json:"EnableTelemetry"`

// Deprecated fields
DisplayDonationHeader bool
Expand Down Expand Up @@ -566,8 +567,7 @@ type (

// Status represents the application status
Status struct {
Analytics bool `json:"Analytics"`
Version string `json:"Version"`
Version string `json:"Version"`
}

// Tag represents a tag that can be associated to a resource
Expand Down