Skip to content

Commit

Permalink
Merge branch 'main' into fix-resolution-process
Browse files Browse the repository at this point in the history
  • Loading branch information
lquerel authored Mar 17, 2024
2 parents 114d1f8 + f538b56 commit f0e0997
Show file tree
Hide file tree
Showing 77 changed files with 913 additions and 439 deletions.
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[alias]
xtask = "run --package xtask --bin xtask --"
2 changes: 1 addition & 1 deletion .clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ warn-on-all-wildcard-imports = true
allow-expect-in-tests = true
allow-unwrap-in-tests = true
allow-dbg-in-tests = true
disallowed-methods = []
disallowed-methods = []
7 changes: 0 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,6 @@ jobs:
- uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all -- --check
check-workspace:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: check-workspace
run: ./scripts/check_workspace.sh
check-external-types:
runs-on: ubuntu-latest
steps:
Expand Down
27 changes: 0 additions & 27 deletions .github/workflows/readme.yml

This file was deleted.

18 changes: 18 additions & 0 deletions .github/workflows/validate-workspace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Validate the Cargo workspace.

on: [pull_request]

jobs:
validate-workspace:
name: Validate workspace
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Run cargo xtask validate
run: cargo xtask validate
6 changes: 5 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ Additionally, Weaver has its own CNCF slack channel at [#otel-weaver](https://cl

### How to build and test a change

TODO - write this, beyond `cargo test` at root directory.
Run `cargo xtask validate` to check the structure of the project.

Run `cargo test --all` to run the tests.

**Run `just` before any push to pre-validate all the steps performed by CI.**

### How to send Pull Request

Expand Down
57 changes: 57 additions & 0 deletions Cargo.lock

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

42 changes: 41 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ edition = "2021"
repository = "https://github.com/f5/otel-weaver"
license = "Apache-2.0"
publish = false
rust-version = "1.76"

[workspace.dependencies]
serde = { version = "1.0.197", features = ["derive"] }
Expand All @@ -34,6 +35,7 @@ regex = "1.10.3"
rayon = "1.9.0"
ordered-float = { version = "4.2.0", features = ["serde"] }
walkdir = "2.5.0"
anyhow = "1.0.81"

# Features definition =========================================================
[features]
Expand All @@ -56,7 +58,7 @@ weaver_schema = { path = "crates/weaver_schema" }
weaver_cache = { path = "crates/weaver_cache" }
weaver_forge = { path = "crates/weaver_forge" }

clap = { version = "4.5.2", features = ["derive"] }
clap = { version = "4.5.3", features = ["derive"] }
crossterm = "0.27.0"
ratatui = "0.26.1"
tui-textarea = "0.4.0"
Expand All @@ -75,3 +77,41 @@ ignored = ["serde"]
lto = true
strip = true
panic = "abort"

[workspace.lints.rust]
rust_2018_idioms = "warn"
unused_lifetimes = "warn"
# unreachable_pub = "warn"
semicolon_in_expressions_from_macros = "warn"
missing_docs = "deny"
unstable_features = "deny"
unused_import_braces = "deny"
unused_qualifications = "deny"
unused_results = "deny"
unused_extern_crates = "deny"

[lints]
workspace = true

[workspace.lints.clippy]
all = { level = "deny", priority = -1 }
cargo = { level = "deny", priority = -1 }
unwrap_used = "deny"
print_stdout = "deny"
print_stderr = "deny"
multiple_crate_versions = "allow"
# this lint shows places where you could add the #must_use attribute.
must-use-candidate = "warn"

complexity = { level = "warn", priority = -1 }
correctness = { level = "deny", priority = -1 }
perf = { level = "deny", priority = -1 }
restriction = { level = "allow", priority = -1 }
style = { level = "warn", priority = -1 }
suspicious = { level = "warn", priority = -1 }

too_many_arguments = "allow"
type_complexity = "allow"
wrong_self_convention = "allow"
rc_buffer = "warn"
# str_to_string = "warn"
42 changes: 25 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
## Overview

> At this stage, the project is being used as a **Proof of Concept** to explore and
> refine the 'Application Telemetry Schema: Vision and Roadmap' [OTEP](https://github.com/open-telemetry/oteps/blob/main/text/0243-app-telemetry-schema-vision-roadmap.md),
> refine the 'Application Telemetry Schema: Vision and
> Roadmap' [OTEP](https://github.com/open-telemetry/oteps/blob/main/text/0243-app-telemetry-schema-vision-roadmap.md),
> which has been approved and merged.
>
> This project is a **work in progress and is not ready for production use**.
Expand All @@ -22,6 +23,7 @@ must build it from source. To do so, you need to have Rust installed on your
system (see [Install Rust](https://www.rust-lang.org/tools/install)).

To build the tool:

- In debug mode, run the following command:
```
cargo build
Expand Down Expand Up @@ -164,19 +166,20 @@ crates.io.
The following is a list of crates in the workspace, along with a brief
description and the current status of each crate:

| Crate | Description | Status |
|-------------------------------------------------------------------|----------------------------------------------------------------------|-------------------------|
| [weaver_semconv](crates/weaver_semconv/README.md) | Semantic Convention Registry Data Model | Alpha; Need more tests |
| [weaver_version](crates/weaver_version/README.md) | OpenTelemetry Schema Versioning Data Model | Alpha; Need more tests |
| [weaver_resolved_schema](crates/weaver_resolved_schema/README.md) | Resolved Schema Data Model | Work-In-Progress |
| [weaver_schema](crates/weaver_schema/README.md) | Telemetry Schema Data Model | Work-In-Progress |
| [weaver_resolver](crates/weaver_resolver/README.md) | Telemetry Schema Resolution Process | Work-In-Progress |
| [weaver_cache](crates/weaver_cache/README.md) | Telemetry Schema and Semantic Convention Registry Cache | Work-In-Progress |
| [weaver_logger](crates/weaver_logger/README.md) | Generic logger supported colorized output | Alpha |
| [weaver_forge](crates/weaver_forge/README.md) | Template engine used to generate artifacts from any serde json value | Alpha; Need more tests |
| Crate | Description | Status |
|-------------------------------------------------------------------|----------------------------------------------------------------------|------------------------|
| [weaver_semconv](crates/weaver_semconv/README.md) | Semantic Convention Registry Data Model | Alpha; Need more tests |
| [weaver_version](crates/weaver_version/README.md) | OpenTelemetry Schema Versioning Data Model | Alpha; Need more tests |
| [weaver_resolved_schema](crates/weaver_resolved_schema/README.md) | Resolved Schema Data Model | Work-In-Progress |
| [weaver_schema](crates/weaver_schema/README.md) | Telemetry Schema Data Model | Work-In-Progress |
| [weaver_resolver](crates/weaver_resolver/README.md) | Telemetry Schema Resolution Process | Work-In-Progress |
| [weaver_cache](crates/weaver_cache/README.md) | Telemetry Schema and Semantic Convention Registry Cache | Work-In-Progress |
| [weaver_logger](crates/weaver_logger/README.md) | Generic logger supported colorized output | Alpha |
| [weaver_forge](crates/weaver_forge/README.md) | Template engine used to generate artifacts from any serde json value | Alpha; Need more tests |
| xtask | Set of tasks to validate the project | Done |

Note 1: Alpha status means that the crate is in a usable state but may have
limited functionality and/or may not be fully tested.
limited functionality and/or may not be fully tested.

Note 2: Work-In-Progress status means that the crate is still under active
development.
Expand All @@ -197,28 +200,33 @@ Below is a diagram detailing the primary components of the OpenTelemetry Weaver
## Links

Internal links:

- [Template Engine](docs/template-engine.md)
- [Component Telemetry Schema](docs/component-telemetry-schema.md) (proposal)
- [Resolved Telemetry Schema](docs/resolved-telemetry-schema.md) (proposal)
- [Internal crates interdependencies](docs/dependencies.md)
- [Change log](CHANGELOG.md)

External links:

- Application Telemetry Schema: Vision and Roadmap - [PR](https://github.com/open-telemetry/oteps/pull/243)
- OpenTelemetry Telemetry Schema v1.2.0 [Draft](https://github.com/lquerel/oteps/blob/app-telemetry-schema-format/text/0241-telemetry-schema-ext.md) (not yet ready).
- OpenTelemetry Telemetry Schema
v1.2.0 [Draft](https://github.com/lquerel/oteps/blob/app-telemetry-schema-format/text/0241-telemetry-schema-ext.md) (
not yet ready).
- [OpenTelemetry Semantic Convention File Format](https://github.com/open-telemetry/build-tools/blob/main/semantic-conventions/syntax.md)
- [OpenTelemetry Schema File Format v1.1.0](https://opentelemetry.io/docs/specs/otel/schemas/file_format_v1.1.0/)
- Presentation slides from the Semantic Convention SIG meeting on October 23, 2023 [here](https://docs.google.com/presentation/d/1nxt5VFlC1mUjZ8eecUYK4e4SxThpIVj1IRnIcodMsNI/edit?usp=sharing).
- Meta/Facebook's [positional paper](https://research.facebook.com/publications/positional-paper-schema-first-application-telemetry/)
presenting a similar approach but based on Thrift+Annotations+Automations.
- Presentation slides from the Semantic Convention SIG meeting on October 23,
2023 [here](https://docs.google.com/presentation/d/1nxt5VFlC1mUjZ8eecUYK4e4SxThpIVj1IRnIcodMsNI/edit?usp=sharing).
-
Meta/Facebook's [positional paper](https://research.facebook.com/publications/positional-paper-schema-first-application-telemetry/)
presenting a similar approach but based on Thrift+Annotations+Automations.

## Contributing

Pull requests are welcome. For major changes, please open an issue
first to discuss what you would like to change. For more information, please
read [CONTRIBUTING](CONTRIBUTING.md).


## License

OpenTelemetry Weaver is licensed under Apache License Version 2.0.
4 changes: 4 additions & 0 deletions crates/weaver_cache/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ repository.workspace = true
license.workspace = true
publish.workspace = true
edition.workspace = true
rust-version.workspace = true

[lints]
workspace = true

[dependencies]
tempdir = "0.3.7"
Expand Down
9 changes: 6 additions & 3 deletions crates/weaver_cache/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ impl Cache {
repo_url: repo_url.to_string(),
message: e.to_string(),
})?
.with_shallow(Shallow::DepthAtRemote(NonZeroU32::new(1).unwrap()));
.with_shallow(Shallow::DepthAtRemote(
NonZeroU32::new(1).expect("1 is not zero"),
));

let (mut prepare, _outcome) = fetch
.fetch_then_checkout(progress::Discard, &AtomicBool::new(false))
Expand All @@ -152,7 +154,7 @@ impl Cache {
// Checks the existence of the path in the repo.
// If the path doesn't exist, returns an error.
if !git_repo_path.join(path).exists() {
return Err(Error::GitError {
return Err(GitError {
repo_url: repo_url.to_string(),
message: format!("Path `{}` not found in repo", path),
});
Expand All @@ -164,7 +166,8 @@ impl Cache {
};

// Adds the repo to the git_repo_dirs hashmap.
self.git_repo_dirs
_ = self
.git_repo_dirs
.lock()
.expect("git_repo_dirs lock failed")
.insert(
Expand Down
4 changes: 4 additions & 0 deletions crates/weaver_forge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ repository.workspace = true
license.workspace = true
publish.workspace = true
edition.workspace = true
rust-version.workspace = true

[lints]
workspace = true

[dependencies]
weaver_logger = { path = "../weaver_logger" }
Expand Down
Loading

0 comments on commit f0e0997

Please sign in to comment.