MCPcopy Create free account
hub / github.com/StackStorm/st2 / TraceDB

Class TraceDB

st2common/st2common/models/db/trace.py:52–126  ·  view source on GitHub ↗

Trace is a collection of all TriggerInstances, Rules and ActionExecutions that represent an activity which begins with the introduction of a TriggerInstance or request of an ActionExecution and ends with the completion of an ActionExecution. Given the closed feedback look sort of

Source from the content-addressed store, hash-verified

50
51
52class TraceDB(stormbase.StormFoundationDB, stormbase.UIDFieldMixin):
53 """
54 Trace is a collection of all TriggerInstances, Rules and ActionExecutions
55 that represent an activity which begins with the introduction of a
56 TriggerInstance or request of an ActionExecution and ends with the
57 completion of an ActionExecution. Given the closed feedback look sort of
58 nature of StackStorm this implies a Trace can comprise of multiple
59 TriggerInstances, Rules and ActionExecutions.
60
61 :param trace_tag: A user specified reference to the trace.
62
63 :param trigger_instances: TriggerInstances associated with this trace.
64
65 :param rules: Rules associated with this trace.
66
67 :param action_executions: ActionExecutions associated with this trace.
68 """
69
70 RESOURCE_TYPE = ResourceType.TRACE
71
72 trace_tag = me.StringField(
73 required=True, help_text="A user specified reference to the trace."
74 )
75 trigger_instances = me.ListField(
76 field=me.EmbeddedDocumentField(TraceComponentDB),
77 required=False,
78 help_text="Associated TriggerInstances.",
79 )
80 rules = me.ListField(
81 field=me.EmbeddedDocumentField(TraceComponentDB),
82 required=False,
83 help_text="Associated Rules.",
84 )
85 action_executions = me.ListField(
86 field=me.EmbeddedDocumentField(TraceComponentDB),
87 required=False,
88 help_text="Associated ActionExecutions.",
89 )
90 start_timestamp = ComplexDateTimeField(
91 default=date_utils.get_datetime_utc_now,
92 help_text="The timestamp when the Trace was created.",
93 )
94
95 meta = {
96 "indexes": [
97 {"fields": ["trace_tag"]},
98 {"fields": ["start_timestamp"]},
99 {"fields": ["action_executions.object_id"]},
100 {"fields": ["trigger_instances.object_id"]},
101 {"fields": ["rules.object_id"]},
102 {"fields": ["-start_timestamp", "trace_tag"]},
103 ]
104 }
105
106 def __init__(self, *args, **values):
107 super(TraceDB, self).__init__(*args, **values)
108 self.uid = self.get_uid()
109

Callers 4

_create_save_traceMethod · 0.90
_create_save_traceMethod · 0.90

Calls 1

Tested by 2

_create_save_traceMethod · 0.72
_create_save_traceMethod · 0.72