示例#1
0
    def span_event(self,
                   settings,
                   base_attrs=None,
                   parent_guid=None,
                   attr_class=dict):
        i_attrs = base_attrs and base_attrs.copy() or attr_class()
        i_attrs['type'] = 'Span'
        i_attrs['name'] = self.name
        i_attrs['guid'] = self.guid
        i_attrs['timestamp'] = int(self.start_time * 1000)
        i_attrs['duration'] = self.duration
        i_attrs['category'] = 'generic'

        if parent_guid:
            i_attrs['parentId'] = parent_guid

        a_attrs = attribute.resolve_agent_attributes(self.agent_attributes,
                                                     settings.attribute_filter,
                                                     DST_SPAN_EVENTS,
                                                     attr_class=attr_class)

        u_attrs = attribute.resolve_user_attributes(
            self.processed_user_attributes,
            settings.attribute_filter,
            DST_SPAN_EVENTS,
            attr_class=attr_class)

        # intrinsics, user attrs, agent attrs
        return [i_attrs, u_attrs, a_attrs]
示例#2
0
    def get_trace_segment_params(self, settings, params=None):
        _params = attribute.resolve_agent_attributes(self.agent_attributes,
                                                     settings.attribute_filter,
                                                     DST_TRANSACTION_SEGMENTS)

        if params:
            _params.update(params)

        _params.update(
            attribute.resolve_user_attributes(self.processed_user_attributes,
                                              settings.attribute_filter,
                                              DST_TRANSACTION_SEGMENTS))

        _params['exclusive_duration_millis'] = 1000.0 * self.exclusive
        return _params