Util method to get backend stats url
421167
def get_backend_stats_url(config, hub, backend_type):
    
    if ((config is not None) and ('hub' in config) and (hub is None)):
        hub = config["hub"]
    if (hub is not None):
        return '/Network/{}/devices/{}'.format(hub, backend_type)
    return '/Backends/{}'.format(backend_type)
728890
def getdb(backend=None, **kwargs):
    ''''''
    if isinstance(backend, BackendDataServer):
        return backend
    backend = backend or settings.DEFAULT_BACKEND
    if not backend:
        return None
    scheme, address, params = parse_backend(backend)
    params.update(kwargs)
    if 'timeout' in params:
        params['timeout'] = int(params['timeout'])
    return _getdb(scheme, address, params)
873680
def get_stats_action(cachespec, interval):
    
    if cachespec == 'global':
        caches = get_bcache_fs()
    else:
        caches = [Bcache.fromdevice(cachespec)]
    res = dict((c.cachepath, c.get_stats(interval)) for c in caches)
    return json.dumps(res, indent=4, separators=(',', ': '))
71670
function getUrlParameter(sPageURL) {
    var url = sPageURL.split('?');
    var obj = {};
    if (url.length == 2) {
      var sURLVariables = url[1].split('&'),
          sParameterName,
          i;
      for (i = 0; i < sURLVariables.length; i++) {
          sParameterName = sURLVariables[i].split('=');
          obj[sParameterName[0]] = sParameterName[1];
      }
      return obj;
    } else {
      return undefined;
    }
}
1016130
def get_params_from_page(path, file_name, method_count):
    
    # open the rendered file.
    file_name = file_name.replace(".rst", "")
    file_path = "{0}/../_build/html/endpoints/{1}/index.html".format(
        path, file_name)
    soup = bs4.BeautifulSoup(open(file_path))

    # Pull out the relevant section
    section = soup.find_all('div', class_='section')[method_count]

    # get the tbody of the params table
    tbody = section.find('tbody')
    params = []
    if tbody is not None:
        for row in tbody.find_all('tr'):
            name, param_type, required, description = row.find_all('td')
            required = required.text == 'Yes'
            param = dict(
                name=name.text,
                type=param_type.text,
                required=required,
                description=description.text
            )
            params.append(param)
    params = sorted(params, key=lambda k: not k['required'])
    return params
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 ) );
    */
}
1005897
def get_url(access_token, endpoint=ams_rest_endpoint, flag=True):
    '''
    '''
    return do_ams_get_url(endpoint, access_token, flag)
1063769
def _get_api_params(api_url=None,
                    api_version=None,
                    api_key=None):
    '''
    
    '''
    mandrill_cfg = __salt__['config.merge']('mandrill')
    if not mandrill_cfg:
        mandrill_cfg = {}
    return {
        'api_url': api_url or mandrill_cfg.get('api_url') or BASE_URL,  # optional
        'api_key': api_key or mandrill_cfg.get('key'),  # mandatory
        'api_version': api_version or mandrill_cfg.get('api_version') or DEFAULT_VERSION
    }
781294
def _get_url(method,
             api_url,
             api_version):
    '''
    
    '''
    return '{url}/{version}/{method}.json'.format(url=api_url,
                                                  version=float(api_version),
                                                  method=method)
1244676
def url(self):
        """"""
        if self.parent is None:
            # TODO: differing API Versions?
            pieces = [self.client.base_url, 'api', 'atlas', 'v2']
        else:
            pieces = [self.parent.url]

        pieces.append(self.model_class.path)
        return '/'.join(pieces)
917287
def get_import_data_url(deployment_name,
                        token_manager=None,
                        app_url=defaults.APP_URL):
    
    return get_data_url(deployment_name,
                        endpoint_type='http-import',
                        app_url=app_url,
                        token_manager=token_manager)
439112
def stats(url, options={})
      query = {:url => url}
      query.merge!(options)
      response = handle_response(get("/stats.json", :query => query))
      Topsy::Stats.new(response)
    end
1288922
def stats(self, request):
        '''
        '''
        # scheme = 'wss' if request.is_secure else 'ws'
        # host = request.get('HTTP_HOST')
        # address = '%s://%s/stats' % (scheme, host)
        doc = HtmlDocument(title='Live server stats', media_path='/assets/')
        # docs.head.scripts
        return doc.http_response(request)
217350
function swsAPIStats() {

    // Options
    this.options = null;

    // API Base path per swagger spec
    this.basePath = '/';

    // Array of possible API path matches, populated based on Swagger spec
    // Contains regex to match URI to Swagger path
    this.apiMatchIndex = {};

    // API definition - entry per API request from swagger spec
    // Stores attributes of known Swagger APIs - description, summary, tags, parameters
    this.apidefs = {};

    // API statistics - entry per API request from swagger
    // Paths not covered by swagger will be added on demand as used
    this.apistats = {};

    // Detailed API stats
    // TODO Consider: individual timelines (?), parameters (query/path?)
    this.apidetails = {};

    // Buckets for histograms, with default bucket values
    this.durationBuckets = [5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000];
    this.requestSizeBuckets = [5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000];
    this.responseSizeBuckets = [5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000];

    // Prometheus metrics in prom-client
    this.promClientMetrics = {};

    this.promClientMetrics.api_request_total = new promClient.Counter({
        name: swsUtil.swsMetrics.api_request_total.name,
        help: swsUtil.swsMetrics.api_request_total.help,
        labelNames: ['method','path','code'] });

    this.promClientMetrics.api_request_duration_milliseconds = new promClient.Histogram({
        name: swsUtil.swsMetrics.api_request_duration_milliseconds.name,
        help: swsUtil.swsMetrics.api_request_duration_milliseconds.help,
        labelNames: ['method','path','code'],
        buckets: this.durationBuckets });

    this.promClientMetrics.api_request_size_bytes = new promClient.Histogram({
        name: swsUtil.swsMetrics.api_request_size_bytes.name,
        help: swsUtil.swsMetrics.api_request_size_bytes.help,
        labelNames: ['method','path','code'],
        buckets: this.requestSizeBuckets });

    this.promClientMetrics.api_response_size_bytes = new promClient.Histogram({
        name: swsUtil.swsMetrics.api_response_size_bytes.name,
        help: swsUtil.swsMetrics.api_response_size_bytes.help,
        labelNames: ['method','path','code'],
        buckets: this.responseSizeBuckets });
}
1228017
private String fetchStats(InetSocketAddress jn) throws IOException {
    try {
      return DFSUtil.getHTMLContentWithTimeout(new URI("http", null, jn.getAddress().getHostAddress(), jn
          .getPort(), "/journalStats", null, null).toURL(), HTTP_CONNECT_TIMEOUT, HTTP_READ_TIMEOUT);
    } catch (Exception e) {
      LOG.error("Problem connecting to " + getHostAddress(jn), e);
      return null;
    }
  }
184561
def do_GET(self):  # pylint: disable=g-bad-name
    """"""
    self._IncrementActiveCount()
    try:
      if self.path.startswith("/server.pem"):
        stats_collector_instance.Get().IncrementCounter(
            "frontend_http_requests", fields=["cert", "http"])
        self.ServerPem()
      elif self.path.startswith(self.static_content_path):
        stats_collector_instance.Get().IncrementCounter(
            "frontend_http_requests", fields=["static", "http"])
        self.ServeStatic(self.path[len(self.static_content_path):])
    finally:
      self._DecrementActiveCount()
1176304
function stat(remotePath, options) {
            const getOptions = merge(baseOptions, options || {});
            return stats.getStat(remotePath, getOptions);
        }