def get_trace_component_for_trigger_instance(trigger_instance_db):
    """
    Returns the trace_component compatible dict representation of a triggerinstance.

    :param trigger_instance_db: The TriggerInstance to translate
    :type trigger_instance_db: TriggerInstanceDB

    :rtype: ``dict``
    """
    trace_component = {}
    trace_component = {
        "id": str(trigger_instance_db.id),
        "ref": trigger_instance_db.trigger,
    }
    caused_by = {}
    # Special handling for ACTION_SENSOR_TRIGGER and NOTIFY_TRIGGER where we
    # know how to maintain the links.
    if (
        trigger_instance_db.trigger == ACTION_SENSOR_TRIGGER_REF
        or trigger_instance_db.trigger == NOTIFY_TRIGGER_REF
    ):
        caused_by["type"] = "action_execution"
        # For both action trigger and notidy trigger execution_id is stored in the payload.
        caused_by["id"] = trigger_instance_db.payload["execution_id"]
    trace_component["caused_by"] = caused_by
    return trace_component

    Returns the trace_component compatible dict representation of a triggerinstance.

    :param trigger_instance_db: The TriggerInstance to translate
    :type trigger_instance_db: TriggerInstanceDB

    :rtype: ``dict``
    
st2common/st2common/services/trace.py