Repository: jina-ai/jina
File: jina/serve/runtimes/request_handlers/worker_request_handler.py (Python)

Code before:
            )
            return requests[0]

        self._record_request_size_prometheus(requests)

        params = self._parse_params(requests[0].parameters, self._executor.metas.name)
        docs = WorkerRequestHandler.get_docs_from_request(
            requests,
            field='docs',
        )

        # executor logic
        return_data = await self._executor.__acall__(
            req_endpoint=requests[0].header.exec_endpoint,
            docs=docs,
            parameters=params,
            docs_matrix=WorkerRequestHandler.get_docs_matrix_from_request(
                requests,
                field='docs',
            ),
            tracing_context=tracing_context,
        )

        docs = self._set_result(requests, return_data, docs)

        self._record_docs_processed_prometheus(requests, docs)
        self._record_response_size_prometheus(requests)

        return requests[0]

    @staticmethod
    def replace_docs(
        request: List['DataRequest'], docs: 'DocumentArray', ndarrray_type: str = None
    ) -> None:
        """Replaces the docs in a message with new Documents.

        :param request: The request object
        :param docs: the new docs to be used
        :param ndarrray_type: type tensor and embedding will be converted to
        """
        request.data.set_docs_convert_arrays(docs, ndarray_type=ndarrray_type)

    @staticmethod
    def replace_parameters(request: List['DataRequest'], parameters: Dict) -> None:
        """Replaces the parameters in a message with new Documents.

        :param request: The request object
        :param parameters: the new parameters to be used
        """
        request.parameters = parameters


Review comment (suggestion):
```suggestion
        self._record_docs_processed_monitoring(requests, docs)
```

Code after:
            )
            return requests[0]

        self._record_request_size_monitoring(requests)

        params = self._parse_params(requests[0].parameters, self._executor.metas.name)
        docs = WorkerRequestHandler.get_docs_from_request(
            requests,
            field='docs',
        )

        # executor logic
        return_data = await self._executor.__acall__(
            req_endpoint=requests[0].header.exec_endpoint,
            docs=docs,
            parameters=params,
            docs_matrix=WorkerRequestHandler.get_docs_matrix_from_request(
                requests,
                field='docs',
            ),
            tracing_context=tracing_context,
        )

        docs = self._set_result(requests, return_data, docs)

        self._record_docs_processed_monitoring(requests, docs)
        self._record_response_size_monitoring(requests)

        return requests[0]

    @staticmethod
    def replace_docs(
        request: List['DataRequest'], docs: 'DocumentArray', ndarrray_type: str = None
    ) -> None:
        """Replaces the docs in a message with new Documents.

        :param request: The request object
        :param docs: the new docs to be used
        :param ndarrray_type: type tensor and embedding will be converted to
        """
        request.data.set_docs_convert_arrays(docs, ndarray_type=ndarrray_type)

    @staticmethod
    def replace_parameters(request: List['DataRequest'], parameters: Dict) -> None:
        """Replaces the parameters in a message with new Documents.

        :param request: The request object
        :param parameters: the new parameters to be used
        """
        request.parameters = parameters