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(compute): add metadata subcommand #1013

Merged
merged 19 commits into from
Oct 31, 2023
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
492021f
feat(telemetry): add telemetry command
Integralist Sep 18, 2023
a3868f1
refactor(telemetry): enable by default
Integralist Sep 20, 2023
38d64bc
doc(DEVELOP): clarify the app config flows
Integralist Sep 21, 2023
ac7293e
doc(config): annotate File fields
Integralist Sep 21, 2023
e241978
feat: display telemetry to user on first run after install or update
Integralist Sep 21, 2023
3c632e1
fix(ci): add /dev/null equivalent for Windows
Integralist Sep 21, 2023
c0586e0
refactor: rename telemetry wasm-metadata
Integralist Sep 26, 2023
8d6673f
refactor: move `telemetry` command to `compute metadata`
Integralist Sep 26, 2023
58c96f4
refactor(compute/metadata): display updated config settings
Integralist Oct 2, 2023
849e7db
fix(metadata): machine info must be opt-in
Integralist Oct 5, 2023
cc4d645
fix(compute/metadata): reference correct error type
Integralist Oct 10, 2023
7551b2d
remove(telemetry): command moved to compute metadata.
Integralist Oct 25, 2023
9f5b4dd
fix(compute/build): remove unused arg
Integralist Oct 31, 2023
265cc0f
fix(app): update commandCollectsData() list
Integralist Oct 31, 2023
fc49e5b
feat: only record metadata for items marked as enabled
Integralist Oct 31, 2023
4afd2ee
fix(app): hide metadata message unless the user has opted into data c…
Integralist Oct 31, 2023
3705675
refactor: messaging to include additional links
Integralist Oct 31, 2023
00feb73
refactor(compute/metadata): make a hidden command for now
Integralist Oct 31, 2023
e35ebba
refactor: move sdk data into package_info
Integralist Oct 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: rename telemetry wasm-metadata
Integralist committed Oct 31, 2023

Verified

