code: def check(self, instance):
          
          self.log.debug("Running instance: %s", instance)
          custom_tags = instance.get('tags', [])
  
          # Validate the config.
          if not instance or self.PROC_NAME not in instance:
              raise GUnicornCheckError("instance must specify: %s" % self.PROC_NAME)
  
          # Load the gunicorn master procedure.
          proc_name = instance.get(self.PROC_NAME)
          master_procs = self._get_master_proc_by_name(proc_name, custom_tags)
  
          # Fetch the worker procs and count their states.
          worker_procs = self._get_workers_from_procs(master_procs)
          working, idle = self._count_workers(worker_procs)
  
          # if no workers are running, alert CRITICAL, otherwise OK
          msg = "%s working and %s idle workers for %s" % (working, idle, proc_name)
          status = AgentCheck.CRITICAL if working == 0 and idle == 0 else AgentCheck.OK
          tags = ['app:' + proc_name] + custom_tags
  
          self.service_check(self.SVC_NAME, status, tags=tags, message=msg)
  
          # Submit the data.
          self.log.debug("instance %s procs - working:%s idle:%s" % (proc_name, working, idle))
          self.gauge("gunicorn.workers", working, tags + self.WORKING_TAGS)
          self.gauge("gunicorn.workers", idle, tags + self.IDLE_TAGS)
docs: Collect metrics for the given gunicorn instance.