Skip to content

Conversation

@GabrielBuica
Copy link
Contributor

@GabrielBuica GabrielBuica commented May 15, 2024

Adds the possibility of xe commands to pass a traceparent.

This can be done through the following ways:

  • a command arg: xe <cmd> --traceparent <traceparent> (or xe <cmd> traceparent=<traceparent>);
  • a environment variable: TRACEPARENT=<traceparent>:
  • specifying traceparent=<traceparent> in .xe.

Priority is given in the same order as above.

This should enable creating a single trace from the xe-cli caller through xapi.

let extras_rest = process_args extras in
(*if traceparent is set as env var update it after we process the extras.*)
Option.iter
(fun tp -> traceparent := Some tp)
Copy link
Member

Choose a reason for hiding this comment

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

The cli argument must take precedence over the environment variable, which usually takes preference over the contents of the configuration file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is what it does: it sets the values from configuration files, then overwrites them with the values from environment variables and then again with values from the cli argument. process_args calls set_keyword to achieve this.

This line is separate because it reads and process TRACEPARENT env var after it processes XE_EXTRA_ARGS.

@GabrielBuica GabrielBuica force-pushed the private/dbuica/CP-45235 branch from d3d880c to ffb24e9 Compare May 15, 2024 13:53
@GabrielBuica GabrielBuica force-pushed the private/dbuica/CP-45235 branch from 24681d7 to 5aa4494 Compare May 20, 2024 14:40
Adds the possibility of `xe` commands to pass a `traceparent`.

This can be done through the following ways:

- a command arg: `xe <cmd> --traceparent <traceparent>`;
- a environment variable: `TRACEPARENT=<traceparent>`:
- specifying `traceparent=<traceparent>` in `.xe`.

Priority is given in the same order as above.

This should enable creating a single trace from the `xe-cli` caller
through `xapi`.

Signed-off-by: Gabriel Buica <danutgabriel.buica@cloud.com>
@GabrielBuica GabrielBuica force-pushed the private/dbuica/CP-45235 branch from 5aa4494 to dab475d Compare June 4, 2024 13:02
@GabrielBuica
Copy link
Contributor Author

Rebased it on master. Passes BVT+BST 199170

@psafont psafont merged commit 190df63 into xapi-project:master Jun 6, 2024
@GabrielBuica GabrielBuica deleted the private/dbuica/CP-45235 branch January 8, 2025 10:50
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.

3 participants