vector icon indicating copy to clipboard operation
vector copied to clipboard

feat(sink: xray) #22749: Add a Sink for AWS X-Ray.

Open johannesfloriangeiger opened this issue 8 months ago • 1 comments

Summary

See title, adds a first version of the Sink for AWS X-Ray for #22749.

Change Type

  • [ ] Bug fix
  • [X] New feature
  • [ ] Non-functional (chore, refactoring, docs)
  • [ ] Performance

Is this a breaking change?

  • [ ] Yes
  • [X] No

How did you test this PR?

Manually (AWS X-Ray is unfortunately a LocalStack Pro feature):

  • Get yourself an AWS account.
  • Run Vector with the attached vector.toml.
  • Run the attached script to send an example trace Vector.
  • Open the AWS console (https://us-east-1.console.aws.amazon.com/cloudwatch/home?region=us-east-1#xray:traces/query for us-east-1), paste the Trace ID from the script output into the search field, "View Trace": You should see the example trace.

vector.toml

[sources.http_server]
type = "http_server"
address = "0.0.0.0:80"
encoding = "json"

[sinks.xray]
type = "xray"
inputs = ["http_server"]

trace.sh

#!/bin/zsh
START_TIME=$(date +%s)
HEX_TIME=$(printf '%x\n' $START_TIME)
GUID=$(dd if=/dev/random bs=12 count=1 2>/dev/null | od -An -tx1 | tr -d ' \t\n')
TRACE_ID="1-$HEX_TIME-$GUID"
ID=$(dd if=/dev/random bs=8 count=1 2>/dev/null | od -An -tx1 | tr -d ' \t\n')
echo $TRACE_ID
curl -d '{"trace_id": "'$TRACE_ID'", "id": "'$ID'", "start_time": '$START_TIME', "end_time": '$START_TIME', "name": "test.elasticbeanstalk.com"}' localhost:80

Does this PR include user facing changes?

  • [X] Yes. Please add a changelog fragment based on our guidelines.
  • [ ] No. A maintainer will apply the "no-changelog" label to this PR.

Checklist

  • [X] Please read our Vector contributor resources.
    • make check-all is a good command to run locally. This check is defined here. Some of these checks might not be relevant to your PR. For Rust changes, at the very least you should run:
      • cargo fmt --all
      • cargo clippy --workspace --all-targets -- -D warnings
      • cargo nextest run --workspace (alternatively, you can run cargo test --all)
  • [X] If this PR introduces changes Vector dependencies (modifies Cargo.lock), please run dd-rust-license-tool write to regenerate the license inventory and commit the changes (if any). More details here.

References

  • Closes: #22749

johannesfloriangeiger avatar Mar 30 '25 18:03 johannesfloriangeiger

Hi @johannesfloriangeiger, thanks for this contribution. It looks good. We will need some documentation files. See a recent example here (all files under website): https://github.com/vectordotdev/vector/pull/22609/files#diff-2d2f5bfaa29c6451fe72bf7b0408b9044f9652bf6cb43159fac277781814411a

Note that base/ is generated by make generate-component-docs

Thanks, I've added some files but I am not sure if that's sufficient or if there's something missing, are you able to cross check that for me?

johannesfloriangeiger avatar May 17 '25 16:05 johannesfloriangeiger

Hi @johannesfloriangeiger, there's a few conflicts and some open review comments. Don't hesitate to ping us (@vectordotdev/vector) when this is ready for another review.

pront avatar Jul 01 '25 16:07 pront