Skip to content

Commit 6cc170f

Browse files
authored
Merge branch 'ignite:main' into add-feeabs
2 parents a91a898 + ff7ce85 commit 6cc170f

File tree

12 files changed

+454
-234
lines changed

12 files changed

+454
-234
lines changed

changelog.md

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
- [#4133](https://github.com/ignite/cli/pull/4133) Improve buf rate limit
2121
- [#4113](https://github.com/ignite/cli/pull/4113) Generate chain config documentation automatically
2222
- [#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+
- [#4183](https://github.com/ignite/cli/pull/4183) Set `chain-id` in the client.toml
2325

2426
### Changes
2527

@@ -45,6 +47,7 @@
4547
- [#4000](https://github.com/ignite/cli/pull/4000) Run all dry runners before the wet run in the `xgenny` pkg
4648
- [#4091](https://github.com/ignite/cli/pull/4091) Fix race conditions in the plugin logic
4749
- [#4128](https://github.com/ignite/cli/pull/4128) Check for duplicate proto fields in config
50+
- [#4184](https://github.com/ignite/cli/pull/4184) Set custom `InitChainer` because of manually registered modules
4851

4952
## [`v28.4.0`](https://github.com/ignite/cli/releases/tag/v28.4.0)
5053

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

ignite/internal/analytics/analytics.go

+45-18
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package analytics
22

33
import (
4+
"context"
45
"encoding/json"
56
"os"
67
"path/filepath"
7-
"runtime"
88
"strconv"
99
"strings"
1010
"sync"
@@ -13,21 +13,21 @@ import (
1313
"github.com/spf13/cobra"
1414

1515
"github.com/ignite/cli/v29/ignite/config"
16-
"github.com/ignite/cli/v29/ignite/pkg/gacli"
1716
"github.com/ignite/cli/v29/ignite/pkg/gitpod"
17+
"github.com/ignite/cli/v29/ignite/pkg/matomo"
1818
"github.com/ignite/cli/v29/ignite/pkg/randstr"
1919
"github.com/ignite/cli/v29/ignite/version"
2020
)
2121

2222
const (
23-
telemetryEndpoint = "https://telemetry-cli.ignite.com"
23+
telemetryEndpoint = "https://matomo-cli.ignite.com"
2424
envDoNotTrack = "DO_NOT_TRACK"
2525
envCI = "CI"
2626
envGitHubActions = "GITHUB_ACTIONS"
2727
igniteAnonIdentity = "anon_identity.json"
2828
)
2929

30-
var gaclient gacli.Client
30+
var matomoClient matomo.Client
3131

3232
// anonIdentity represents an analytics identity file.
3333
type anonIdentity struct {
@@ -38,7 +38,11 @@ type anonIdentity struct {
3838
}
3939

4040
func init() {
41-
gaclient = gacli.New(telemetryEndpoint)
41+
matomoClient = matomo.New(
42+
telemetryEndpoint,
43+
matomo.WithIDSite(4),
44+
matomo.WithSource("https://cli.ignite.com"),
45+
)
4246
}
4347

4448
// SendMetric send command metrics to analytics.
@@ -52,23 +56,46 @@ func SendMetric(wg *sync.WaitGroup, cmd *cobra.Command) {
5256
return
5357
}
5458

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(),
59+
versionInfo, err := version.GetInfo(context.Background())
60+
if err != nil {
61+
return
62+
}
63+
64+
var (
65+
path = cmd.CommandPath()
66+
scaffoldType = ""
67+
)
68+
if strings.Contains(path, "ignite scaffold") {
69+
splitCMD := strings.Split(path, " ")
70+
if len(splitCMD) > 2 {
71+
scaffoldType = splitCMD[2]
72+
}
73+
}
74+
75+
met := matomo.Metric{
76+
Name: cmd.Name(),
77+
Cmd: path,
78+
ScaffoldType: scaffoldType,
79+
OS: versionInfo.OS,
80+
Arch: versionInfo.Arch,
81+
Version: versionInfo.CLIVersion,
82+
CLIVersion: versionInfo.CLIVersion,
83+
GoVersion: versionInfo.GoVersion,
84+
SDKVersion: versionInfo.SDKVersion,
85+
BuildDate: versionInfo.BuildDate,
86+
SourceHash: versionInfo.SourceHash,
87+
ConfigVersion: versionInfo.ConfigVersion,
88+
Uname: versionInfo.Uname,
89+
CWD: versionInfo.CWD,
90+
BuildFromSource: versionInfo.BuildFromSource,
91+
IsGitPod: gitpod.IsOnGitpod(),
92+
IsCI: getIsCI(),
6693
}
6794

6895
wg.Add(1)
6996
go func() {
7097
defer wg.Done()
71-
_ = gaclient.SendMetric(met)
98+
_ = matomoClient.SendMetric(dntInfo.Name, met)
7299
}()
73100
}
74101

@@ -98,7 +125,7 @@ func checkDNT() (anonIdentity, error) {
98125
return i, nil
99126
}
100127

101-
i.Name = randstr.Runes(10)
128+
i.Name = randstr.Runes(16)
102129
i.DoNotTrack = false
103130

104131
prompt := promptui.Select{

ignite/pkg/gacli/doc.go

-2
This file was deleted.

ignite/pkg/gacli/gacli.go

-125
This file was deleted.

0 commit comments

Comments
 (0)