def test_span_callback(self):
    RequestsInstrumentor().uninstrument()

    def span_callback(span, result: requests.Response):
        span.set_attribute('http.response.body', result.content.decode('utf-8'))
    RequestsInstrumentor().instrument(tracer_provider=self.tracer_provider, span_callback=span_callback)
    result = self.perform_request(self.URL)
    self.assertEqual(result.text, 'Hello!')
    span = self.assert_span()
    self.assertEqual(span.attributes, {SpanAttributes.HTTP_METHOD: 'GET', SpanAttributes.HTTP_URL: self.URL, SpanAttributes.HTTP_STATUS_CODE: 200, 'http.response.body': 'Hello!'})
def test_span_callback(self):
    RequestsInstrumentor().uninstrument()

    def span_callback(span, result: requests.Response):
        span.set_attribute('http.response.body', result.content.decode('utf-8'))
    RequestsInstrumentor().instrument(tracer_provider=self.tracer_provider, span_callback=span_callback)
    result = self.perform_request(self.URL)
    self.assertEqual(result.text, 'Hello!')
    span = self.assert_span()
    self.assertEqual(span.attributes, {SpanAttributes.HTTP_METHOD: 'GET', SpanAttributes.HTTP_URL: self.URL, SpanAttributes.HTTP_STATUS_CODE: 200, 'http.response.body': 'Hello!'})