This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.

⚠️ We've moved!

Hi there!

To reduce project dependency on 3rd party paid services the StackStorm TSC has decided to move the Q/A from this forum to Github Discussions. This will make user experience better integrated with the native Github flow, as well as the questions closer to the community where they can provide answers.

Use 🔗 Github Discussions to ask your questions.

Is there a way to access the trace tag of the rule execution from the rule execution itself

I want to know if I can access the trace tag from within a rule definition via jinja interpolation.

Not really. Why do you want to do this?

I have a task in my workflow that is used to email admins if previous tasks within an orquesta workflow failed. In the email, it would really be handy to tell the admins what trace tag the current workflow is operating under.

This looks useful. Please open an issue at the st2 repo and request the feature.

1 Like

Posted a feature request: Make trace info available from within an orquesta workflow definition · Issue #4627 · StackStorm/st2 · GitHub

For future people: You can actually do this now, but using curl as a workaround e.g. within orquesta:

  get_tracetag:
    action: core.local
    input:
      cmd: >
        curl
        -X GET
        -H 'Connection: keep-alive'
        -H 'Accept-Encoding: gzip, deflate'
        -H 'Accept: application/json'
        -H "X-Auth-Token: ${ST2_ACTION_AUTH_TOKEN}"
        "${ST2_ACTION_API_URL}/traces/?execution=${ST2_ACTION_EXECUTION_ID}&limit=50&sort_desc=True"
        | jq -r '.[0].trace_tag'
        | tr -d '\n\t '
      timeout: 60
    next:
      - publish:
          - get_tracetag_result: "{{ result() }}"
          - trace_tag: "{{ result().stdout }}"
        do: notify

(You’d have to install jq first for the above to work on a typical linux system.)

This is possible because of environment variables available to actions.

@djhaskin987 Thank you for this workaround.