This commit was signed with the committer’s verified signature. The key has expired.
Integralist Mark McDonnell
commit c0586e0dd7405a782518039b41b562caf98bafe4
20 changes: 10 additions & 10 deletions pkg/commands/telemetry/root.go
Original file line number Diff line number Diff line change
@@ -48,10 +48,10 @@ func (c *RootCommand) Exec(_ io.Reader, out io.Writer) error {
return fsterr.ErrInvalidEnableDisableFlagCombo
}
if c.disable {
c.Globals.Config.Telemetry = toggleAll("disable")
c.Globals.Config.WasmMetadata = toggleAll("disable")
}
if c.enable {
c.Globals.Config.Telemetry = toggleAll("enable")
c.Globals.Config.WasmMetadata = toggleAll("enable")
}
if c.disable && (c.enableBuild || c.enableMachine || c.enablePackage) {
text.Info(out, "We will disable all telemetry except for the specified `--enable-*` flags")
@@ -62,22 +62,22 @@ func (c *RootCommand) Exec(_ io.Reader, out io.Writer) error {
text.Break(out)
}
if c.enableBuild {
c.Globals.Config.Telemetry.BuildInfo = "enable"
c.Globals.Config.WasmMetadata.BuildInfo = "enable"
}
if c.enableMachine {
c.Globals.Config.Telemetry.MachineInfo = "enable"
c.Globals.Config.WasmMetadata.MachineInfo = "enable"
}
if c.enablePackage {
c.Globals.Config.Telemetry.PackageInfo = "enable"
c.Globals.Config.WasmMetadata.PackageInfo = "enable"
}
if c.disableBuild {
c.Globals.Config.Telemetry.BuildInfo = "disable"
c.Globals.Config.WasmMetadata.BuildInfo = "disable"
}
if c.disableMachine {
c.Globals.Config.Telemetry.MachineInfo = "disable"
c.Globals.Config.WasmMetadata.MachineInfo = "disable"
}
if c.disablePackage {
c.Globals.Config.Telemetry.PackageInfo = "disable"
c.Globals.Config.WasmMetadata.PackageInfo = "disable"
}
err := c.Globals.Config.Write(c.Globals.ConfigPath)
if err != nil {
@@ -87,8 +87,8 @@ func (c *RootCommand) Exec(_ io.Reader, out io.Writer) error {
return nil
}

func toggleAll(state string) config.Telemetry {
var t config.Telemetry
func toggleAll(state string) config.WasmMetadata {
var t config.WasmMetadata
t.BuildInfo = state
t.MachineInfo = state
t.PackageInfo = state
22 changes: 11 additions & 11 deletions pkg/commands/telemetry/telemetry_test.go
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ import (
type Scenario struct {
testutil.TestScenario

ExpectedConfig config.Telemetry
ExpectedConfig config.WasmMetadata
}

func TestTelemetry(t *testing.T) {
@@ -69,7 +69,7 @@ func TestTelemetry(t *testing.T) {
Args: args("telemetry --enable"),
WantOutput: "SUCCESS: configuration updated (see: `fastly config`)",
},
ExpectedConfig: config.Telemetry{
ExpectedConfig: config.WasmMetadata{
BuildInfo: "enable",
MachineInfo: "enable",
PackageInfo: "enable",
@@ -80,7 +80,7 @@ func TestTelemetry(t *testing.T) {
Args: args("telemetry --disable"),
WantOutput: "SUCCESS: configuration updated (see: `fastly config`)",
},
ExpectedConfig: config.Telemetry{
ExpectedConfig: config.WasmMetadata{
BuildInfo: "disable",
MachineInfo: "disable",
PackageInfo: "disable",
@@ -94,7 +94,7 @@ func TestTelemetry(t *testing.T) {
"SUCCESS: configuration updated (see: `fastly config`)",
},
},
ExpectedConfig: config.Telemetry{
ExpectedConfig: config.WasmMetadata{
BuildInfo: "disable",
MachineInfo: "enable",
PackageInfo: "enable",
@@ -108,7 +108,7 @@ func TestTelemetry(t *testing.T) {
"SUCCESS: configuration updated (see: `fastly config`)",
},
},
ExpectedConfig: config.Telemetry{
ExpectedConfig: config.WasmMetadata{
BuildInfo: "disable",
MachineInfo: "enable",
PackageInfo: "disable",
@@ -162,14 +162,14 @@ func TestTelemetry(t *testing.T) {
t.Error(err)
}

if opts.ConfigFile.Telemetry.BuildInfo != testcase.ExpectedConfig.BuildInfo {
t.Errorf("want: %s, got: %s", testcase.ExpectedConfig.BuildInfo, opts.ConfigFile.Telemetry.BuildInfo)
if opts.ConfigFile.WasmMetadata.BuildInfo != testcase.ExpectedConfig.BuildInfo {
t.Errorf("want: %s, got: %s", testcase.ExpectedConfig.BuildInfo, opts.ConfigFile.WasmMetadata.BuildInfo)
}
if opts.ConfigFile.Telemetry.MachineInfo != testcase.ExpectedConfig.MachineInfo {
t.Errorf("want: %s, got: %s", testcase.ExpectedConfig.MachineInfo, opts.ConfigFile.Telemetry.MachineInfo)
if opts.ConfigFile.WasmMetadata.MachineInfo != testcase.ExpectedConfig.MachineInfo {
t.Errorf("want: %s, got: %s", testcase.ExpectedConfig.MachineInfo, opts.ConfigFile.WasmMetadata.MachineInfo)
}
if opts.ConfigFile.Telemetry.PackageInfo != testcase.ExpectedConfig.PackageInfo {
t.Errorf("want: %s, got: %s", testcase.ExpectedConfig.PackageInfo, opts.ConfigFile.Telemetry.PackageInfo)
if opts.ConfigFile.WasmMetadata.PackageInfo != testcase.ExpectedConfig.PackageInfo {
t.Errorf("want: %s, got: %s", testcase.ExpectedConfig.PackageInfo, opts.ConfigFile.WasmMetadata.PackageInfo)
}
})
}
2 changes: 1 addition & 1 deletion pkg/commands/telemetry/testdata/config.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[telemetry]
[wasm-metadata]
build_info = "disable"
machine_info = "disable"
package_info = "disable"
8 changes: 4 additions & 4 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
@@ -62,8 +62,8 @@ type Fastly struct {
APIEndpoint string `toml:"api_endpoint"`
}

// Telemetry represents what telemetry data will be recorded.
type Telemetry struct {
// WasmMetadata represents what telemetry data will be recorded.
type WasmMetadata struct {
// BuildInfo represents information regarding the time taken for builds and
// compilation processes, helping us identify bottlenecks and optimize
// performance (enable/disable).
@@ -176,8 +176,6 @@ type File struct {
ConfigVersion int `toml:"config_version"`
// Fastly represents fastly specific configuration.
Fastly Fastly `toml:"fastly"`
// Telemetry represents what telemetry data will be recorded.
Telemetry Telemetry `toml:"telemetry"`
// Language represents C@E language specific configuration.
Language Language `toml:"language"`
// Profiles represents multiple profile accounts.
@@ -186,6 +184,8 @@ type File struct {
StarterKits StarterKitLanguages `toml:"starter-kits"`
// Viceroy represents viceroy specific configuration.
Viceroy Versioner `toml:"viceroy"`
// WasmMetadata represents what metadata will be collected.
WasmMetadata WasmMetadata `toml:"wasm-metadata"`
// WasmTools represents wasm-tools specific configuration.
WasmTools Versioner `toml:"wasm-tools"`