Skip to content

add functionality for --force-parent-span-id#241

Merged
tobert merged 6 commits into
equinix-labs:mainfrom
domofactor:add-force-parent-span-id
Jul 14, 2023
Merged

add functionality for --force-parent-span-id#241
tobert merged 6 commits into
equinix-labs:mainfrom
domofactor:add-force-parent-span-id

Conversation

@domofactor

Copy link
Copy Markdown
Contributor

similar to --force-trace-id and --force-span-id, this PR adds the ability to specify --force-parent-span-id or OTEL_CLI_FORCE_PARENT_SPAN_ID to override a parent span id.

cc/ #240

@tobert tobert left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR overall is high quality and matches the code around it. Thank you!

The "parentdeadbeef" issue I noted in comments is a mistake I made in parseHex() or elsewhere that will need a follow-up. I'm inclined to merge this as-is, and follow up with another PR to fix the hex parsing issue.

Comment thread README.md Outdated
| --attrs | OTEL_CLI_ATTRIBUTES | span_attributes | k=v,a=b |
| --force-trace-id | OTEL_CLI_FORCE_TRACE_ID | force_trace_id | 00112233445566778899aabbccddeeff |
| --force-span-id | OTEL_CLI_FORCE_SPAN_ID | force_span_id | beefcafefacedead |
| --force-parent-span-id | OTEL_CLI_FORCE_PARENT_SPAN_ID | force_parent_span_id | parentbeefcafede |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor nitpick, "parentbeefcafede" isn't hex

Comment thread data_for_test.go Outdated
"--endpoint", "{{endpoint}}",
"--force-trace-id", "00112233445566778899aabbccddeeff",
"--force-span-id", "beefcafefacedead",
"--force-parent-span-id", "parentbeefcafede",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

following off prior comment, if this passes, we have a test & safety gap allowing non-hex to pass through

}
if c.ForceParentSpanId != "" {
span.ParentSpanId, err = parseHex(c.ForceParentSpanId, 8)
c.SoftFailIfErr(err)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why this isn't failing?

I'm really glad you built the test this way, this should be failing and it's problematic if it's not.

@tobert tobert left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad for thinking tests passed before. They don't. I think if you update the test case to be hex it'll work fine.

@domofactor

Copy link
Copy Markdown
Contributor Author

hey @tobert, thanks for the feedback. I pushed that change from string to hex, so hopefully it should pass now. 🤞

@domofactor
domofactor requested a review from tobert July 14, 2023 05:53
Comment thread README.md Outdated
Comment thread data_for_test.go Outdated
Comment thread data_for_test.go Outdated

@tobert tobert left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed a few more changes and a fix to get this ready to merge. Thanks!

@tobert
tobert merged commit 0cb7f5a into equinix-labs:main Jul 14, 2023
@domofactor
domofactor deleted the add-force-parent-span-id branch September 7, 2023 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants