mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Remove benchmark logging (#2565).
* Problem: Benchmark logging is not needed. * Solution: Clean it up.
This commit is contained in:
parent
407571ddf4
commit
eb139fba00
@ -146,16 +146,13 @@ class App(BaseApplication):
|
||||
|
||||
self.abort_if_abci_chain_is_not_synced()
|
||||
|
||||
logger.benchmark('CHECK_TX_INIT')
|
||||
logger.debug('check_tx: %s', raw_transaction)
|
||||
transaction = decode_transaction(raw_transaction)
|
||||
if self.bigchaindb.is_valid_transaction(transaction):
|
||||
logger.debug('check_tx: VALID')
|
||||
logger.benchmark('CHECK_TX_END, tx_id:%s', transaction['id'])
|
||||
return ResponseCheckTx(code=CodeTypeOk)
|
||||
else:
|
||||
logger.debug('check_tx: INVALID')
|
||||
logger.benchmark('CHECK_TX_END, tx_id:%s', transaction['id'])
|
||||
return ResponseCheckTx(code=CodeTypeError)
|
||||
|
||||
def begin_block(self, req_begin_block):
|
||||
@ -167,9 +164,9 @@ class App(BaseApplication):
|
||||
self.abort_if_abci_chain_is_not_synced()
|
||||
|
||||
chain_shift = 0 if self.chain is None else self.chain['height']
|
||||
logger.benchmark('BEGIN BLOCK, height:%s, num_txs:%s',
|
||||
req_begin_block.header.height + chain_shift,
|
||||
req_begin_block.header.num_txs)
|
||||
logger.debug('BEGIN BLOCK, height:%s, num_txs:%s',
|
||||
req_begin_block.header.height + chain_shift,
|
||||
req_begin_block.header.num_txs)
|
||||
|
||||
self.block_txn_ids = []
|
||||
self.block_transactions = []
|
||||
@ -253,7 +250,6 @@ class App(BaseApplication):
|
||||
logger.debug('Commit-ing new block with hash: apphash=%s ,'
|
||||
'height=%s, txn ids=%s', data, self.new_height,
|
||||
self.block_txn_ids)
|
||||
logger.benchmark('COMMIT_BLOCK, height:%s', self.new_height)
|
||||
|
||||
if self.events_queue:
|
||||
event = Event(EventTypes.BLOCK_VALID, {
|
||||
|
@ -11,8 +11,6 @@ import os
|
||||
|
||||
|
||||
DEFAULT_LOG_DIR = os.getcwd()
|
||||
BENCHMARK_LOG_LEVEL = 15
|
||||
|
||||
|
||||
DEFAULT_LOGGING_CONFIG = {
|
||||
'version': 1,
|
||||
@ -29,11 +27,6 @@ DEFAULT_LOGGING_CONFIG = {
|
||||
'format': ('[%(asctime)s] [%(levelname)s] (%(name)s) '
|
||||
'%(message)s (%(processName)-10s - pid: %(process)d)'),
|
||||
'datefmt': '%Y-%m-%d %H:%M:%S',
|
||||
},
|
||||
'benchmark': {
|
||||
'class': 'logging.Formatter',
|
||||
'format': ('%(asctime)s, %(levelname)s, %(message)s'),
|
||||
'datefmt': '%Y-%m-%d %H:%M:%S',
|
||||
}
|
||||
},
|
||||
'handlers': {
|
||||
@ -59,31 +52,16 @@ DEFAULT_LOGGING_CONFIG = {
|
||||
'backupCount': 5,
|
||||
'formatter': 'file',
|
||||
'level': logging.ERROR,
|
||||
},
|
||||
'benchmark': {
|
||||
'class': 'logging.handlers.RotatingFileHandler',
|
||||
'filename': os.path.join(DEFAULT_LOG_DIR, 'bigchaindb-benchmark.log'),
|
||||
'mode': 'w',
|
||||
'maxBytes': 209715200,
|
||||
'backupCount': 5,
|
||||
'formatter': 'benchmark',
|
||||
'level': BENCHMARK_LOG_LEVEL,
|
||||
}
|
||||
},
|
||||
'loggers': {},
|
||||
'root': {
|
||||
'level': logging.DEBUG,
|
||||
'handlers': ['console', 'file', 'errors', 'benchmark'],
|
||||
'handlers': ['console', 'file', 'errors'],
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def benchmark(self, message, *args, **kws):
|
||||
# Yes, logger takes its '*args' as 'args'.
|
||||
if self.isEnabledFor(BENCHMARK_LOG_LEVEL):
|
||||
self._log(BENCHMARK_LOG_LEVEL, message, args, **kws)
|
||||
|
||||
|
||||
def _normalize_log_level(level):
|
||||
try:
|
||||
return level.upper()
|
||||
@ -104,11 +82,6 @@ def setup_logging():
|
||||
|
||||
"""
|
||||
|
||||
# Add a new logging level for logging benchmark
|
||||
logging.addLevelName(BENCHMARK_LOG_LEVEL, 'BENCHMARK')
|
||||
logging.BENCHMARK = BENCHMARK_LOG_LEVEL
|
||||
logging.Logger.benchmark = benchmark
|
||||
|
||||
logging_configs = DEFAULT_LOGGING_CONFIG
|
||||
new_logging_configs = bigchaindb.config['log']
|
||||
|
||||
@ -127,7 +100,6 @@ def setup_logging():
|
||||
if 'level_logfile' in new_logging_configs:
|
||||
level = _normalize_log_level(new_logging_configs['level_logfile'])
|
||||
logging_configs['handlers']['file']['level'] = level
|
||||
logging_configs['handlers']['benchmark']['level'] = level
|
||||
|
||||
if 'fmt_console' in new_logging_configs:
|
||||
fmt = new_logging_configs['fmt_console']
|
||||
|
@ -25,7 +25,6 @@ please refer to [MongoDB docs](https://docs.mongodb.com/v3.6/tutorial/rotate-log
|
||||
Log rotation is baked into BigchainDB server using the `logging` module. BigchainDB server logs information into the following files:
|
||||
- `bigchaindb.log`
|
||||
- `bigchaindb-errors.log`
|
||||
- `bigchaindb-benchmark.log`
|
||||
|
||||
These log files are created by default in the directory from where you run `bigchaindb start`, if you are using `monit`, from
|
||||
[How to Set Up a BigchainDB Network](../simple-deployment-template/network-setup.md) guide, the default directory is: `$HOME/.bigchaindb-monit/logs`
|
||||
|
@ -292,7 +292,7 @@ defined by [Python](https://docs.python.org/3.6/library/logging.html#levels),
|
||||
but case-insensitive for the sake of convenience:
|
||||
|
||||
```text
|
||||
"critical", "error", "warning", "info", "benchmark", "debug", "notset"
|
||||
"critical", "error", "warning", "info", "debug", "notset"
|
||||
```
|
||||
|
||||
### log.level_logfile
|
||||
@ -302,7 +302,7 @@ defined by [Python](https://docs.python.org/3.6/library/logging.html#levels),
|
||||
but case-insensitive for the sake of convenience:
|
||||
|
||||
```text
|
||||
"critical", "error", "warning", "info", "benchmark", "debug", "notset"
|
||||
"critical", "error", "warning", "info", "debug", "notset"
|
||||
```
|
||||
|
||||
### log.datefmt_console
|
||||
|
6
setup.py
6
setup.py
@ -71,10 +71,6 @@ tests_require = [
|
||||
'tox',
|
||||
] + docs_require
|
||||
|
||||
benchmarks_require = [
|
||||
'line-profiler==1.0',
|
||||
]
|
||||
|
||||
install_requires = [
|
||||
# TODO Consider not installing the db drivers, or putting them in extras.
|
||||
'pymongo~=3.6',
|
||||
@ -144,7 +140,7 @@ setup(
|
||||
tests_require=tests_require,
|
||||
extras_require={
|
||||
'test': tests_require,
|
||||
'dev': dev_require + tests_require + docs_require + benchmarks_require,
|
||||
'dev': dev_require + tests_require + docs_require,
|
||||
'docs': docs_require,
|
||||
},
|
||||
package_data={'bigchaindb.common.schema': ['*.yaml']},
|
||||
|
@ -22,7 +22,6 @@ from pymongo import MongoClient
|
||||
|
||||
from bigchaindb import ValidatorElection
|
||||
from bigchaindb.common import crypto
|
||||
from bigchaindb.log import setup_logging
|
||||
from bigchaindb.tendermint_utils import key_from_base64
|
||||
from bigchaindb.backend import schema, query
|
||||
from bigchaindb.common.crypto import (key_pair_from_ed25519_key,
|
||||
@ -108,10 +107,6 @@ def _configure_bigchaindb(request):
|
||||
config = config_utils.env_config(config)
|
||||
config_utils.set_config(config)
|
||||
|
||||
# NOTE: since we use a custom log level
|
||||
# for benchmark logging we need to setup logging
|
||||
setup_logging()
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def _setup_database(_configure_bigchaindb):
|
||||
|
Loading…
x
Reference in New Issue
Block a user