/ Get Stats using the newer API.
773129
function parseStatsNewAPI (peerConnection,
                                                      prevStats,
                                                      currentStats,
                                                      completion) {

      var onStatsError = function onStatsError (error) {
            completion(error);
          },

          parseAudioStats = function (result) {
            if (result.type==='outboundrtp') {
              currentStats.audioSentPackets = result.packetsSent;
              currentStats.audioSentPacketsLost = result.packetsLost;
              currentStats.audioSentBytes =  result.bytesSent;
            } else if (result.type==='inboundrtp') {
              currentStats.audioRecvPackets = result.packetsReceived;
              currentStats.audioRecvPacketsLost = result.packetsLost;
              currentStats.audioRecvBytes =  result.bytesReceived;
            }
          },

          parseVideoStats = function (result) {
            if (result.type==='outboundrtp') {
              currentStats.videoSentPackets = result.packetsSent;
              currentStats.videoSentPacketsLost = result.packetsLost;
              currentStats.videoSentBytes =  result.bytesSent;
            } else if (result.type==='inboundrtp') {
              currentStats.videoRecvPackets = result.packetsReceived;
              currentStats.videoRecvPacketsLost = result.packetsLost;
              currentStats.videoRecvBytes =  result.bytesReceived;
            }
          };

      peerConnection.getStats(null, function(stats) {

        for (var key in stats) {
          if (stats.hasOwnProperty(key) &&
            (stats[key].type === 'outboundrtp' || stats[key].type === 'inboundrtp')) {
            var res = stats[key];

            if (res.id.indexOf('rtp') !== -1) {
              if (res.id.indexOf('audio') !== -1) {
                parseAudioStats(res);
              } else if (res.id.indexOf('video') !== -1) {
                parseVideoStats(res);
              }
            }
          }
        }

        completion(null, currentStats);
      }, onStatsError);
    }
1033905
def _get_api_version(self):
        
        url = "{base_url}/api/server_info".format(base_url=self._base_url())
        server_info = self._make_request(url=url, method="get")
        return server_info["latest_api_version"]
1350304
public static service_stats[] get(nitro_service service) throws Exception{
		service_stats obj = new service_stats();
		service_stats[] response = (service_stats[])obj.stat_resources(service);
		return response;
	}
530625
def api_run_get(run_id):
    """"""
    data = current_app.config["data"]
    run = data.get_run_dao().get(run_id)
    records_total = 1 if run is not None else 0
    if records_total == 0:
        return Response(
            render_template(
                "api/error.js",
                error_code=404,
                error_message="Run %s not found." % run_id),
            status=404,
            mimetype="application/json")
    records_filtered = records_total
    return Response(render_template("api/runs.js", runs=[run], draw=1,
                                    recordsTotal=records_total,
                                    recordsFiltered=records_filtered,
                                    full_object=True),
                    mimetype="application/json")
68439
def get_stats(self, request, context):
        """"""
        _log_request(request, context)
        m = self.listener.memory
        return clearly_pb2.StatsMessage(
            task_count=m.task_count,
            event_count=m.event_count,
            len_tasks=len(m.tasks),
            len_workers=len(m.workers)
        )
90684
public static service_stats get(nitro_service service, String name) throws Exception{
		service_stats obj = new service_stats();
		obj.set_name(name);
		service_stats response = (service_stats) obj.stat_resource(service);
		return response;
	}
1087322
def _api_all(self):
        
        response.content_type = 'application/json; charset=utf-8'

        if self.args.debug:
            fname = os.path.join(tempfile.gettempdir(), 'glances-debug.json')
            try:
                with open(fname) as f:
                    return f.read()
            except IOError:
                logger.debug("Debug file (%s) not found" % fname)

        # Update the stat
        self.__update__()

        try:
            # Get the JSON value of the stat ID
            statval = json.dumps(self.stats.getAllAsDict())
        except Exception as e:
            abort(404, "Cannot get stats (%s)" % str(e))

        return statval
