def _update_trace(self):
        """
        :rtype: ``dict`` trace_context as a dict; could be None
        """
        trace_db = None
        try:
            trace_db = trace_service.get_trace_db_by_trigger_instance(
                self.trigger_instance
            )
        except:
            LOG.exception(
                "No Trace found for TriggerInstance %s.", self.trigger_instance.id
            )
            return None

        # This would signify some sort of coding error so raise ValueError.
        if not trace_db:
            raise ValueError("Trace database not found.")

        trace_db = trace_service.add_or_update_given_trace_db(
            trace_db=trace_db,
            rules=[
                trace_service.get_trace_component_for_rule(
                    self.rule, self.trigger_instance
                )
            ],
        )
        return vars(TraceContext(id_=str(trace_db.id), trace_tag=trace_db.trace_tag))

        :rtype: ``dict`` trace_context as a dict; could be None
        
st2reactor/st2reactor/rules/enforcer.py