Skip to content

Commit

Permalink
feat: add telemetry support (#136)
Browse files Browse the repository at this point in the history
* feat(telemetry): add telemetry for CLI metrics

* feat(telemetry): opt-in handler, better error handling and telemetry usage

* feat(telemetry): add reporting for errors

* refactor(telemetry): reduce duplicated code, add comments, and general refactoring -- incomplete checkpoint

* refactor(telemetry): refactor new parachain, and telemetry handling

* fix(telemetry): fix error telemetry reporting

* test(telemetry): unit tests for telemetry

* fix(telemetry): borrowing issue with multi-threads

* refactor(telemetry): handle tel_data better

* feat(telemetry): add no_telemetry feature flag to disable telemetry

* chore: use edition.workspace in toml files

* chore: miscallaneous cleanups, documentation, and refactoring

* refactor(telemetry): change opt-in to opt-out

* chore: cleanup whitespace and comments

* refactor: improve feature (#145)

* test: ensure errors propagated (#143)

* test: relocate integration tests (#144)

* test: relocate integration tests

* ci: reduce run time

* refactor: remove unused import

* refactor: improve feature isolation

* refactor: remove unnecessary path prefixes

* refactor: invert feature

Using `--features=no_telemetry` still resulted in inclusion of pop-telemetry in the dependency tree. Using `telemetry` also makes conditional compilation much simpler.

* chore(telemetry): update endpoint and website-id

* refactor(telemetry): default values in `Telemetry::new` with helper `init`

* chore(telemetry): resolve regressions

---------

Co-authored-by: Frank Bell <[email protected]>
Co-authored-by: Bruno Galvao <[email protected]>
Co-authored-by: AlexD10S <[email protected]>
  • Loading branch information
4 people authored May 11, 2024
1 parent 141ccfe commit 0999d65
Show file tree
Hide file tree
Showing 16 changed files with 605 additions and 91 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@
**/node_modules/
/src/x.rs

.DS_Store
.DS_Store

# IDEs
.idea
.vscode
85 changes: 85 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,22 @@ codegen-units = 1
resolver = "2"
members = ["crates/*"]

[workspace.package]
edition = "2021"

[workspace.dependencies]
anyhow = "1.0"
thiserror = "1.0.58"
dirs = "5.0"
env_logger = "0.11.1"
duct = "0.13"
git2 = "0.18"
log = "0.4.20"
mockito = "1.4.0"
tempfile = "3.8"
thiserror = "1.0.58"

# networking
reqwest = { version = "0.11", features = ["json"] }
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }
url = { version = "2.5" }

Expand All @@ -37,7 +47,6 @@ walkdir = "2.4"
indexmap = { version = "2.2" }
toml_edit = { version = "0.22", features = ["serde"] }
symlink = { version = "0.1" }
reqwest = { version = "0.11" }
serde_json = { version = "1.0" }
serde = { version = "1.0", features = ["derive"] }
zombienet-sdk = { git = "https://github.com/r0gue-io/zombienet-sdk", branch = "pop" }
Expand Down
17 changes: 12 additions & 5 deletions crates/pop-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "pop-cli"
description = "An all-in-one tool for Polkadot development."
version = "0.1.0"
edition = "2021"
edition.workspace = true

[[bin]]
name = "pop"
Expand All @@ -11,11 +11,14 @@ path = "src/main.rs"
[dependencies]
anyhow.workspace = true
duct.workspace = true
env_logger.workspace = true
os_info.workspace = true
reqwest.workspace = true
serde.workspace = true
serde_json.workspace = true
tempfile.workspace = true
url.workspace = true
tokio.workspace = true
reqwest.workspace = true
os_info.workspace = true
url.workspace = true

# pop-cli
clap.workspace = true
Expand All @@ -34,12 +37,15 @@ pop-parachains = { path = "../pop-parachains", optional = true }
dirs = { version = "5.0", optional = true }
git2 = { workspace = true, features = ["vendored-openssl"] }

# telemetry
pop-telemetry = { path = "../pop-telemetry", optional = true }

[dev-dependencies]
assert_cmd = "2.0.14"
predicates = "3.1.0"

[features]
default = ["contract", "parachain"]
default = ["contract", "parachain", "telemetry"]
contract = [
"dep:pop-contracts",
"dep:sp-core",
Expand All @@ -49,3 +55,4 @@ parachain = [
"dep:pop-parachains",
"dep:dirs",
]
telemetry = ["dep:pop-telemetry"]
1 change: 1 addition & 0 deletions crates/pop-cli/src/commands/new/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ impl NewContractCommand {
let spinner = cliclack::spinner();
spinner.start("Generating contract...");
create_smart_contract(&self.name, contract_path.as_path())?;

spinner.stop("Smart contract created!");
outro(format!("cd into \"{}\" and enjoy hacking! 🚀", contract_path.display()))?;
Ok(())
Expand Down
1 change: 1 addition & 0 deletions crates/pop-cli/src/commands/new/pallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ impl NewPalletCommand {
description: self.description.clone().expect("default values"),
},
)?;

spinner.stop("Generation complete");
outro(format!("cd into \"{}\" and enjoy hacking! 🚀", &self.name))?;
Ok(())
Expand Down
Loading

0 comments on commit 0999d65

Please sign in to comment.