669622
def get_api_version(base_url, api_version=None, timeout=10, verify=True):
    
    versions = available_api_versions(base_url, timeout, verify)
    
    newest_version = max([float(i) for i in versions])
    if api_version is None:  # Use latest
        api_version = newest_version
    else:
        if api_version not in versions:
            api_version = newest_version
    
    return api_version
816104
function getStatsNewAPI(peerConnection, completion) {

      peerConnection.getStats(null, function(rtcStatsReport) {

        var stats = [];
        rtcStatsReport.forEach(function(rtcStats) {
          stats.push(rtcStats);
        });

        completion(null, stats);
      }, completion);
    }
447003
def stats_blast(blast_id = nil, start_date = nil, end_date = nil, options = {})
      data = options
      if blast_id != nil
        data[:blast_id] = blast_id
      end
      if start_date != nil
        data[:start_date] = start_date
      end
      if end_date != nil
        data[:end_date] = end_date
      end
      data[:stat] = 'blast'
      api_get(:stats, data)
    end
316035
def _api_history(self, plugin, nb=0):
        
        response.content_type = 'application/json; charset=utf-8'

        if plugin not in self.plugins_list:
            abort(400, "Unknown plugin %s (available plugins: %s)" % (plugin, self.plugins_list))

        # Update the stat
        self.__update__()

        try:
            # Get the JSON value of the stat ID
            statval = self.stats.get_plugin(plugin).get_stats_history(nb=int(nb))
        except Exception as e:
            abort(404, "Cannot get plugin history %s (%s)" % (plugin, str(e)))
        return statval
40886
public static rewritepolicy_stats[] get(nitro_service service, options option) throws Exception{
		rewritepolicy_stats obj = new rewritepolicy_stats();
		rewritepolicy_stats[] response = (rewritepolicy_stats[])obj.stat_resources(service,option);
		return response;
	}
598320
def get_stats(self):
        """"""
        self.gather_xml()
        self.xml_version = self.bs_xml.find('statistics')['version']

        if self.xml_version is None:
            raise XmlError("Unable to determine XML version via 'statistics' tag.")

        if self.xml_version == '3.6':
            self.stats = XmlV36(self.bs_xml)
        elif self.xml_version == '3.8':
            # 3.8 uses the same XML scheme as 3.6
            self.stats = XmlV36(self.bs_xml)
        elif self.xml_version == '3.11':
            # BIND 9.12 uses same XML schema as XmlV36
            self.stats = XmlV36(self.bs_xml)
        else:
            raise XmlError('Support must be added before being able to support newly-encountered XML version %s.' % self.xml_version)
1368783
def stats_send(template = nil, start_date = nil, end_date = nil, options = {})
      data = options
      if template != nil
        data[:template] = template
      end
      if start_date != nil
        data[:start_date] = start_date
      end
      if end_date != nil
        data[:end_date] = end_date
      end
      data[:stat] = 'send'
      api_get(:stats, data)
    end
879529
public static appfw_stats get(nitro_service service) throws Exception{
		appfw_stats obj = new appfw_stats();
		appfw_stats[] response = (appfw_stats[])obj.stat_resources(service);
		return response[0];
	}
528314
function() {
            // return this._mgr.getStats.apply( this._mgr, arguments );
            var stats = this.request('get-stats');

            return stats ? {
                successNum: stats.numOfSuccess,
                progressNum: stats.numOfProgress,

                // who care?
                // queueFailNum: 0,
                cancelNum: stats.numOfCancel,
                invalidNum: stats.numOfInvalid,
                uploadFailNum: stats.numOfUploadFailed,
                queueNum: stats.numOfQueue,
                interruptNum: stats.numOfInterrupt
            } : {};
        }
1327675
function processGetStats(req,res){

    processAuth(req,res).then(function (authResult){
        if(!authResult){
            return;
        }
        res.status(200);
        if(('sws-auth' in req) && req['sws-auth']){
            res.setHeader('x-sws-authenticated','true');
        }
        res.json( processor.getStats( req.query ) );
    });

    /*
    if(!processAuth(req,res)) {
        return;
    }

    if(('sws-auth' in req) && req['sws-auth']){
        res.setHeader('x-sws-authenticated','true');
    }

    res.status(200).json( processor.getStats( req.query ) );
    */
}