
from twisted.web.resource import Resource
from twisted.web.server import NOT_DONE_YET

import synapse.metrics


METRICS_PREFIX = "/_synapse/metrics"


class MetricsResource(Resource):
    isLeaf = True

    def __init__(self, hs):
        Resource.__init__(self)  # Resource is old-style, so no super()

        self.hs = hs

    def render_GET(self, request):
        response = synapse.metrics.render_all()

        request.setHeader("Content-Type", "text/plain")
        request.setHeader("Content-Length", str(len(response)))

        # Encode as UTF-8 (default)
        return response.encode()


from twisted.web.resource import Resource

import synapse.metrics


METRICS_PREFIX = "/_synapse/metrics"


class MetricsResource(Resource):
    isLeaf = True

    def __init__(self, hs):
        Resource.__init__(self)  # Resource is old-style, so no super()

        self.hs = hs

    def render_GET(self, request):
        response = synapse.metrics.render_all()

        request.setHeader("Content-Type", "text/plain")
        request.setHeader("Content-Length", str(len(response)))

        # Encode as UTF-8 (default)
        return response.encode()

Delete unused import of NOT_READY_YET
Delete unused import of NOT_READY_YET

  
  from twisted.web.resource import Resource
- from twisted.web.server import NOT_DONE_YET
  
  import synapse.metrics
  
  
  METRICS_PREFIX = "/_synapse/metrics"
  
  
  class MetricsResource(Resource):
      isLeaf = True
  
      def __init__(self, hs):
          Resource.__init__(self)  # Resource is old-style, so no super()
  
          self.hs = hs
  
      def render_GET(self, request):
          response = synapse.metrics.render_all()
  
          request.setHeader("Content-Type", "text/plain")
          request.setHeader("Content-Length", str(len(response)))
  
          # Encode as UTF-8 (default)
          return response.encode()
  
Delete unused import of NOT_READY_YET
## Code Before:

from twisted.web.resource import Resource
from twisted.web.server import NOT_DONE_YET

import synapse.metrics


METRICS_PREFIX = "/_synapse/metrics"


class MetricsResource(Resource):
    isLeaf = True

    def __init__(self, hs):
        Resource.__init__(self)  # Resource is old-style, so no super()

        self.hs = hs

    def render_GET(self, request):
        response = synapse.metrics.render_all()

        request.setHeader("Content-Type", "text/plain")
        request.setHeader("Content-Length", str(len(response)))

        # Encode as UTF-8 (default)
        return response.encode()

## Instruction:
Delete unused import of NOT_READY_YET
## Code After:

from twisted.web.resource import Resource

import synapse.metrics


METRICS_PREFIX = "/_synapse/metrics"


class MetricsResource(Resource):
    isLeaf = True

    def __init__(self, hs):
        Resource.__init__(self)  # Resource is old-style, so no super()

        self.hs = hs

    def render_GET(self, request):
        response = synapse.metrics.render_all()

        request.setHeader("Content-Type", "text/plain")
        request.setHeader("Content-Length", str(len(response)))

        # Encode as UTF-8 (default)
        return response.encode()
