Repository navigation
Conversation
SaiAbhishek98
force-pushed
the
feature/third-party-telemetry-export
branch
3 times, most recently
from
November 9, 2026 21:08
049e6e4 to
34f8626
Compare
SaiAbhishek98
marked this pull request as ready for review
November 9, 2026 21:43
SaiAbhishek98
force-pushed
the
feature/third-party-telemetry-export
branch
from
November 13, 2026 18:31
34f8626 to
e997e5a
Compare
ferdingler
reviewed
Nov 13, 2026
SaiAbhishek98
force-pushed
the
feature/third-party-telemetry-export
branch
from
November 14, 2026 00:04
e924135 to
46a389b
Compare
…atch Box sends telemetry to a file, or to an OTLP endpoint that takes one bearer secret. It cannot send to CloudWatch Logs or X-Ray, because they need SigV4. It cannot send correctly to Langfuse or LangSmith, because each one needs its own path, headers and credential placement. - The telemetry crate exports OTLP directly to each target. Each target has its own credentials vault. The vault attaches the credential as a header, as HTTP Basic auth, or as a SigV4 signature for `logs` or `xray`. A target can name the payloads that it accepts (`accepts`) and fixed headers (`headers`). With `STRANDS_BOX_TELEMETRY_DEBUG` set, a failed export prints its full cause. - `box.toml` takes four vendor kinds: `langfuse`, `langsmith`, `cloudwatch_logs` and `cloudwatch_traces`. Box expands each kind into the `otlp` target that it stands for, and stores that target. The operator writes only the destination or the region, the project or the log group and stream, and `secret.ref`. A vendor kind refuses each field that it sets itself. - A telemetry `secret.ref` can name `env://`, `file://`, `op://`, `aws://` or `credsd://`. - `team/designs/0004-third-party-telemetry.md` describes the design. - Interface changes, approved for this work: the telemetry keys `accepts`, `headers`, `log_group`, `log_stream`, `project`, `region`, `secret.placement` and `secret.prefix`; the four vendor kinds; the `STRANDS_BOX_TELEMETRY_DEBUG` variable. - `cargo test --all-features`: strands-box-telemetry 92, strands-box telemetry config 18, strands-box `box_telemetry` 27, strands-box-credentials 234. All pass. New tests: `a_vendor_kind_expands_to_its_otlp_target`, `a_vendor_kind_refuses_what_it_sets_or_lacks`, `a_file_or_op_secret_is_accepted_with_a_placement`, `a_cloudwatch_logs_target_is_signed_for_logs`, `an_xray_target_is_signed_for_xray`, `the_vault_attaches_basic_auth`, `the_vault_attaches_an_api_key_header`, `a_traces_only_target_is_sent_no_other_payload` and `a_transport_failure_names_its_cause`. - End to end on macOS: a box sent 8 records to each of CloudWatch Logs, X-Ray, Langfuse and LangSmith, with the vendor keys in `env://` and an AWS profile for SigV4. No export failed. - `cargo clippy` adds no warnings outside `crates/shell`, and `cargo fmt --check` passes. - Not run: `feature-critic`. `RECORD_VERSION` is not changed, because the record gains only optional fields.
The review of the telemetry export found these gaps: - The stored record gained new telemetry fields, but its version did not change. An earlier build could resume the box and send without the vendor's headers. - A telemetry credential could not be bound to an IPv6 destination, which `main` accepted. - A telemetry `aws://` or `credsd://` credential was not checked at startup. A profile that cannot sign failed every batch after the workload started. - The telemetry crate read `STRANDS_BOX_TELEMETRY_DEBUG` itself, against its own README. - A telemetry `secret.ref` could name `file://` or `op://`. The workload can swap a file that it can reach, and `op` runs from the trusted process's `PATH`. - Telemetry kept its own copy of the egress placement vocabulary. - The user docs, the crate README and two `decisions.md` entries still described two kinds and unconditional logs and metrics. - A record whose telemetry target uses `accepts`, `headers`, `secret.prefix`, `secret.placement`, or a secret that is not `env://` or `secret://` stores `TELEMETRY_EXPORT_RECORD_VERSION` (36). Other records keep their version, so an earlier build still resumes them, and this build still reads a record that an earlier build wrote. - `DestinationPattern::ipv6` binds one IPv6 address and port. Telemetry uses it for an IPv6 destination. The egress `destinations` vocabulary does not change. - At startup, the credsd preflight also reads the telemetry `credsd://` environments. Each telemetry `aws://` target signs one request that is not sent, for the URL that the exporter dials. A failure stops the run before the workload starts. - `strands-box run` reads `STRANDS_BOX_TELEMETRY_DEBUG` and passes it in with `TelemetryConfig::reporting_failures`. - A telemetry `secret.ref` takes only `env://`, `secret://`, `aws://` and `credsd://`. - Telemetry uses the egress `Placement` and the shared placement constants. - `docs/user/config.md` and `docs/user/telemetry.md` describe the vendor kinds, the new keys, the refusals, the startup check and the debug variable. `docs/user/native-filesystem-policy.md` names record version 25 and its rollback step. The crate README, the crate AGENTS.md and `docs/design/telemetry.md` are updated. `decisions.md#a-target-is-a-file-or-an-otlp-endpoint` and `decisions.md#a-target-names-a-set-of-signals` now state the vendor kinds and `accepts`, and `decisions.md#delivery-is-best-effort` states when a lost record is printed. - `cargo test --workspace --all-features`: 4607 passed, 0 failed, 16 ignored. - New tests: `a_vendor_telemetry_target_stores_a_version_no_earlier_build_reads`, `a_bearer_telemetry_target_keeps_the_ordinary_version`, `an_earlier_record_with_a_secret_alias_still_parses`, `the_aws_preflight_reads_a_schemeless_destination_as_the_exporter_dials_it`, `an_ipv6_pattern_matches_its_address_and_port`, `the_vault_attaches_a_credential_on_an_ipv6_address`, `a_file_or_op_secret_is_refused`, `the_credsd_environments_are_the_distinct_signing_ones`, and in `box_telemetry`: `a_langfuse_kind_sends_spans_where_langfuse_takes_them`, `the_debug_variable_prints_a_failed_export_and_its_cause`, `a_telemetry_profile_that_cannot_sign_stops_the_run` and `a_telemetry_credsd_environment_without_a_daemon_stops_the_run`. - `cargo fmt --all --check` passes. `cargo clippy` adds no warnings outside `crates/shell`. - `feature-critic` ran on this change. Its first verdict was rework, for a `secret://` record that this change stamped with version 25. The fix is above. Its confirmation pass gave ship. It found the crate API additions `Payload`, `Target::accepting`, `Target::with_header`, `Target::with_vault`, `TelemetryConfig::reporting_failures` and `DestinationPattern::ipv6`, and they wait for the owner's review. - The containment suite `test-integ/run.sh` on macOS: GREEN, 140 cases, 128 pass, 0 fail, 12 skip (Linux only). - Not compiled for Linux. The change adds no `cfg`-gated code.
## Problem Section 4 of `team/designs/0004-third-party-telemetry.md` says that a telemetry key can come from `file://` and `op://`. A telemetry target now refuses both, and Box checks each `aws://` and `credsd://` credential at startup. The section does not say either. ## Solution Section 4 names the three sources a telemetry target reads, says why it refuses `file://` and `op://`, and says that Box checks a signing credential before the workload starts. ## Tests None. The change is to a design document only.
…lookup ## Problem An inspection of the export path found three faults: - With `STRANDS_BOX_TELEMETRY_DEBUG` set, the error report quotes the answer of the endpoint. An endpoint that echoes a refused API key in its answer thus put the key on stderr. - The vault signed the URL as the operator wrote it, but `reqwest` removes a default port and changes the host to lowercase before it sends the request. A destination such as `https://logs.us-west-2.amazonaws.com:443` or one with an uppercase host thus got a signature for a different `Host`, and the endpoint refused it. - The four-second deadline started after the credential lookup. A slow `credsd` lookup was thus not bounded. The lookup also ran in the blocking pool of the runtime, so runtime shutdown waited for a lookup that the export had stopped. ## Solution - The error report replaces each credential that Box attached in the answer of the endpoint with `[REDACTED]`: each value, each token of it, and for HTTP Basic the decoded pair and each half. - The vault signs the URL after `url` parses it, which is the URL that `reqwest` sends. - One deadline covers the credential lookup and the send. The lookup runs on a thread that the runtime does not own, so the runtime does not wait for it at shutdown. - `docs/user/telemetry.md` and `docs/user/config.md` say that the deadline covers the lookup, and that the error report redacts each credential that Box attached. - The telemetry crate declares the tokio `time` feature and `base64` as dependencies. These add no package to `Cargo.lock`. ## Tests - New tests: `a_failure_report_redacts_an_echoed_credential`, `a_signature_covers_the_url_the_client_sends` and `a_slow_credential_lookup_is_bounded_and_does_not_hold_shutdown`. Each one fails when its fix is removed. - `cargo test -p strands-box-telemetry --all-features --lib`: 107 passed, 0 failed. - `cargo test -p strands-box --all-features --test box_telemetry`: 32 passed, 0 failed. - `cargo fmt --all --check` and `cargo build --workspace --all-features --locked` have no errors. `cargo clippy` adds no warnings in crates other than `crates/shell`.
SaiAbhishek98
force-pushed
the
feature/third-party-telemetry-export
branch
from
November 16, 2026 19:47
46a389b to
3c22ea7
Compare
ferdingler
approved these changes
Nov 17, 2026
hanaduy
added a commit
that referenced
this pull request
Nov 17, 2026
One conflict, in crates/box/src/record/config/mod.rs: main's telemetry export (#314) took record version 36, which this branch used for monty = false. Telemetry export keeps 36; monty = false moves to 37 and stays the first check in record_version(), since it is now the highest. The monty test's too-old version, decisions.md and config.md now say 37.
This was referenced Nov 17, 2026
7 of 8 tasks
7 of 8 tasks
13 of 17 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Box sends telemetry to a file, or to an OTLP endpoint that takes one bearer secret. It cannot send to CloudWatch Logs or X-Ray, because they need SigV4. It cannot send correctly to Langfuse or LangSmith, because each one needs its own path, headers and credential placement.
This PR adds two things:
logsorxray. A target can name the payloads that it accepts (accepts), and fixed headers (headers).box.toml.kindcan belangfuse,langsmith,cloudwatch_logsorcloudwatch_traces. The operator writes only the destination or the region, the project or the log group and stream, andsecret.ref. Box expands each kind into theotlptarget that it stands for, and stores that target.A telemetry
secret.refcan nameenv://,secret://,aws://orcredsd://. It refusesfile://andop://.The design is in
team/designs/0004-third-party-telemetry.md.Decisions that the diff does not show
headers,accepts,secret.header,secret.prefixandsecret.placement. It also names each field that it needs and does not have.secret.refrefusesfile://andop://. The workload can swap a file that it can reach, andopruns from thePATHof the trusted process.aws://andcredsd://credential before the workload starts. A signed credential resolves on each request, so without the check a profile that cannot sign would fail every batch after the workload starts. Eachaws://target signs one request that Box does not send, and thecredsd://environments join the existing credsd preflight.TELEMETRY_EXPORT_RECORD_VERSION). An earlier build refuses that record, instead of sending without the vendor's headers. A target that uses only the settings onmainkeeps version 21, so an earlier build still resumes it.main, the drain reports the count of lost records one time on stderr. WithSTRANDS_BOX_TELEMETRY_DEBUGset, Box also prints each failed send with its full cause.the_debug_variable_prints_a_failed_export_and_its_causechecks both.STRANDS_BOX_TELEMETRY_DEBUGset, Box quotes the start of the answer of a refusing endpoint. Before it does, it replaces each credential that it attached with[REDACTED]: each value, each token of it, and for HTTP Basic the decoded pair and each half. Thus an endpoint that echoes a refused key does not put the key on stderr.reqwestremoves a default port and changes the host to lowercase. The vault thus signs the URL afterurlparses it, and a destination such ashttps://logs.us-west-2.amazonaws.com:443gets a signature for theHostthat it sends.credsdlookup cannot hold the runtime open at shutdown.DestinationPattern::ipv6binds the address and port. The egressdestinationsvocabulary does not change.Interface changes
These change frozen surfaces:
box.tomltelemetry keys:accepts,headers,log_group,log_stream,project,region,secret.placementandsecret.prefix.box.tomltelemetry kinds:langfuse,langsmith,cloudwatch_logsandcloudwatch_traces.secret.refacceptsaws://andcredsd://, besideenv://andsecret://.aws://profile cannot sign or acredsd://environment fails.STRANDS_BOX_TELEMETRY_DEBUG, which prints the full cause of a failed export.publish = false):telemetry::Payload,Target::accepting,Target::with_header,Target::with_vault,TelemetryConfig::reporting_failuresandcredentials::DestinationPattern::ipv6.Verified outside CI
During local testing from Mac, the box sent 8 records to each of CloudWatch Logs, X-Ray, Langfuse and LangSmith. The vendor keys came from
env://, and an AWS profile signed the CloudWatch requests. No export failed.Deferred
cfg-gated code. Before the rebase onto8c56aa8, the CI unit tests passed onubuntu-24.04-armandmacos-latest. TheCI Gatefails on a draft by design, because the containment suite does not run on a draft.Related Issues
None.
Type of Change
New feature
Testing
How have you tested the change? Verify that the changes do not break functionality or introduce new warnings.
just check, orcargo test --workspace --all-features)cargo fmt --allandcargo clippy --workspace --all-targets --all-features -- -D warningsResults on this branch, which is based on
mainat8c56aa8:cargo test -p strands-box-telemetry --all-features --lib: 107 passed.cargo test -p strands-box --all-features --lib -- record::config run::: 987 passed, 1 ignored.cargo build --workspace --all-features --locked --testshas no errors.Results on an earlier base,
mainat70eb3af:cargo test --workspace --all-features --no-fail-fast: 5240 passed, 2 failed, 19 ignored. Both failures are timing checks that ran while a second build used the same Mac, and neither is in code that this PR changes. Each one passed 3 of 3 runs alone:a_stuck_request_does_not_block_a_healthy_one(crates/box/tests/box_programs.rs).e2b_a_non_yielding_request_does_not_delay_a_concurrent_one(crates/box/tests/box_cardinality.rs).cargo test -p strands-box --test box_telemetry: 32 passed, 1 ignored.test-integ/run.shon macOS: GREEN. 141 cases: 129 pass, 0 fail, 12 skip (Linux only).cargo fmt --all --check: passes.cargo clippy --workspace --all-targets --all-featuresreports 17 warnings, all incrates/shell. This PR does not changecrates/shell.feature-criticran on this change. Its first verdict was rework. The second commit fixes each finding, and the confirmation pass gave ship.a_vendor_kind_expands_to_its_otlp_target,a_vendor_kind_refuses_what_it_sets_or_lacks, and through the binary,a_langfuse_kind_sends_spans_where_langfuse_takes_them.a_cloudwatch_logs_target_is_signed_for_logs,an_xray_target_is_signed_for_xray,the_vault_attaches_basic_auth,the_vault_attaches_an_api_key_header,a_file_or_op_secret_is_refused,an_ipv6_pattern_matches_its_address_and_portandthe_vault_attaches_a_credential_on_an_ipv6_address.a_telemetry_profile_that_cannot_sign_stops_the_run,a_telemetry_credsd_environment_without_a_daemon_stops_the_run,the_credsd_environments_are_the_distinct_signing_onesandthe_aws_preflight_reads_a_schemeless_destination_as_the_exporter_dials_it.a_vendor_telemetry_target_stores_a_version_no_earlier_build_reads,a_bearer_telemetry_target_keeps_the_ordinary_versionandan_earlier_record_with_a_secret_alias_still_parses.a_traces_only_target_is_sent_no_other_payload,a_transport_failure_names_its_causeand, through the binary,the_debug_variable_prints_a_failed_export_and_its_cause.a_failure_report_redacts_an_echoed_credential,a_signature_covers_the_url_the_client_sendsanda_slow_credential_lookup_is_bounded_and_does_not_hold_shutdown. Each one fails when its fix is removed.Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.