Skip to content

Commit 77eea75

Browse files
Pantanimergify[bot]
authored andcommitted
feat: migrate to matomo analytics (#4095)
* add matomo anlytics * matomo url * add changelog * matomo analytics refacor * build analytics url * fix matomo request parameters * remove unused parameters and improve readability * remove unused matomo request response parser * fix analytics data * change the source name to github * fix UTM values * fix scaffold type condition * remove gacli pkg --------- Co-authored-by: Pantani <Pantani> (cherry picked from commit e49e11d) # Conflicts: # ignite/internal/analytics/analytics.go # ignite/pkg/gacli/gacli.go
1 parent 726d376 commit 77eea75

File tree

6 files changed

+440
-72
lines changed

6 files changed

+440
-72
lines changed

Diff for: changelog.md

+20
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,26 @@
22

33
## Unreleased
44

5+
### Features
6+
7+
- [#3707](https://github.com/ignite/cli/pull/3707) and [#4094](https://github.com/ignite/cli/pull/4094) Add collections support.
8+
- [#3977](https://github.com/ignite/cli/pull/3977) Add `chain lint` command to lint the chain's codebase using `golangci-lint`
9+
- [#3770](https://github.com/ignite/cli/pull/3770) Add `scaffold configs` and `scaffold params` commands
10+
- [#4001](https://github.com/ignite/cli/pull/4001) Improve `xgenny` dry run
11+
- [#3967](https://github.com/ignite/cli/issues/3967) Add HD wallet parameters `address index` and `account number` to the chain account config
12+
- [#4004](https://github.com/ignite/cli/pull/4004) Remove all import placeholders using the `xast` pkg
13+
- [#4076](https://github.com/ignite/cli/pull/4076) Remove the ignite `relayer` and `tools` commands with all ts-relayer logic
14+
- [#4071](https://github.com/ignite/cli/pull/4071) Support custom proto path
15+
- [#3718](https://github.com/ignite/cli/pull/3718) Add `gen-mig-diffs` tool app to compare scaffold output of two versions of ignite
16+
- [#4077](https://github.com/ignite/cli/pull/4077) Merge the swagger files manually instead use nodetime `swagger-combine`
17+
- [#4090](https://github.com/ignite/cli/pull/4090) Remove `protoc` pkg and also nodetime helpers `ts-proto` and `sta`
18+
- [#4100](https://github.com/ignite/cli/pull/4100) Set the `proto-dir` flag only for the `scaffold chain` command and use the proto path from the config
19+
- [#4111](https://github.com/ignite/cli/pull/4111) Remove vuex generation
20+
- [#4133](https://github.com/ignite/cli/pull/4133) Improve buf rate limit
21+
- [#4113](https://github.com/ignite/cli/pull/4113) Generate chain config documentation automatically
22+
- [#4131](https://github.com/ignite/cli/pull/4131) Support `bytes` as data type in the `scaffold` commands
23+
- [#4095](https://github.com/ignite/cli/pull/4095) Migrate to matomo analytics
24+
525
### Changes
626

727
- [#4149](https://github.com/ignite/cli/pull/4149) Bump cometbft to `v0.38.7`

Diff for: ignite/cmd/version.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,13 @@ func NewVersion() *cobra.Command {
1111
c := &cobra.Command{
1212
Use: "version",
1313
Short: "Print the current build information",
14-
Run: func(cmd *cobra.Command, _ []string) {
15-
cmd.Println(version.Long(cmd.Context()))
14+
RunE: func(cmd *cobra.Command, _ []string) error {
15+
v, err := version.Long(cmd.Context())
16+
if err != nil {
17+
return err
18+
}
19+
cmd.Println(v)
20+
return nil
1621
},
1722
}
1823
return c

Diff for: ignite/internal/analytics/analytics.go

+52-17
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,41 @@
11
package analytics
22

33
import (
4+
"context"
45
"encoding/json"
56
"os"
67
"path/filepath"
7-
"runtime"
88
"strconv"
99
"strings"
1010
"sync"
1111

1212
"github.com/manifoldco/promptui"
1313
"github.com/spf13/cobra"
1414

15+
<<<<<<< HEAD
1516
"github.com/ignite/cli/v28/ignite/pkg/gacli"
1617
"github.com/ignite/cli/v28/ignite/pkg/gitpod"
1718
"github.com/ignite/cli/v28/ignite/pkg/randstr"
1819
"github.com/ignite/cli/v28/ignite/version"
20+
=======
21+
"github.com/ignite/cli/v29/ignite/config"
22+
"github.com/ignite/cli/v29/ignite/pkg/gitpod"
23+
"github.com/ignite/cli/v29/ignite/pkg/matomo"
24+
"github.com/ignite/cli/v29/ignite/pkg/randstr"
25+
"github.com/ignite/cli/v29/ignite/version"
26+
>>>>>>> e49e11df (feat: migrate to matomo analytics (#4095))
1927
)
2028

2129
const (
22-
telemetryEndpoint = "https://telemetry-cli.ignite.com"
30+
telemetryEndpoint = "https://matomo-cli.ignite.com"
2331
envDoNotTrack = "DO_NOT_TRACK"
2432
envCI = "CI"
2533
envGitHubActions = "GITHUB_ACTIONS"
2634
igniteDir = ".ignite"
2735
igniteAnonIdentity = "anon_identity.json"
2836
)
2937

30-
var gaclient gacli.Client
38+
var matomoClient matomo.Client
3139

3240
// anonIdentity represents an analytics identity file.
3341
type anonIdentity struct {
@@ -38,7 +46,11 @@ type anonIdentity struct {
3846
}
3947

4048
func init() {
41-
gaclient = gacli.New(telemetryEndpoint)
49+
matomoClient = matomo.New(
50+
telemetryEndpoint,
51+
matomo.WithIDSite(4),
52+
matomo.WithSource("https://cli.ignite.com"),
53+
)
4254
}
4355

4456
// SendMetric send command metrics to analytics.
@@ -52,23 +64,46 @@ func SendMetric(wg *sync.WaitGroup, cmd *cobra.Command) {
5264
return
5365
}
5466

55-
path := cmd.CommandPath()
56-
met := gacli.Metric{
57-
Name: cmd.Name(),
58-
Cmd: path,
59-
Tag: strings.ReplaceAll(path, " ", "+"),
60-
OS: runtime.GOOS,
61-
Arch: runtime.GOARCH,
62-
SessionID: dntInfo.Name,
63-
Version: version.Version,
64-
IsGitPod: gitpod.IsOnGitpod(),
65-
IsCI: getIsCI(),
67+
versionInfo, err := version.GetInfo(context.Background())
68+
if err != nil {
69+
return
70+
}
71+
72+
var (
73+
path = cmd.CommandPath()
74+
scaffoldType = ""
75+
)
76+
if strings.Contains(path, "ignite scaffold") {
77+
splitCMD := strings.Split(path, " ")
78+
if len(splitCMD) > 2 {
79+
scaffoldType = splitCMD[2]
80+
}
81+
}
82+
83+
met := matomo.Metric{
84+
Name: cmd.Name(),
85+
Cmd: path,
86+
ScaffoldType: scaffoldType,
87+
OS: versionInfo.OS,
88+
Arch: versionInfo.Arch,
89+
Version: versionInfo.CLIVersion,
90+
CLIVersion: versionInfo.CLIVersion,
91+
GoVersion: versionInfo.GoVersion,
92+
SDKVersion: versionInfo.SDKVersion,
93+
BuildDate: versionInfo.BuildDate,
94+
SourceHash: versionInfo.SourceHash,
95+
ConfigVersion: versionInfo.ConfigVersion,
96+
Uname: versionInfo.Uname,
97+
CWD: versionInfo.CWD,
98+
BuildFromSource: versionInfo.BuildFromSource,
99+
IsGitPod: gitpod.IsOnGitpod(),
100+
IsCI: getIsCI(),
66101
}
67102

68103
wg.Add(1)
69104
go func() {
70105
defer wg.Done()
71-
_ = gaclient.SendMetric(met)
106+
_ = matomoClient.SendMetric(dntInfo.Name, met)
72107
}()
73108
}
74109

@@ -97,7 +132,7 @@ func checkDNT() (anonIdentity, error) {
97132
return i, nil
98133
}
99134

100-
i.Name = randstr.Runes(10)
135+
i.Name = randstr.Runes(16)
101136
i.DoNotTrack = false
102137

103138
prompt := promptui.Select{

Diff for: ignite/pkg/gacli/doc.go

-2
This file was deleted.

0 commit comments

Comments
 (0)