prom-client#Gauge TypeScript Examples

The following examples show how to use prom-client#Gauge. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: server.ts    From clarity with Apache License 2.0 6 votes vote down vote up
constructor() {
    this.faucetRequestCounter = new promClient.Counter({
      name: 'faucet_request_total',
      help: 'Count of faucet requests'
    });
    this.deployRequestCounter = new promClient.Counter({
      name: 'deploy_request_total',
      help: 'Count of deploy requests'
    });
    this.accountKeyGauge = new promClient.Gauge({
      name: 'account_key_total',
      help: 'Count of account key'
    });
    this.accountGauge = new promClient.Gauge({
      name: 'user_account_total',
      help: 'Count of user account'
    });
    this.dailyLoginGauge = new promClient.Gauge({
      name: 'daily_login_days',
      help: 'Number of logins every day'
    });
    this.dailySignupGauge = new promClient.Gauge({
      name: 'daily_signup_days',
      help: 'Number of sign up every day'
    });
  }
Example #2
Source File: metrics.ts    From covid_exporter with MIT License 6 votes vote down vote up
private static initRegistry = _.once(() => {
    if (MetricsProvider.registry != null) {
      return MetricsProvider.registry
    }

    const registry = new Registry()
    registry.setDefaultLabels({ country: 'USA' })

    for (const key in keyNameMapping) {
      const metric = keyNameMapping[key]
      const gauge: Gauge<string> = new Gauge({
        name: `covid_${metric}`,
        help: key,
        labelNames: ['country', 'state'],
      })
      registry.registerMetric(gauge)
    }

    return registry
  })
Example #3
Source File: metrics.ts    From covid_exporter with MIT License 6 votes vote down vote up
public static getMetrics = async () => {
    const registry = MetricsProvider.registry
    const states = _.get(
      await axios.get('https://corona.lmao.ninja/states'),
      'data',
    )
    _.each(states, (s) => {
      const { state, ...stats } = s
      for (const key in stats as { [key: string]: number }) {
        const metricKey = `covid_${keyNameMapping[key]}`
        const value = _.get(stats, key)
        const gauge = registry.getSingleMetric(metricKey) as Gauge<any>
        if (value != null) {
          gauge.set(
            {
              country: 'USA',
              state,
            },
            value,
          )
        }
      }
    })

    return registry.metrics()
  }
Example #4
Source File: server.ts    From casper-clarity with Apache License 2.0 6 votes vote down vote up
constructor() {
    this.faucetRequestCounter = new promClient.Counter({
      name: 'faucet_request_total',
      help: 'Count of faucet requests'
    });
    this.deployRequestCounter = new promClient.Counter({
      name: 'deploy_request_total',
      help: 'Count of deploy requests'
    });
    this.accountKeyGauge = new promClient.Gauge({
      name: 'account_key_total',
      help: 'Count of account key'
    });
    this.accountGauge = new promClient.Gauge({
      name: 'user_account_total',
      help: 'Count of user account'
    });
    this.dailyLoginGauge = new promClient.Gauge({
      name: 'daily_login_days',
      help: 'Number of logins every day'
    });
    this.dailySignupGauge = new promClient.Gauge({
      name: 'daily_signup_days',
      help: 'Number of sign up every day'
    });
  }
Example #5
Source File: server.ts    From casper-clarity with Apache License 2.0 5 votes vote down vote up
public dailyLoginGauge: Gauge<string>;
Example #6
Source File: target.ts    From fuse-prom-target with GNU Affero General Public License v3.0 5 votes vote down vote up
stakedALCXUnclaimedUSD = new Gauge({
  name: "fuse_staked_alcx_unclaimed_usd",
  help: "Stores how much protocol controlled ALCX is claimable from staking."
})
Example #7
Source File: target.ts    From fuse-prom-target with GNU Affero General Public License v3.0 5 votes vote down vote up
stakedALCXAmount = new Gauge({
  name: "fuse_staked_alcx_amount",
  help: "Stores how much protocol controlled ALCX is currently being staked."
})
Example #8
Source File: target.ts    From fuse-prom-target with GNU Affero General Public License v3.0 5 votes vote down vote up
stakedALCXUnclaimedAmount = new Gauge({
  name: "fuse_staked_alcx_unclaimed_amount",
  help: "Stores how much protocol controlled ALCX is claimable from staking."
})
Example #9
Source File: metrics.ts    From backstage with Apache License 2.0 5 votes vote down vote up
export function createGaugeMetric<T extends string>(
  config: GaugeConfiguration<T>,
): Gauge<T> {
  const existing = register.getSingleMetric(config.name) as Gauge<T>;
  return existing || new Gauge<T>(config);
}
Example #10
Source File: server.ts    From casper-clarity with Apache License 2.0 5 votes vote down vote up
public accountKeyGauge: Gauge<string>;
Example #11
Source File: server.ts    From casper-clarity with Apache License 2.0 5 votes vote down vote up
public accountGauge: Gauge<string>;
Example #12
Source File: target.ts    From fuse-prom-target with GNU Affero General Public License v3.0 5 votes vote down vote up
poolAssetsFeesUSD = new Gauge({
  name: "fuse_pool_assets_fees_usd",
  help: "Stores how much of each asset has been taken as fees in each pool.",
  labelNames: ["id", "symbol"] as const
})
Example #13
Source File: server.ts    From casper-clarity with Apache License 2.0 5 votes vote down vote up
public dailySignupGauge: Gauge<string>;
Example #14
Source File: prometheus.ts    From monkeytype with GNU General Public License v3.0 5 votes vote down vote up
leaderboardUpdate = new Gauge({
  name: "leaderboard_update_seconds",
  help: "Leaderboard update time",
  labelNames: ["language", "mode", "mode2", "step"],
})
Example #15
Source File: handler.ts    From eosio-contract-api with GNU Affero General Public License v3.0 5 votes vote down vote up
private registerMetrics(registry: Registry): void {
        this.metrics = {};

        if (this.collectFrom.psql_connection !== false) {
            this.metrics.psql_connection = new Gauge({
                name: 'eos_contract_api_sql_live',
                registers: [registry],
                labelNames: ['process', 'hostname'],
                help: 'Indicates if the sql connection is alive, 1 = Alive, 0 = Dead'
            });
        }

        if (this.collectFrom.psql_pool !== false) {
            this.metrics.psql_pool_clients_total_count = new Gauge({
                name: 'eos_contract_api_pool_clients_count',
                registers: [registry],
                labelNames: ['process', 'hostname'],
                help: 'Indicates how many client connections has spawn'
            });
            this.metrics.psql_pool_clients_waiting_count = new Gauge({
                name: 'eos_contract_api_waiting_pool_clients_count',
                registers: [registry],
                labelNames: ['process', 'hostname'],
                help: 'Indicates how many sql client connections are waiting'
            });
            this.metrics.psql_pool_clients_idle_count = new Gauge({
                name: 'eos_contract_api_idle_pool_clients_count',
                registers: [registry],
                labelNames: ['process', 'hostname'],
                help: 'Indicates how many sql client connections are idle'
            });
        }

        if (this.collectFrom.readers !== false) {
            this.metrics.readers_blocks_behind_count = new Gauge({
                name: 'eos_contract_api_readers_blocks_behind_count',
                registers: [registry],
                labelNames: ['process', 'hostname', 'filler_name'],
                help: 'Indicates how many blocks is the filler behind the chain'
            });
            this.metrics.readers_time_behind_chain_sec = new Gauge({
                name: 'eos_contract_api_readers_time_behind_chain_sec',
                registers: [registry],
                labelNames: ['process', 'hostname', 'filler_name'],
                help: 'Indicates how much time in seconds, is the filler behind the chain'
            });
        }

        if (this.collectFrom.redis_connection !== false) {
            this.metrics.redis_connection = new Gauge({
                name: 'eos_contract_api_redis_live',
                registers: [registry],
                labelNames: ['process', 'hostname'],
                help: 'Indicates if the redis connection is alive, 1 = Alive, 0 = Dead'
            });
        }

    }
