Ejemplo n.º 1
0
        public async Task RecordPoolState(string chainId, DateTime time)
        {
            var isAlive = await IsAlive(chainId);

            var isForked = await IsForked(chainId);

            var fields = new Dictionary <string, object> {
                { "alive", isAlive }, { "forked", isForked }
            };
            await _influxDatabase.Set(chainId, "node_state", fields, null, time);
        }
Ejemplo n.º 2
0
 public async Task RecordPoolState(string chainId, DateTime time, int requestPoolSize, int receivePoolSize)
 {
     var fields = new Dictionary <string, object> {
         { "request", requestPoolSize }, { "receive", receivePoolSize }
     };
     await _influxDatabase.Set(chainId, "network_pool_state", fields, null, time);
 }
Ejemplo n.º 3
0
        public async Task RecordPoolSize(string chainId, DateTime time)
        {
            var poolSize = await GetPoolSize(chainId);

            var fields = new Dictionary <string, object> {
                { "size", poolSize }
            };
            await _influxDatabase.Set(chainId, "transaction_pool_size", fields, null, time);
        }
Ejemplo n.º 4
0
        // [Fact]
        public async Task TestSetAndGet()
        {
            var database = "unittest";
            await _influxDatabase.CreateDatabase(database);

            var used = 50;
            var time = DateTime.Now;
            await _influxDatabase.Set(database, "cpu", new Dictionary <string, object> {
                { "used", used }
            }, null, time);

            Thread.Sleep(1000);
            var result = await _influxDatabase.Get(database, "select * from cpu");

            Assert.True(Convert.ToInt32(result[0].Values[0][1]) == used);

            await _influxDatabase.DropDatabase(database);
        }