diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3b4393fd..dab93b3c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -160,9 +160,9 @@ jobs: uses: dtolnay/rust-toolchain@nightly - uses: Swatinem/rust-cache@v2 with: - workspaces: "./rust -> target" - cache-on-failure: "true" - cache-all-crates: "true" + workspaces: ./rust -> target + cache-on-failure: 'true' + cache-all-crates: 'true' - name: Build docs run: | diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fc082da5..ca681c55 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -97,6 +97,11 @@ jobs: - name: Install rust toolchain (doc builds use nightly features) uses: dtolnay/rust-toolchain@nightly + - uses: Swatinem/rust-cache@v2 + with: + workspaces: "./rust -> target" + cache-on-failure: "true" + cache-all-crates: "true" - name: Install dependencies run: | @@ -141,6 +146,7 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | COVERAGE=${{ matrix.coverage }} ./dev_scripts/test.sh py + - name: Run tests (windows) if: matrix.os == 'windows-latest' run: | @@ -215,6 +221,7 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | ./dev_scripts/test.sh py_rust + - name: Run tests (windows) if: matrix.os == 'windows-latest' run: | @@ -249,6 +256,7 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | ./dev_scripts/test.sh rust --no-fail-fast + - name: Run tests (windows) if: matrix.os == 'windows-latest' run: | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7b17b654..d806203c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -66,6 +66,7 @@ repos: - id: bandit args: ["-c", "./py/bandit.yml", "./py"] + # Cargo/clippy: linting and formatting for rust code: - repo: local hooks: diff --git a/.zetch.lock b/.zetch.lock index 90f8c59c..6e4ec8f7 100644 --- a/.zetch.lock +++ b/.zetch.lock @@ -1,23 +1,23 @@ { "version": "0.0.10", "files": { - "README.zetch.md": "f18259400a13643874d0037b35bac4d1a17d69df7c68f8088cc8f82d31651450", - "py_rust/LICENSE.zetch.md": "d2c12e539d357957b950a54a5477c3a9f87bd2b3ee707be7a4db7adaf5aacc2b", - "py/README.zetch.md": "69a8cc31796946c0f0aa67c77c255da32bf1bcb502157a1d19fe18b0514be441", - "docs/index.zetch.md": "69a8cc31796946c0f0aa67c77c255da32bf1bcb502157a1d19fe18b0514be441", - "js/LICENSE.zetch.md": "d2c12e539d357957b950a54a5477c3a9f87bd2b3ee707be7a4db7adaf5aacc2b", - "rust/LICENSE.zetch.md": "d2c12e539d357957b950a54a5477c3a9f87bd2b3ee707be7a4db7adaf5aacc2b", - "opencollector.yaml.zetch": "b45a32e0966c91d9fb0e3c97b7450d4a5b957a88603acd5e2ace57c0b1101c11", - "py/LICENSE.zetch.md": "d2c12e539d357957b950a54a5477c3a9f87bd2b3ee707be7a4db7adaf5aacc2b", "docs/LICENSE.zetch.md": "d2c12e539d357957b950a54a5477c3a9f87bd2b3ee707be7a4db7adaf5aacc2b", - "docs/CONTRIBUTING.zetch.md": "bace46dc064746b54cf472eba960d934d705c2f83120b865a4b47032ff1552c5", "py_rust/README.zetch.md": "69a8cc31796946c0f0aa67c77c255da32bf1bcb502157a1d19fe18b0514be441", - "CODE_OF_CONDUCT.zetch.md": "bf106326ffc75f5167cfde27c997c77c6b97c843a9e392b564355d0e70e50b97", - "CONTRIBUTING.zetch.md": "bace46dc064746b54cf472eba960d934d705c2f83120b865a4b47032ff1552c5", "docs/CODE_OF_CONDUCT.zetch.md": "bf106326ffc75f5167cfde27c997c77c6b97c843a9e392b564355d0e70e50b97", - "js/README.zetch.md": "69a8cc31796946c0f0aa67c77c255da32bf1bcb502157a1d19fe18b0514be441", + "py/README.zetch.md": "69a8cc31796946c0f0aa67c77c255da32bf1bcb502157a1d19fe18b0514be441", "rust/README.zetch.md": "69a8cc31796946c0f0aa67c77c255da32bf1bcb502157a1d19fe18b0514be441", + "docs/CONTRIBUTING.zetch.md": "bace46dc064746b54cf472eba960d934d705c2f83120b865a4b47032ff1552c5", + "rust/LICENSE.zetch.md": "d2c12e539d357957b950a54a5477c3a9f87bd2b3ee707be7a4db7adaf5aacc2b", + "CONTRIBUTING.zetch.md": "bace46dc064746b54cf472eba960d934d705c2f83120b865a4b47032ff1552c5", + "LICENSE.zetch.md": "d2c12e539d357957b950a54a5477c3a9f87bd2b3ee707be7a4db7adaf5aacc2b", + "CODE_OF_CONDUCT.zetch.md": "bf106326ffc75f5167cfde27c997c77c6b97c843a9e392b564355d0e70e50b97", + "README.zetch.md": "f18259400a13643874d0037b35bac4d1a17d69df7c68f8088cc8f82d31651450", + "js/LICENSE.zetch.md": "d2c12e539d357957b950a54a5477c3a9f87bd2b3ee707be7a4db7adaf5aacc2b", "js/tsconfig.zetch.json": "fb5d57b825bb3c2f6dd4254bf939f2444e52946622a7f93b91e3acb75876ebbc", - "LICENSE.zetch.md": "d2c12e539d357957b950a54a5477c3a9f87bd2b3ee707be7a4db7adaf5aacc2b" + "js/README.zetch.md": "69a8cc31796946c0f0aa67c77c255da32bf1bcb502157a1d19fe18b0514be441", + "docs/index.zetch.md": "69a8cc31796946c0f0aa67c77c255da32bf1bcb502157a1d19fe18b0514be441", + "opencollector.yaml.zetch": "61ef569d5d016214672a01a5f372a87ee9a2bbb885c8f4f4e57f421d3812a312", + "py/LICENSE.zetch.md": "d2c12e539d357957b950a54a5477c3a9f87bd2b3ee707be7a4db7adaf5aacc2b", + "py_rust/LICENSE.zetch.md": "d2c12e539d357957b950a54a5477c3a9f87bd2b3ee707be7a4db7adaf5aacc2b" } } \ No newline at end of file diff --git a/bitbazaar.code-workspace b/bitbazaar.code-workspace index c0d4c4c4..08716088 100644 --- a/bitbazaar.code-workspace +++ b/bitbazaar.code-workspace @@ -76,6 +76,7 @@ "editor.formatOnSave": true, "editor.formatOnPaste": false, "editor.codeActionsOnSave": { + // Ruff will auto fix issues and sort imports (needs extension https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff) "source.fixAll": "explicit" }, // Ruff (replaces black) formats python code (needs extension https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff) diff --git a/dev_scripts/_internal/match_substring.py b/dev_scripts/_internal/match_substring.py new file mode 100644 index 00000000..119d3fd0 --- /dev/null +++ b/dev_scripts/_internal/match_substring.py @@ -0,0 +1,23 @@ +"""Used internally by utils.sh match_substring.""" + +import re +import sys + +r = sys.argv[1] +s = sys.argv[2] + + +def err_inf(): + """Helper for error message.""" + return "\n\nString:\n{}\n\nRegex: '{}'\n\n".format(s, r) + + +res = re.findall(r, s) +if len(res) != 1: + raise ValueError("{}Expected 1 match, got: {}.".format(err_inf(), len(res))) + +match = res[0] +if match == "": + raise ValueError("{}Matched empty string.".format(err_inf())) + +print(match.strip()) diff --git a/dev_scripts/docs.sh b/dev_scripts/docs.sh index 2eda08bd..0f17b976 100755 --- a/dev_scripts/docs.sh +++ b/dev_scripts/docs.sh @@ -15,6 +15,7 @@ js_sub_build () { # Builds the nested js site: rust_sub_build () { + # Nightly features used for docs (e.g. feature(doc_auto_cfg)) rm -rf ./docs/rust_ref && cargo +nightly doc --no-deps --manifest-path ./rust/Cargo.toml --target-dir ./docs/rust_ref --all-features } diff --git a/dev_scripts/initial_setup.sh b/dev_scripts/initial_setup.sh index c117a196..08611eab 100755 --- a/dev_scripts/initial_setup.sh +++ b/dev_scripts/initial_setup.sh @@ -20,6 +20,7 @@ _install_yaml_fmt () { echo "yamlfmt version $1 installed!" } + _install_openobserve() { echo "Installing openobserve version $1..." @@ -27,8 +28,8 @@ _install_openobserve() { OS=$(uname -s | tr '[:upper:]' '[:lower:]') ARCH=$(uname -m) - echo "Downloading openobserve version $1 for $OS-$ARCH..." - curl -L https://github.com/openobserve/openobserve/releases/download/v$1/openobserve-v$1-$OS-$ARCH.tar.gz -o openobserve.tar.gz -f + echo "Downloading openobserve version $1 for ${OS}-${ARCH}..." + curl -L https://github.com/openobserve/openobserve/releases/download/v$1/openobserve-v$1-${OS}-${ARCH}.tar.gz -o openobserve.tar.gz -f tar -xzf openobserve.tar.gz rm openobserve.tar.gz chmod +x openobserve @@ -64,6 +65,58 @@ _ensure_openobserve() { fi } +_install_otlp_collector () { + echo "Installing otlp_collector version $1..." + + # os lowercase: + OS=$(uname -s | tr '[:upper:]' '[:lower:]') + ARCH=$(uname -m) + + # If ARCH == aarch64, replace with arm64: + if [ "${ARCH}" == "aarch64" ]; then + ARCH="arm64" + fi + + echo "Downloading otlp_collector version $1 for ${OS}-${ARCH}..." + curl -L https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v$1/otelcol-contrib_$1_${OS}_${ARCH}.tar.gz \ + -o otlp_collector.tar.gz -f + tar -xzf otlp_collector.tar.gz + rm otlp_collector.tar.gz + # Comes out as otelcol-contrib: + mv otelcol-contrib otlp_collector + chmod +x otlp_collector + sudo mv otlp_collector /usr/local/bin +} + +_ensure_otlp_collector() { + req_ver="$1" + + if [[ -z "$req_ver" ]]; then + echo "otlp_collector version not provided!" + exit 1 + fi + + if version=$(otlp_collector --version 2>/dev/null); then + # Will be "otelcol-contrib version $ver", make sure starts with "otelcol-contrib version " and remove that: + if [[ ! "$version" =~ ^otelcol-contrib\ version\ ]]; then + echo "otlp_collector version not found in expected format, expected 'otelcol-contrib version x.x.x', got '$version'!" + exit 1 + fi + + # Strip prefix: + version=${version#otelcol-contrib version } + + if [[ "$version" == "$req_ver" ]]; then + echo "otlp_collector already installed with correct version $version!" + else + echo "otlp_collector incorrect version, upgrading to $version..." + _install_otlp_collector $req_ver + fi + else + _install_otlp_collector $req_ver + fi +} + _install_biome () { echo "Installing biome version $1..." @@ -71,8 +124,8 @@ _install_biome () { OS=$(uname -s | tr '[:upper:]' '[:lower:]') ARCH=$(uname -m) - echo "Downloading biome version $1 for $OS-$ARCH..." - curl -L https://github.com/biomejs/biome/releases/download/cli%2Fv$1/biome-$OS-$ARCH -o biome -f + echo "Downloading biome version $1 for ${OS}-${ARCH}..." + curl -L https://github.com/biomejs/biome/releases/download/cli%2Fv$1/biome-${OS}-${ARCH} -o biome -f chmod +x biome sudo mv biome /usr/local/bin } @@ -121,6 +174,7 @@ initial_setup () { # Make sure openobserve is installed for dev open telemetry logging: _ensure_openobserve "0.8.0" + _ensure_otlp_collector "0.94.0" # Make sure biome is installed for linting and formatting various files: _ensure_biome "1.5.3" diff --git a/dev_scripts/process.sh b/dev_scripts/process.sh new file mode 100755 index 00000000..60e5aac3 --- /dev/null +++ b/dev_scripts/process.sh @@ -0,0 +1,128 @@ +#!/bin/bash + +# Stop on error: +set -e + +PROCESS_PREFIX="dev_script_process" + +# Start a process with this system. $1: process_name, $2: stringified command to run +# These processes will be tracked and are listable and stopable. +# All processes should stop when terminal is shut +start() { + if [ "$#" -ne 2 ]; then + echo "Usage: $0 " + return 1 + fi + + # If process_name is empty, error + if [ -z "$1" ]; then + echo "Process name cannot be empty!" + return 1 + fi + + local process_name="$1" + local process_command="$2" + local process_id_file="/tmp/${PROCESS_PREFIX}_${process_name}.pid" + + # Check if the process is already running + if [ -e "$process_id_file" ]; then + local existing_pid=$(<"$process_id_file") + if ps -p "$existing_pid" > /dev/null; then + echo "Process '$process_name' is already running with PID $existing_pid" + return 1 + else + # Remove stale PID file + rm "$process_id_file" + fi + fi + + # Start the process and write the processes output to $(pwd)/process_data/processes/$process_name.log + local log_file="$(pwd)/logs/proc_$process_name.log" + mkdir -p "$(dirname "$log_file")" + # Clear the logfile to start from scratch: + > "$log_file" + + # Start the process in its own process group, rerouting all output to the logfile: + eval "$process_command" > "$log_file" 2>&1 & + + # Capture the PID of the process and write it to a file + local new_pid=$! + + # Wait for 0.2 seconds, if the process has exited already with a non-zero exit code, then print the log file + sleep 0.2 + if ! ps -p "$new_pid" > /dev/null; then + cat "$log_file" + echo "Process '$process_name' failed (wasn't running after 0.2 seconds), output in logfile printed above." + return 1 + fi + + echo "$new_pid" > "$process_id_file" + echo "Process '$process_name' started with PID $new_pid, output will write to '$log_file'" +} + +# Stop processes with a given namespace started with this system. $1: process_name +# E.g. scr process.sh stop my_process would stop my_process and any processes with that as a prefix. +stop() { + if [ "$#" -ne 1 ]; then + echo "Usage: $0 " + return 1 + fi + + local process_name="$1" + local process_id_files=(/tmp/${PROCESS_PREFIX}_${process_name}*.pid) + + echo "Stopping processes matching or prefixed by '$process_name'..." + for process_id_file in "${process_id_files[@]}"; do + if [ -e "$process_id_file" ]; then + while IFS= read -r pid_to_kill; do + echo "Stopping process with PID: $pid_to_kill" + terminate "$pid_to_kill" + done < "$process_id_file" + rm "$process_id_file" + fi + done + echo "Stopped ${#process_id_files[@]} process." +} + +# List all processes actively running processes that were started with start() +list() { + local pid_files=$(ls /tmp/${PROCESS_PREFIX}_*.pid 2>/dev/null) + + if [ -z "$pid_files" ]; then + echo "No processes running!" + return + fi + + echo "Processes:" + for pid_file in $pid_files; do + local process_name=$(basename "$pid_file" | sed "s/${PROCESS_PREFIX}_//g" | sed "s/.pid//g") + local pid=$(<"$pid_file") + echo " Process: $process_name, PID: $pid" + done +} + +# Terminate a process and all of its child processes +terminate() { + local parent_pid="$1" + local IS_CHILD=$2 + + # Terminate the child processes of the parent PID + local child_pids=$(pgrep -P "$parent_pid") + for pid in $child_pids; do + terminate "$pid" "true" + done + + # Terminate the parent PID + if ps -p "$parent_pid" > /dev/null; then + if [ "$IS_CHILD" = "true" ]; then + echo "Terminating child: $parent_pid" + else + echo "Terminating root: $parent_pid" + fi + # Or true to not error if the process is already dead: + kill -9 "$parent_pid" > /dev/null 2>&1 || true + fi +} + +# Has to come at the end of these files: +source ./dev_scripts/_scr_setup/setup.sh "$@" \ No newline at end of file diff --git a/dev_scripts/run.sh b/dev_scripts/run.sh index ad1c9b61..2b8743bd 100755 --- a/dev_scripts/run.sh +++ b/dev_scripts/run.sh @@ -3,37 +3,47 @@ # Stop on error: set -e -# Starts the open telemetry collector in a docker container if not already started -ensure_collector () { - # Define the name of the Docker container - CONTAINER_NAME="collector_bitbazaar" +# Prep for running top-level services +_prep () { + # A custom env version may have been used before, reset zetch to make sure not the case. + zetch + # Start open telemetry collector and openobserve in the background: + ./dev_scripts/run.sh collector + ./dev_scripts/run.sh oo + +} + + +# Starts the open telemetry collector in the background to collect open telemetry data +collector () { if [ "$(./dev_scripts/utils.sh in_ci)" = "true" ]; then echo "In CI, not starting open telemetry collector." else - # Check if the container is already running - if [ "$(docker inspect -f '{{.State.Running}}' $CONTAINER_NAME 2>/dev/null)" = "true" ]; then - echo "Open telemetry collector as container '$CONTAINER_NAME' already running!" - else - # Start the container - echo "Starting open telemetry collector as container '$CONTAINER_NAME'..." - # - Link the config file - # - Link the ./logs/ directory to /logs/ in the container - # - Collector listens for inputs from programs on 4317 - # - Runs in detached mode - docker run --rm --name $CONTAINER_NAME \ - -v $(pwd)/opencollector.yaml:/etc/otelcol-contrib/config.yaml \ - -v $(pwd)/logs:/logs \ - -p 127.0.0.1:4317:4317 \ - -d \ - otel/opentelemetry-collector-contrib:0.94.0 - fi + prefix="otlp_col_" + + # Stop any current open observer processes: + ./dev_scripts/process.sh stop $prefix + + # Run the process: + ./dev_scripts/process.sh start "${prefix}bitbazaar" "otlp_collector --config $(pwd)/opencollector.yaml" fi } -# Starts the openobserve server to look at dev logs/traces/metrics +# Starts the openobserve server in the background to look at dev logs/traces/metrics oo () { - ZO_ROOT_USER_EMAIL="dev@dev.com" ZO_ROOT_USER_PASSWORD="pass" openobserve + if [ "$(./dev_scripts/utils.sh in_ci)" = "true" ]; then + echo "In CI, not starting openobserver." + else + prefix="oo_" + + # Stop any current open observer processes: + ./dev_scripts/process.sh stop $prefix + + ZO_ROOT_USER_EMAIL="dev@dev.com" ZO_ROOT_USER_PASSWORD="pass" \ + ZO_DATA_DIR="$(pwd)/process_data/openobserve" \ + ./dev_scripts/process.sh start "${prefix}bitbazaar" "openobserve" + fi } # Has to come at the end of these files: diff --git a/dev_scripts/test.sh b/dev_scripts/test.sh index 62e68c32..0861e2c0 100755 --- a/dev_scripts/test.sh +++ b/dev_scripts/test.sh @@ -60,7 +60,7 @@ qa () { } py () { - ./dev_scripts/run.sh ensure_collector # Needed for open telemetry tests in bitbazaar + ./dev_scripts/run.sh collector # Needed for open telemetry tests in bitbazaar cd ./py/ # Check for COVERAGE=False/false, which is set in some workflow runs to make faster: @@ -111,7 +111,7 @@ py_rust () { } rust () { - ./dev_scripts/run.sh ensure_collector # Needed for open telemetry tests in bitbazaar + ./dev_scripts/run.sh collector # Needed for open telemetry tests in bitbazaar cargo nextest run --cargo-profile dev --manifest-path ./rust/Cargo.toml --all-features $@ } diff --git a/dev_scripts/utils.sh b/dev_scripts/utils.sh index a06d070f..858cf762 100755 --- a/dev_scripts/utils.sh +++ b/dev_scripts/utils.sh @@ -5,7 +5,8 @@ set -e # Run commands in parallel. E.g. run_parallel "sleep 1" "sleep 1" "sleep 1" run_parallel () { - parallel --ungroup -j 0 ::: "$@" + # --halt now,fail=1 stops all processes if any of the error + parallel --ungroup -j 0 --halt now,fail=1 ::: "$@" } py_install_if_missing () { @@ -24,6 +25,8 @@ replace_text () { awk "{sub(\"$1\",\"$2\")} {print}" $3 > temp.txt && mv temp.txt $3 } + + # Returns "true" if looks like in_ci, "false" otherwise: in_ci () { # Check if any of the CI/CD environment variables are set @@ -34,5 +37,31 @@ in_ci () { fi } +# If python exists and is a 3.x version, runs the command. Otherwise, runs with python3.12/3.11/3, whichever found first. +anypython () { + # Use python by default (e.g. virtualenv) as long as its a 3.x version: + if command -v python &> /dev/null && [[ $(python -c 'import sys; print(sys.version_info[0])') == "3" ]]; then + python "$@" + elif command -v python3.12 &> /dev/null; then + python3.12 "$@" + elif command -v python3.11 &> /dev/null; then + python3.11 "$@" + elif command -v python3 &> /dev/null; then + python3 "$@" + else + echo "No python found." + exit 1 + fi +} + +# Uses python re.findall(), if more than one match or no matches, errors. Otherwise returns the matched substring. +# Args: +# $1: regex string, e.g. 'foo_(.*?)_ree' (make sure to use single quotes to escape the special chars) +# $2: string to search in e.g. "foo_bar_ree" +# Returns: the matched substring, e.g. "bar" +match_substring () { + anypython ./dev_scripts/_internal/match_substring.py "$1" "$2" +} + # Has to come at the end of these files: source ./dev_scripts/_scr_setup/setup.sh "$@" diff --git a/js/package-lock.json b/js/package-lock.json index 4b0b05b2..af4a0006 100644 --- a/js/package-lock.json +++ b/js/package-lock.json @@ -1,12 +1,12 @@ { "name": "bitbazaar", - "version": "0.0.22", + "version": "0.0.23", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "bitbazaar", - "version": "0.0.22", + "version": "0.0.23", "license": "MIT", "dependencies": { "@opentelemetry/api": "^1.7.0", diff --git a/opencollector.yaml b/opencollector.yaml index a9d17fda..79fe6f30 100644 --- a/opencollector.yaml +++ b/opencollector.yaml @@ -3,7 +3,7 @@ receivers: otlp: protocols: grpc: - endpoint: 0.0.0.0:4317 + endpoint: localhost:4317 processors: # Prevent memory usage from exceeding 40% of the total available RAM, @@ -19,18 +19,15 @@ processors: timeout: 1s exporters: - otlp/dev_oo: - endpoint: host.docker.internal:5081 + otlphttp: + endpoint: http://localhost:5080/api/default/ + compression: gzip headers: - Authorization: "Basic cm9vdEByb290LmNvbTpDUENWeFJjeU9qVUl4RWJh" - organization: default + Authorization: Basic ZGV2QGRldi5jb206cGFzcw== stream-name: default - tls: - insecure: true - # Writes all opentelemetry logs, traces, metrics to a file, useful for testing: file/debug_file_writing: - path: ./logs/otlp.log + path: /Users/zak/z/code/bitbazaar/logs/otlp_telemetry_out.log rotation: max_megabytes: 10 max_days: 3 @@ -48,17 +45,17 @@ service: receivers: [otlp] processors: [memory_limiter, batch] exporters: + - otlphttp - file/debug_file_writing - - otlp/dev_oo traces: receivers: [otlp] processors: [memory_limiter, batch] exporters: + - otlphttp - file/debug_file_writing - - otlp/dev_oo metrics: # Don't bother with memory limiting for metrics, traces and logs will be the largest consumers of memory receivers: [otlp] processors: [batch] exporters: + - otlphttp - file/debug_file_writing - - otlp/dev_oo diff --git a/opencollector.yaml.zetch b/opencollector.yaml.zetch index 8c10bbed..18fec7a9 100644 --- a/opencollector.yaml.zetch +++ b/opencollector.yaml.zetch @@ -3,7 +3,7 @@ receivers: otlp: protocols: grpc: - endpoint: 0.0.0.0:4317 + endpoint: localhost:4317 processors: # Prevent memory usage from exceeding 40% of the total available RAM, @@ -19,28 +19,17 @@ processors: timeout: {% if DEBUG %}1s{% else %}30s{% endif %} exporters: -{%- if not DEBUG %} -# TODO -# otlphttp: -# endpoint: TODO -# compression: gzip -# headers: -# Authorization: TODO -# stream-name: default -{% endif %} -{%- if DEBUG %} - otlp/dev_oo: - endpoint: host.docker.internal:5081 - headers: - Authorization: "Basic cm9vdEByb290LmNvbTpDUENWeFJjeU9qVUl4RWJh" - organization: default - stream-name: default - tls: - insecure: true + otlphttp: + endpoint: {{ OTLP_OO_ENDPOINT }} + compression: gzip + headers: + Authorization: {{ OTLP_OO_AUTH }} + stream-name: default +{%- if DEBUG %} # Writes all opentelemetry logs, traces, metrics to a file, useful for testing: file/debug_file_writing: - path: ./logs/otlp.log + path: {{ ROOT_DIR }}/logs/otlp_telemetry_out.log rotation: max_megabytes: 10 max_days: 3 @@ -59,32 +48,23 @@ service: receivers: [otlp] processors: [memory_limiter, batch] exporters: + - otlphttp {%- if DEBUG %} - file/debug_file_writing - - otlp/dev_oo - {%- endif %} - {%- if not DEBUG %} - - otlphttp {%- endif %} traces: receivers: [otlp] processors: [memory_limiter, batch] exporters: + - otlphttp {%- if DEBUG %} - file/debug_file_writing - - otlp/dev_oo - {%- endif %} - {%- if not DEBUG %} - - otlphttp {%- endif %} metrics: # Don't bother with memory limiting for metrics, traces and logs will be the largest consumers of memory receivers: [otlp] processors: [batch] exporters: + - otlphttp {%- if DEBUG %} - file/debug_file_writing - - otlp/dev_oo - {%- endif %} - {%- if not DEBUG %} - - otlphttp - {%- endif %} + {%- endif %} \ No newline at end of file diff --git a/py/ruff.toml b/py/ruff.toml index 36c59ae0..0f933959 100644 --- a/py/ruff.toml +++ b/py/ruff.toml @@ -1,4 +1,6 @@ line-length = 100 + +[lint] ignore-init-module-imports = true # Makes unused imports in __init__.py give message to add to __all__ rather than redundant import unfixable = [ # Don't remove unused imports or variables on save, can be quite annoying when writing code: @@ -27,7 +29,7 @@ ignore = [ "RUF010", # Ignore converting f"{str(x)}" to f"{x!s}" simply because it's less obvious and less people know about it ] -[per-file-ignores] +[lint.per-file-ignores] "**/{tests}/**/*" = [ # Don't need docstrings linting for tests "D100", @@ -40,5 +42,5 @@ ignore = [ "D107", ] -[pydocstyle] +[lint.pydocstyle] convention = "google" diff --git a/py/tests/log/log_generics.py b/py/tests/log/log_generics.py index 1773c305..7367c3fd 100644 --- a/py/tests/log/log_generics.py +++ b/py/tests/log/log_generics.py @@ -144,7 +144,7 @@ class OLTPChecker(Checker): seek: int def __init__(self): - self.logpath = os.path.join("..", "logs", "otlp.log") + self.logpath = os.path.join("..", "logs", "otlp_telemetry_out.log") self.seek = 0 def _get_entries(self) -> list[tp.Any]: diff --git a/py_rust/Cargo.lock b/py_rust/Cargo.lock index 68b7ea52..701d3b60 100644 --- a/py_rust/Cargo.lock +++ b/py_rust/Cargo.lock @@ -57,9 +57,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "anstyle-parse" @@ -95,12 +95,68 @@ version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +[[package]] +name = "async-trait" +version = "0.1.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.49", +] + [[package]] name = "autocfg" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "axum" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" +dependencies = [ + "async-trait", + "axum-core", + "bitflags 1.3.2", + "bytes", + "futures-util", + "http 0.2.11", + "http-body", + "hyper", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "sync_wrapper", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http 0.2.11", + "http-body", + "mime", + "rustversion", + "tower-layer", + "tower-service", +] + [[package]] name = "backtrace" version = "0.3.69" @@ -116,25 +172,43 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + [[package]] name = "bitbazaar" -version = "0.0.28" +version = "0.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fa6a913a8716b25a10922db990d607c9d230e329ccd11a49eca54500f22c29b" +checksum = "caa2497814b06c0b3550f63d9e65c914ebf355725473ae873dcc5ac5ba886db9" dependencies = [ "chrono", "clap", "colored", "comfy-table", "error-stack", - "normpath", + "hostname", + "http 1.0.0", "once_cell", + "opentelemetry", + "opentelemetry-appender-tracing", + "opentelemetry-otlp", + "opentelemetry-semantic-conventions", + "opentelemetry_sdk", "parking_lot", "regex", + "rustc_version", + "serde", + "serde_json", "strum", "time", "tracing", "tracing-appender", + "tracing-core", + "tracing-log", + "tracing-opentelemetry", "tracing-subscriber", ] @@ -165,9 +239,15 @@ checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "d32a994c2b3ca201d9b263612a374263f05e7adde37c4707f693dcd375076d1f" + +[[package]] +name = "bytes" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cc" @@ -186,9 +266,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.32" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41daef31d7a747c5c847246f36de49ced6f7403b4cdabc807a97b5cc184cda7a" +checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" dependencies = [ "android-tzdata", "iana-time-zone", @@ -200,9 +280,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.18" +version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" +checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da" dependencies = [ "clap_builder", "clap_derive", @@ -210,9 +290,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.18" +version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" +checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb" dependencies = [ "anstream", "anstyle", @@ -222,21 +302,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.4.7" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" dependencies = [ "heck", "proc-macro2", "quote", - "syn", + "syn 2.0.49", ] [[package]] name = "clap_lex" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "colorchoice" @@ -318,6 +398,12 @@ dependencies = [ "powerfmt", ] +[[package]] +name = "either" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" + [[package]] name = "equivalent" version = "1.0.1" @@ -340,12 +426,124 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "futures-channel" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-executor" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-macro" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.49", +] + +[[package]] +name = "futures-sink" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-core", + "futures-macro", + "futures-sink", + "futures-task", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "getrandom" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + [[package]] name = "gimli" version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "h2" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 0.2.11", + "indexmap 2.2.3", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + [[package]] name = "hashbrown" version = "0.14.3" @@ -358,11 +556,103 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "hostname" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +dependencies = [ + "libc", + "match_cfg", + "winapi", +] + +[[package]] +name = "http" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http 0.2.11", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "0.14.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http 0.2.11", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-timeout" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +dependencies = [ + "hyper", + "pin-project-lite", + "tokio", + "tokio-io-timeout", +] + [[package]] name = "iana-time-zone" -version = "0.1.59" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -383,12 +673,22 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.14.3", ] [[package]] @@ -397,6 +697,15 @@ version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.10" @@ -405,9 +714,9 @@ checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "js-sys" -version = "0.3.67" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" +checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" dependencies = [ "wasm-bindgen", ] @@ -420,9 +729,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.152" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "lock_api" @@ -441,6 +750,18 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +[[package]] +name = "match_cfg" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" + +[[package]] +name = "matchit" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" + [[package]] name = "memchr" version = "2.7.1" @@ -456,21 +777,29 @@ dependencies = [ "autocfg", ] +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] [[package]] -name = "normpath" -version = "1.1.1" +name = "mio" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec60c60a693226186f5d6edf073232bfb6464ed97eb22cf3b01c1e8198fd97f5" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ + "libc", + "wasi", "windows-sys 0.48.0", ] @@ -484,20 +813,26 @@ dependencies = [ "winapi", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", ] [[package]] name = "num_threads" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" +checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" dependencies = [ "libc", ] @@ -517,6 +852,108 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "opentelemetry" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e32339a5dc40459130b3bd269e9892439f55b33e772d2a9d402a789baaf4e8a" +dependencies = [ + "futures-core", + "futures-sink", + "indexmap 2.2.3", + "js-sys", + "once_cell", + "pin-project-lite", + "thiserror", + "urlencoding", +] + +[[package]] +name = "opentelemetry-appender-tracing" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12c4bd073648dae8ac45cfc81588d74b3dc5f334119ac08567ddcbfe16f2d809" +dependencies = [ + "once_cell", + "opentelemetry", + "opentelemetry_sdk", + "tracing", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "opentelemetry-otlp" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f24cda83b20ed2433c68241f918d0f6fdec8b1d43b7a9590ab4420c5095ca930" +dependencies = [ + "async-trait", + "futures-core", + "http 0.2.11", + "opentelemetry", + "opentelemetry-proto", + "opentelemetry-semantic-conventions", + "opentelemetry_sdk", + "prost", + "thiserror", + "tokio", + "tonic", +] + +[[package]] +name = "opentelemetry-proto" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2e155ce5cc812ea3d1dffbd1539aed653de4bf4882d60e6e04dcf0901d674e1" +dependencies = [ + "opentelemetry", + "opentelemetry_sdk", + "prost", + "tonic", +] + +[[package]] +name = "opentelemetry-semantic-conventions" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5774f1ef1f982ef2a447f6ee04ec383981a3ab99c8e77a1a7b30182e65bbc84" +dependencies = [ + "opentelemetry", +] + +[[package]] +name = "opentelemetry_sdk" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f16aec8a98a457a52664d69e0091bac3a0abd18ead9b641cb00202ba4e0efe4" +dependencies = [ + "async-trait", + "crossbeam-channel", + "futures-channel", + "futures-executor", + "futures-util", + "glob", + "once_cell", + "opentelemetry", + "ordered-float", + "percent-encoding", + "rand", + "serde_json", + "thiserror", + "tokio", + "tokio-stream", +] + +[[package]] +name = "ordered-float" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a76df7075c7d4d01fdcb46c912dd17fba5b60c78ea480b475f2b6ab6f666584e" +dependencies = [ + "num-traits", +] + [[package]] name = "overload" version = "0.1.1" @@ -549,6 +986,12 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + [[package]] name = "petgraph" version = "0.6.4" @@ -556,7 +999,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap", + "indexmap 2.2.3", +] + +[[package]] +name = "pin-project" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.49", ] [[package]] @@ -565,12 +1028,24 @@ version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "powerfmt" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + [[package]] name = "proc-macro2" version = "1.0.78" @@ -580,6 +1055,29 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "prost" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-derive" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "pyo3" version = "0.20.2" @@ -628,7 +1126,7 @@ dependencies = [ "proc-macro2", "pyo3-macros-backend", "quote", - "syn", + "syn 2.0.49", ] [[package]] @@ -640,7 +1138,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn", + "syn 2.0.49", ] [[package]] @@ -661,6 +1159,36 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + [[package]] name = "redox_syscall" version = "0.4.1" @@ -720,6 +1248,12 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +[[package]] +name = "ryu" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" + [[package]] name = "scopeguard" version = "1.2.0" @@ -734,22 +1268,33 @@ checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" [[package]] name = "serde" -version = "1.0.195" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.195" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.49", +] + +[[package]] +name = "serde_json" +version = "1.0.113" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" +dependencies = [ + "itoa", + "ryu", + "serde", ] [[package]] @@ -761,17 +1306,36 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + [[package]] name = "smallvec" version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +[[package]] +name = "socket2" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" [[package]] name = "strum" @@ -792,20 +1356,37 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn", + "syn 2.0.49", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] name = "syn" -version = "2.0.48" +version = "2.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "915aea9e586f80826ee59f8453c1101f9d1c4b3964cd2460185ee8e299ada496" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + [[package]] name = "target-lexicon" version = "0.12.13" @@ -814,22 +1395,22 @@ checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae" [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.49", ] [[package]] @@ -854,13 +1435,14 @@ dependencies = [ [[package]] name = "time" -version = "0.3.31" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ "deranged", "itoa", "libc", + "num-conv", "num_threads", "powerfmt", "serde", @@ -876,13 +1458,136 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" +checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" dependencies = [ + "num-conv", "time-core", ] +[[package]] +name = "tokio" +version = "1.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "tokio-macros", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-io-timeout" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" +dependencies = [ + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-macros" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.49", +] + +[[package]] +name = "tokio-stream" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "tonic" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3082666a3a6433f7f511c7192923fa1fe07c69332d3c6a2e6bb040b569199d5a" +dependencies = [ + "async-trait", + "axum", + "base64", + "bytes", + "futures-core", + "futures-util", + "h2", + "http 0.2.11", + "http-body", + "hyper", + "hyper-timeout", + "percent-encoding", + "pin-project", + "prost", + "tokio", + "tokio-stream", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "indexmap 1.9.3", + "pin-project", + "pin-project-lite", + "rand", + "slab", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + [[package]] name = "tracing" version = "0.1.40" @@ -914,7 +1619,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.49", ] [[package]] @@ -938,6 +1643,24 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tracing-opentelemetry" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c67ac25c5407e7b961fafc6f7e9aa5958fd297aada2d20fa2ae1737357e55596" +dependencies = [ + "js-sys", + "once_cell", + "opentelemetry", + "opentelemetry_sdk", + "smallvec", + "tracing", + "tracing-core", + "tracing-log", + "tracing-subscriber", + "web-time", +] + [[package]] name = "tracing-subscriber" version = "0.3.18" @@ -953,6 +1676,12 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + [[package]] name = "unicode-ident" version = "1.0.12" @@ -971,6 +1700,12 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + [[package]] name = "utf8parse" version = "0.2.1" @@ -983,11 +1718,26 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + [[package]] name = "wasm-bindgen" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" +checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -995,24 +1745,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" +checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn", + "syn 2.0.49", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" +checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1020,22 +1770,32 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" +checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.49", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.90" +version = "0.2.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" + +[[package]] +name = "web-time" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" +checksum = "aa30049b1c872b72c89866d458eae9f20380ab280ffd1b1e18df2d3e2d98cfe0" +dependencies = [ + "js-sys", + "wasm-bindgen", +] [[package]] name = "winapi" diff --git a/py_rust/Cargo.toml b/py_rust/Cargo.toml index 0f992701..ce01ff39 100644 --- a/py_rust/Cargo.toml +++ b/py_rust/Cargo.toml @@ -17,7 +17,7 @@ path = "src/lib.rs" colored = '2' tracing = "0.1" error-stack = "0.4" -bitbazaar = { version = '0.0.28', features = [] } +bitbazaar = { version = '0.0.31', features = ["opentelemetry"] } pyo3 = { version = '0.20.0', features = ['extension-module', 'chrono', 'generate-import-lib'] } parking_lot = { version = "0.12", features = ['deadlock_detection', 'serde'] } strum = { version = '0.25', features = ['derive'] } diff --git a/py_rust/ruff.toml b/py_rust/ruff.toml index 36c59ae0..0f933959 100644 --- a/py_rust/ruff.toml +++ b/py_rust/ruff.toml @@ -1,4 +1,6 @@ line-length = 100 + +[lint] ignore-init-module-imports = true # Makes unused imports in __init__.py give message to add to __all__ rather than redundant import unfixable = [ # Don't remove unused imports or variables on save, can be quite annoying when writing code: @@ -27,7 +29,7 @@ ignore = [ "RUF010", # Ignore converting f"{str(x)}" to f"{x!s}" simply because it's less obvious and less people know about it ] -[per-file-ignores] +[lint.per-file-ignores] "**/{tests}/**/*" = [ # Don't need docstrings linting for tests "D100", @@ -40,5 +42,5 @@ ignore = [ "D107", ] -[pydocstyle] +[lint.pydocstyle] convention = "google" diff --git a/rust/Cargo.lock b/rust/Cargo.lock index bdb61624..bc636d6b 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -103,7 +103,7 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -236,9 +236,9 @@ checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "d32a994c2b3ca201d9b263612a374263f05e7adde37c4707f693dcd375076d1f" [[package]] name = "bytes" @@ -263,9 +263,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.33" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb" +checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" dependencies = [ "android-tzdata", "iana-time-zone", @@ -278,9 +278,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.18" +version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" +checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da" dependencies = [ "clap_builder", "clap_derive", @@ -288,9 +288,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.18" +version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" +checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb" dependencies = [ "anstream", "anstyle", @@ -300,21 +300,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.4.7" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] name = "clap_lex" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "colorchoice" @@ -465,9 +465,9 @@ dependencies = [ [[package]] name = "either" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" [[package]] name = "equivalent" @@ -578,7 +578,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -652,7 +652,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.11", - "indexmap 2.2.2", + "indexmap 2.2.3", "slab", "tokio", "tokio-util", @@ -679,9 +679,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3" +checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd" [[package]] name = "homedir" @@ -834,9 +834,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.2" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -1013,9 +1013,9 @@ dependencies = [ [[package]] name = "num_threads" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" +checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" dependencies = [ "libc", ] @@ -1043,7 +1043,7 @@ checksum = "1e32339a5dc40459130b3bd269e9892439f55b33e772d2a9d402a789baaf4e8a" dependencies = [ "futures-core", "futures-sink", - "indexmap 2.2.2", + "indexmap 2.2.3", "js-sys", "once_cell", "pin-project-lite", @@ -1182,7 +1182,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.2.2", + "indexmap 2.2.3", ] [[package]] @@ -1202,7 +1202,7 @@ checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1399,7 +1399,7 @@ dependencies = [ "regex", "relative-path", "rustc_version", - "syn 2.0.48", + "syn 2.0.49", "unicode-ident", ] @@ -1472,7 +1472,7 @@ checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1508,7 +1508,7 @@ checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1553,9 +1553,9 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" [[package]] name = "strum" @@ -1576,7 +1576,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1592,9 +1592,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.48" +version = "2.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "915aea9e586f80826ee59f8453c1101f9d1c4b3964cd2460185ee8e299ada496" dependencies = [ "proc-macro2", "quote", @@ -1621,22 +1621,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1742,7 +1742,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1861,7 +1861,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -2031,7 +2031,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", "wasm-bindgen-shared", ] @@ -2053,7 +2053,7 @@ checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2131,7 +2131,7 @@ checksum = "12168c33176773b86799be25e2a2ba07c7aab9968b37541f1094dbd7a60c8946" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -2142,7 +2142,7 @@ checksum = "9d8dc32e0095a7eeccebd0e3f09e9509365ecb3fc6ac4d6f5f14a3f6392942d1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] diff --git a/rust/bitbazaar/cli/bash.rs b/rust/bitbazaar/cli/bash.rs index 410b768f..946325f5 100644 --- a/rust/bitbazaar/cli/bash.rs +++ b/rust/bitbazaar/cli/bash.rs @@ -12,7 +12,7 @@ use crate::prelude::*; /// /// WARNING: this opens up the possibility of dependency injection attacks, so should only be used when the command is trusted. /// If compiled usage is all that's needed, use something like rust_cmd_lib instead, which only provides a macro literal interface. -/// https://github.com/rust-shell-script/rust_cmd_lib +/// /// /// This is a pure rust implementation and doesn't rely on bash being available to make it compatible with windows. /// Given that, it only implements a subset of bash features, and is not intended to be a full bash implementation. diff --git a/rust/bitbazaar/log/global_log/global_fns.rs b/rust/bitbazaar/log/global_log/global_fns.rs index 0605bfc9..5881f089 100644 --- a/rust/bitbazaar/log/global_log/global_fns.rs +++ b/rust/bitbazaar/log/global_log/global_fns.rs @@ -6,9 +6,9 @@ use super::{out::GLOBAL_LOG, GlobalLog}; use crate::prelude::*; #[cfg(feature = "opentelemetry")] -/// Returns a new [Meter] with the provided name and default configuration. +/// Returns a new [`opentelemetry::metrics::Meter`] with the provided name and default configuration. /// -/// A [Meter] should be scoped at most to a single application or crate. The +/// A [opentelemetry::metrics::Meter] should be scoped at most to a single application or crate. The /// name needs to be unique so it does not collide with other names used by /// an application, nor other applications. /// diff --git a/rust/bitbazaar/log/global_log/out.rs b/rust/bitbazaar/log/global_log/out.rs index 46bbb48a..884c6241 100644 --- a/rust/bitbazaar/log/global_log/out.rs +++ b/rust/bitbazaar/log/global_log/out.rs @@ -78,7 +78,7 @@ impl GlobalLog { /// Register the logger as the global logger/tracer/metric manager, can only be done once during the lifetime of the program. /// - /// If you need temporary globality, use the [`GlobalLog::as_tmp_global`] method. + /// If you need temporary globality, use the [`GlobalLog::with_tmp_global`] method. pub fn register_global(mut self) -> Result<(), AnyErr> { if let Some(dispatch) = self.dispatch.take() { // Make it global: @@ -102,7 +102,7 @@ impl GlobalLog { } #[cfg(feature = "opentelemetry")] - /// See [`super::global_fns::update_span_with_http_headers`]` + /// See [`super::global_fns::set_span_parent_from_http_headers`]` pub fn set_span_parent_from_http_headers( &self, span: &tracing::Span, diff --git a/rust/bitbazaar/log/mod.rs b/rust/bitbazaar/log/mod.rs index 819084aa..1a41bf83 100644 --- a/rust/bitbazaar/log/mod.rs +++ b/rust/bitbazaar/log/mod.rs @@ -257,7 +257,7 @@ mod tests { return Ok(()); } - let logpath = PathBuf::from("../logs/otlp.log"); + let logpath = PathBuf::from("../logs/otlp_telemetry_out.log"); let mut cur_str_len = 0; if logpath.exists() { cur_str_len = std::fs::read_to_string(&logpath) diff --git a/zetch.config.toml b/zetch.config.toml index 32e33667..b4379b10 100644 --- a/zetch.config.toml +++ b/zetch.config.toml @@ -19,6 +19,9 @@ PY_RUST_VERSION = { value = "0.0.3" } JS_ALIASES = { value = '{ "@root": "./bitbazaar", "@scripts": "./scripts" }', coerce = "json" } [context.env] -DEBUG = { default = true } +DEBUG = { default = true, coerce = "bool" } +OTLP_OO_ENDPOINT = { default = "http://localhost:5080/api/default/" } +OTLP_OO_AUTH = { default = "Basic ZGV2QGRldi5jb206cGFzcw==" } # Not security issue! This is just base64('dev@dev.com:pass') [context.cli] +ROOT_DIR = { commands = ["pwd"] }