Skip to content
Snippets Groups Projects
Commit 8ea58d0f authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[enh] remaining non-monitored loki/sqlite accesses

parent 0d63d144
No related branches found
No related tags found
No related merge requests found
...@@ -84,11 +84,9 @@ export class LokiBIndex extends LokiIndex<DBHead> implements BIndexDAO { ...@@ -84,11 +84,9 @@ export class LokiBIndex extends LokiIndex<DBHead> implements BIndexDAO {
.remove() .remove()
} }
@MonitorLokiExecutionTime(true)
async getWrittenOn(blockstamp: string): Promise<DBHead[]> { async getWrittenOn(blockstamp: string): Promise<DBHead[]> {
const now = getMicrosecondsTime()
const criterion:any = { number: parseInt(blockstamp) } const criterion:any = { number: parseInt(blockstamp) }
const res = this.collection.find(criterion) return this.collection.find(criterion)
logger.trace('[loki][%s][getWrittenOn] %sµs', this.collectionName, getDurationInMicroSeconds(now), blockstamp)
return res
} }
} }
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
import {SQLiteDriver} from "../drivers/SQLiteDriver" import {SQLiteDriver} from "../drivers/SQLiteDriver"
import {Initiable} from "./Initiable" import {Initiable} from "./Initiable"
import {getDurationInMicroSeconds, getMicrosecondsTime} from "../../../ProcessCpuProfiler"
import {Underscore} from "../../common-libs/underscore" import {Underscore} from "../../common-libs/underscore"
import {NewLogger} from "../../logger" import {NewLogger} from "../../logger"
import {MonitorSQLExecutionTime} from "../../debug/MonitorSQLExecutionTime" import {MonitorSQLExecutionTime} from "../../debug/MonitorSQLExecutionTime"
...@@ -130,16 +129,9 @@ export abstract class AbstractSQLite<T> extends Initiable { ...@@ -130,16 +129,9 @@ export abstract class AbstractSQLite<T> extends Initiable {
await this.query('DELETE FROM ' + this.table + ' WHERE ' + conditions, condValues) await this.query('DELETE FROM ' + this.table + ' WHERE ' + conditions, condValues)
} }
@MonitorSQLExecutionTime()
async exec(sql:string) { async exec(sql:string) {
try { await this.driver.executeSql(sql)
const start = getMicrosecondsTime()
await this.driver.executeSql(sql);
const duration = getDurationInMicroSeconds(start)
logger.trace('[sqlite][exec] %s %sµs', sql.substring(0, 50) + '...', duration)
} catch (e) {
//console.error('ERROR >> %s', sql);
throw e;
}
} }
getInsertQuery(): string { getInsertQuery(): string {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment