-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cmd/telemetrygen] remove reliance on JSON unmarshalling for status c…
…ode string (#26985) Removes the use of JSON Unmarshalling when determining the provided trace status code. The existing implementation allowed both status code and status strings to be set using the command line flag `--status-code` without issue however it's not obvious that the default command line value must be a JSON string as encountered in #25906 I've replaced the existing code with a switch-case statement which is more explicit. Additionally, the code now checks the lowercase version of the provided string, enabling support for mixed-case inputs such as `--status-code unset` and `--status-code Unset` flags. I'm undecided if this is actually better or required since we now understand the original cause of the issue. Example usage is now: ``` telemetrygen traces --otlp-insecure --traces 1 --status-code 0 # unset telemetrygen traces --otlp-insecure --traces 1 --status-code 1 # error telemetrygen traces --otlp-insecure --traces 1 --status-code 2 # ok telemetrygen traces --otlp-insecure --traces 1 --status-code unset telemetrygen traces --otlp-insecure --traces 1 --status-code error telemetrygen traces --otlp-insecure --traces 1 --status-code ok ``` Fixes #25906 Added additional test cases and implemented sub-tests as the tests were quitting after the first falsified case. --------- Co-authored-by: Ziqi Zhao <[email protected]> Co-authored-by: Pablo Baeyens <[email protected]>
- Loading branch information
1 parent
a319a5b
commit 9898c2a
Showing
3 changed files
with
73 additions
and
35 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
.chloggen/fix_telemetrygen-trace-status-code-parameter.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: bug_fix | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) | ||
component: telemetrygen | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: remove need for JSON unmarshalling of trace status codes and unsupport mixed case input | ||
|
||
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. | ||
issues: [25906] | ||
|
||
# (Optional) One or more lines of additional information to render under the primary note. | ||
# These lines will be padded with 2 spaces and then inserted directly into the document. | ||
# Use pipe (|) for multiline entries. | ||
subtext: | ||
|
||
# If your change doesn't affect end users or the exported elements of any package, | ||
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. | ||
# Optional: The change log or logs in which this entry should be included. | ||
# e.g. '[user]' or '[user, api]' | ||
# Include 'user' if the change is relevant to end users. | ||
# Include 'api' if there is a change to a library API. | ||
# Default: '[user]' | ||
change_logs: [ user ] |
This file contains 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
This file contains 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