Example #16
Source File: prometheus.ts    From squid with GNU General Public License v3.0 5 votes vote down vote up
private lastBlock = new Gauge({
        name: 'sqd_processor_last_block',
        help: 'Last processed block',
        registers: [this.registry],
        aggregator: 'max'
    })
Example #17
Source File: prometheus.ts    From squid with GNU General Public License v3.0 5 votes vote down vote up
private chainHeight = new Gauge({
        name: 'sqd_processor_chain_height',
        help: 'Chain height of the data source',
        registers: [this.registry],
        aggregator: 'max'
    })
Example #18
Source File: prometheus.ts    From squid with GNU General Public License v3.0 5 votes vote down vote up
private mappingSpeed = new Gauge({
        name: 'sqd_processor_mapping_blocks_per_second',
        help: 'Mapping performance',
        registers: [this.registry],
        aggregator: 'average'
    })
Example #19
Source File: prometheus.ts    From squid with GNU General Public License v3.0 5 votes vote down vote up
private ingestSpeed = new Gauge({
        name: 'sqd_processor_ingest_blocks_per_second',
        help: 'Data fetching speed',
        registers: [this.registry],
        aggregator: 'average'
    })
Example #20
Source File: prometheus.ts    From squid with GNU General Public License v3.0 5 votes vote down vote up
private syncETA = new Gauge({
        name: 'sqd_processor_sync_eta_seconds',
        help: 'Estimated time until all required blocks will be processed or until chain height will be reached',
        registers: [this.registry]
    })
Example #21
Source File: prometheus.ts    From squid with GNU General Public License v3.0 5 votes vote down vote up
private syncRatio = new Gauge({
        name: 'sqd_processor_sync_ratio',
        help: 'Percentage of processed blocks',
        registers: [this.registry],
        aggregator: 'max'
    })
Example #22
Source File: target.ts    From fuse-prom-target with GNU Affero General Public License v3.0 5 votes vote down vote up
poolAssetsInterestRate = new Gauge({
  name: "fuse_pool_assets_interest_rate",
  help: "Stores the interest rates of each asset in each pool.",
  // Side: borrow, supply
  labelNames: ["id", "symbol", "side"] as const
})
Example #23
Source File: server.ts    From clarity with Apache License 2.0 5 votes vote down vote up
public accountKeyGauge: Gauge<string>;
Example #24
Source File: server.ts    From clarity with Apache License 2.0 5 votes vote down vote up
public accountGauge: Gauge<string>;
Example #25
Source File: server.ts    From clarity with Apache License 2.0 5 votes vote down vote up
public dailyLoginGauge: Gauge<string>;
Example #26
Source File: server.ts    From clarity with Apache License 2.0 5 votes vote down vote up
public dailySignupGauge: Gauge<string>;
Example #27
Source File: metrics.ts    From discord with GNU General Public License v3.0 5 votes vote down vote up
public static gaugeGatewayPing = new Gauge({
    name: 'fsb_gateway_ping',
    help: 'Shows the current gateway ping. Updated every 10 seconds.'
  })
Example #28
Source File: metrics.ts    From discord with GNU General Public License v3.0 5 votes vote down vote up
public static gaugeGuildCacheSize = new Gauge({
    name: 'fsb_caches_guilds_size',
    help: 'Amount of guilds currently cached on this worker. Updated every 10 seconds.'
  })
Example #29
Source File: metrics.ts    From discord with GNU General Public License v3.0 5 votes vote down vote up
public static gaugeUserCacheSize = new Gauge({
    name: 'fsb_caches_users_size',
    help: 'Amount of users currently cached on this worker. Updated every 10 seconds.'
  })