StackStorm / st2

StackStorm (aka "IFTTT for Ops") is event-driven automation for auto-remediation, incident responses, troubleshooting, deployments, and more for DevOps and SREs. Includes rules engine, workflow, 160 integration packs with 6000+ actions (see https://exchange.stackstorm.org) and ChatOps. Installer at https://docs.stackstorm.com/install/index.html
https://stackstorm.com/
Apache License 2.0
6.08k stars 747 forks source link

st2 trace list does not have the correct execution ID. #5563

Open MarlonHeiber opened 2 years ago

MarlonHeiber commented 2 years ago

SUMMARY

st2 trace list does not have the correct execution ID. When an execution is made using the trace-tag, in the list of traces "st2 trace list" the execution ID is wrong in the last character, you can see that Stackstorm is adding the last character +1.

Example: If the id of the execution is 61f98e7f0bd5ceba623a05c6, in the command "st2 trace list" the id of this execution is 61f98e7f0bd5ceba623a05c7

STACKSTORM VERSION

st2 3.6.0.post0, on Python 3.8.10

OS, environment, install method

helm instalation

Steps to reproduce the problem

run commands:

//given st2 run core.local cmd=date --trace-tag="TEST-TRACE" st2 run core.local cmd=date --trace-tag="TEST-TRACE"

//when st2 trace list --trace-tag "TEST-TRACE"

//then st2 execution get

this should work but it doesn't. Because the ID is not the same ID of execution. The stackstorm chaged it adding +1 to the last character of the ID.

Expected Results

The id showing in trace list be correct and be equal of execution ID

Actual Results

The id in trace list is wrong

minsis commented 2 years ago

The ID listed isn't the ID of the execution its the ID of the trace.

$# st2 run core.local cmd=date --trace-tag="TEST-TRACE"
id: 620ff59c6448140d6deaefd4
action.ref: core.local
context.user: st2admin
parameters:
  cmd: date
status: succeeded
start_timestamp: Fri, 18 Feb 2022 19:38:04 UTC
end_timestamp: Fri, 18 Feb 2022 19:38:04 UTC
result:
  failed: false
  return_code: 0
  stderr: ''
  stdout: Fri Feb 18 19:38:04 UTC 2022
  succeeded: true

$# st2 trace list --trace-tag "TEST-TRACE"
+--------------------------+-------------------------------------+------------+-------------------------------+
| id                       | uid                                 | trace_tag  | start_timestamp               |
+--------------------------+-------------------------------------+------------+-------------------------------+
| 620ff5aa6448140d6deaefd8 | trace:1d48828738c2a03962e52c1287bb1 | TEST-TRACE | Fri, 18 Feb 2022 19:38:18 UTC |
|                          | cb7                                 |            |                               |
+--------------------------+-------------------------------------+------------+-------------------------------+

$# st2 trace get 620ff5aa6448140d6deaefd8 --show-executions
id: 620ff5aa6448140d6deaefd8
trace_tag: TEST-TRACE
start_timestamp: Fri, 18 Feb 2022 19:38:18 UTC
+--------------------------+-----------+------------+-----------------------------+
| id                       | type      | ref        | updated_at                  |
+--------------------------+-----------+------------+-----------------------------+
| 620ff5aa6448140d6deaefd7 | execution | core.local | 2022-02-18T19:38:18.950259Z |
+--------------------------+-----------+------------+-----------------------------+

$# st2 execution get 620ff5aa6448140d6deaefd7
id: 620ff5aa6448140d6deaefd7
action.ref: core.local
context.user: st2admin
parameters:
  cmd: date
status: succeeded (1s elapsed)
start_timestamp: Fri, 18 Feb 2022 19:38:18 UTC
end_timestamp: Fri, 18 Feb 2022 19:38:19 UTC
log:
  - status: requested
    timestamp: '2022-02-18T19:38:18.940000Z'
  - status: scheduled
    timestamp: '2022-02-18T19:38:19.091000Z'
  - status: running
    timestamp: '2022-02-18T19:38:19.152000Z'
  - status: succeeded
    timestamp: '2022-02-18T19:38:19.267000Z'
result:
  failed: false
  return_code: 0
  stderr: ''
  stdout: Fri Feb 18 19:38:19 UTC 2022
  succeeded: true