forked from davidB/tracing-opentelemetry-instrumentation-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
118 lines (92 loc) · 3.68 KB
/
justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
_install_cargo-binstall:
@# cargo install --locked cargo-binstall
@(cargo-binstall -V > /dev/null) || (curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash)
_binstall ARG: _install_cargo-binstall
@(cargo binstall -y {{ARG}} || cargo install --locked {{ARG}})
_install_cargo-nextest:
@just _binstall cargo-nextest
_install_cargo-insta:
@just _binstall cargo-insta
_install_cargo-release:
@just _binstall cargo-release
_install_git-cliff:
@just _binstall git-cliff
_install_cargo-hack:
@just _binstall cargo-hack
_install_rustfmt_clippy:
rustup component add rustfmt
rustup component add clippy
# Format the code and sort dependencies
format:
cargo fmt
# cargo sort --workspace --grouped
deny:
cargo deny check advisories
cargo deny check bans licenses sources
check: _install_cargo-hack
cargo hack check --each-feature --no-dev-deps
# Lint the rust code
lint: _install_rustfmt_clippy
cargo fmt --all -- --check
cargo clippy --workspace --all-features --all-targets -- --deny warnings --allow deprecated --allow unknown-lints
megalinter:
@just _container run --pull always --rm -it -v "$PWD:/tmp/lint:rw" "megalinter/megalinter:v7"
# Launch tests
test: _install_cargo-nextest _install_cargo-insta
cargo nextest run
cargo test --doc
test_each_feature: _install_cargo-hack
cargo hack test --each-feature -- --test-threads=1
# changelog: _install_git-cliff
# git-cliff -o "CHANGELOG.md"
# git add CHANGELOG.md && git commit -m "📝 update CHANGELOG"
# release *arguments: _install_cargo-release _install_git-cliff
# cargo release --workspace --execute {{ arguments }}
# # git-cliff could not be used as `pre-release-hook` of cargo-release because it uses tag
# git-cliff -o "CHANGELOG.md"
# git add CHANGELOG.md && git commit -m "📝 update CHANGELOG" && git push
_container *arguments:
if [ -x "$(command -v podman)" ]; then \
podman {{ arguments }}; \
elif [ -x "$(command -v nerdctl)" ]; then \
nerdctl {{ arguments }}; \
elif [ -x "$(command -v docker)" ]; then \
docker {{ arguments }}; \
else \
echo "runner not found: podman or nerdctl or docker"; \
exit 1; \
fi
run_jaeger:
@just _container run --rm --name jaeger \
-e COLLECTOR_ZIPKIN_HOST_PORT:9411 \
-e COLLECTOR_OTLP_ENABLED:true \
-p 6831:6831/udp \
-p 6832:6832/udp \
-p 5778:5778 \
-p 16686:16686 \
-p 4317:4317 \
-p 4318:4318 \
-p 14250:14250 \
-p 14268:14268 \
-p 14269:14269 \
-p 9411:9411 \
docker.io/jaegertracing/all-in-one:latest
# echo "open http://localhost:16686"
run_example_grpc_server:
cd examples/grpc; OTEL_SERVICE_NAME=grpc-server cargo run --bin server
run_example_grpc_client:
# grpcurl -plaintext -d '{"service": "healthcheck"}' 127.0.0.1:50051 grpc.health.v1.Health/Check
# grpc-health-probe -addr 127.0.0.1:50051
grpcurl -plaintext 127.0.0.1:50051 list
cd examples/grpc; OTEL_SERVICE_NAME=grpc-client cargo run --bin client
run_example_axum-otlp_server:
cd examples/axum-otlp; OTEL_SERVICE_NAME=axum-otlp-4317 cargo run
run_example_axum-otlp_server_over_http:
cd examples/axum-otlp; OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="http://localhost:4318/v1/traces" OTEL_SERVICE_NAME=axum-otlp-4318 cargo run --features otlp-over-http
run_example_http_server:
@just run_example_axum-otlp_server
run_example_http_client:
# curl -i http://127.0.0.1:3003/health
curl -i http://127.0.0.1:3003/
run_example_load:
cd examples/load; cargo run --release 2>/dev/null