Os page cache monitoring (#1049)

This commit is contained in:
Alex Sharov 2020-09-05 09:36:42 +07:00 committed by GitHub
parent e48b28bc5c
commit 0c75304261
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 13 deletions

View File

@ -12,7 +12,7 @@ services:
- 30303:30303
prometheus:
image: prom/prometheus:v2.20.0
image: prom/prometheus:v2.20.1
command: --log.level=warn --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/prometheus --web.console.libraries=/usr/share/prometheus/console_libraries --web.console.templates=/usr/share/prometheus/consoles
ports:
- 9090:9090
@ -21,7 +21,7 @@ services:
- ${XDG_DATA_HOME:-~/.local/share}/tg-prometheus:/prometheus
grafana:
image: grafana/grafana:7.1.1
image: grafana/grafana:7.1.5
ports:
- 3000:3000
volumes:

View File

@ -22,15 +22,13 @@ import (
"context"
"errors"
"fmt"
"strings"
"time"
"github.com/ledgerwatch/turbo-geth/common"
"github.com/ledgerwatch/turbo-geth/common/dbutils"
"github.com/ledgerwatch/turbo-geth/common/debug"
"github.com/ledgerwatch/turbo-geth/core/types/accounts"
"github.com/ledgerwatch/turbo-geth/log"
"github.com/ledgerwatch/turbo-geth/metrics"
"strings"
)
var (
@ -85,10 +83,6 @@ func Open(path string) (*ObjectDatabase, error) {
// Put inserts or updates a single entry.
func (db *ObjectDatabase) Put(bucket string, key []byte, value []byte) error {
if metrics.Enabled {
defer dbPutTimer.UpdateSince(time.Now())
}
err := db.kv.Update(context.Background(), func(tx Tx) error {
return tx.Cursor(bucket).Put(key, value)
})
@ -97,10 +91,6 @@ func (db *ObjectDatabase) Put(bucket string, key []byte, value []byte) error {
// Append appends a single entry to the end of the bucket.
func (db *ObjectDatabase) Append(bucket string, key []byte, value []byte) error {
if metrics.Enabled {
defer dbPutTimer.UpdateSince(time.Now())
}
err := db.kv.Update(context.Background(), func(tx Tx) error {
return tx.Cursor(bucket).Append(key, value)
})

View File

@ -4,6 +4,7 @@ import (
"bytes"
"context"
"fmt"
"github.com/ledgerwatch/turbo-geth/metrics"
"time"
"github.com/ledgerwatch/turbo-geth/common"
@ -48,6 +49,9 @@ func (m *TxDb) Begin() (DbWithPendingMutations, error) {
}
func (m *TxDb) Put(bucket string, key []byte, value []byte) error {
if metrics.Enabled {
defer dbPutTimer.UpdateSince(time.Now())
}
m.len += uint64(len(key) + len(value))
return m.cursors[bucket].Put(key, value)
}
@ -100,6 +104,10 @@ func (m *TxDb) Last(bucket string) ([]byte, []byte, error) {
}
func (m *TxDb) Get(bucket string, key []byte) ([]byte, error) {
if metrics.Enabled {
defer dbGetTimer.UpdateSince(time.Now())
}
v, err := m.cursors[bucket].SeekExact(key)
if err != nil {
return nil, err