Exemplo n.º 1
0
    def agent_attributes(self):
        ms_attrs = {}

        if self.exchange_type is not None:
            ms_attrs['message.exchangeType'] = self.exchange_type
        if self.queue_name is not None:
            ms_attrs['message.queueName'] = self.queue_name
        if self.reply_to is not None:
            ms_attrs['message.replyTo'] = self.reply_to
        if self.correlation_id is not None:
            ms_attrs['message.correlationId'] = self.correlation_id
        if self.headers:
            for k, v in self.headers.items():
                new_key = 'message.headers.%s' % k
                new_val = str(v)
                ms_attrs[new_key] = new_val
        if self.routing_key is not None:
            ms_attrs['message.routingKey'] = self.routing_key

        messagebroker_attributes = create_agent_attributes(ms_attrs,
                self.attribute_filter)

        attributes = super(MessageTransaction, self).agent_attributes
        attributes.extend(messagebroker_attributes)

        return attributes
Exemplo n.º 2
0
    def agent_attributes(self):
        a_attrs = {}
        settings = self._settings
        req_env = self._request_environment

        if req_env.get('HTTP_ACCEPT', None):
            a_attrs['request.headers.accept'] = req_env['HTTP_ACCEPT']
        if req_env.get('CONTENT_LENGTH', None):
            a_attrs['request.headers.contentLength'] = \
                    req_env['CONTENT_LENGTH']
        if req_env.get('CONTENT_TYPE', None):
            a_attrs['request.headers.contentType'] = req_env['CONTENT_TYPE']
        if req_env.get('HTTP_HOST', None):
            a_attrs['request.headers.host'] = req_env['HTTP_HOST']
        if req_env.get('HTTP_REFERER', None):
            a_attrs['request.headers.referer'] = req_env['HTTP_REFERER']
        if req_env.get('HTTP_USER_AGENT', None):
            a_attrs['request.headers.userAgent'] = req_env['HTTP_USER_AGENT']
        if req_env.get('REQUEST_METHOD', None):
            a_attrs['request.method'] = req_env['REQUEST_METHOD']

        resp_props = self._response_properties

        if resp_props.get('CONTENT_LENGTH', None):
            a_attrs['response.headers.contentLength'] = \
                    resp_props['CONTENT_LENGTH']
        if resp_props.get('CONTENT_TYPE', None):
            a_attrs['response.headers.contentType'] = \
                    resp_props['CONTENT_TYPE']
        if resp_props.get('STATUS', None):
            a_attrs['response.status'] = resp_props['STATUS']

        if self.read_duration != 0:
            a_attrs['wsgi.input.seconds'] = self.read_duration
        if self._bytes_read != 0:
            a_attrs['wsgi.input.bytes'] = self._bytes_read
        if self._calls_read != 0:
            a_attrs['wsgi.input.calls.read'] = self._calls_read
        if self._calls_readline != 0:
            a_attrs['wsgi.input.calls.readline'] = self._calls_readline
        if self._calls_readlines != 0:
            a_attrs['wsgi.input.calls.readlines'] = self._calls_readlines

        if self.sent_duration != 0:
            a_attrs['wsgi.output.seconds'] = self.sent_duration
        if self._bytes_sent != 0:
            a_attrs['wsgi.output.bytes'] = self._bytes_sent
        if self._calls_write != 0:
            a_attrs['wsgi.output.calls.write'] = self._calls_write
        if self._calls_yield != 0:
            a_attrs['wsgi.output.calls.yield'] = self._calls_yield

        if self._settings.process_host.display_name:
            a_attrs['host.displayName'] = settings.process_host.display_name
        if self._thread_utilization_value:
            a_attrs['thread.concurrency'] = self._thread_utilization_value
        if self.queue_wait != 0:
            a_attrs['webfrontend.queue.seconds'] = self.queue_wait

        agent_attributes = create_agent_attributes(a_attrs,
                self.attribute_filter)

        # Include request parameters in agent attributes

        agent_attributes.extend(self.request_parameters_attributes)

        return agent_attributes