Skip to content

Commit

Permalink
Rm hypertrace (#574)
Browse files Browse the repository at this point in the history
* Rm hypertrace

* Also rm from replicator

* Lint (blank line)
  • Loading branch information
HDegroote authored Oct 2, 2024
1 parent 3fd6fee commit 72cf1eb
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 26 deletions.
10 changes: 0 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const Protomux = require('protomux')
const z32 = require('z32')
const id = require('hypercore-id-encoding')
const safetyCatch = require('safety-catch')
const { createTracer } = require('hypertrace')
const unslab = require('unslab')

const Replicator = require('./lib/replicator')
Expand Down Expand Up @@ -57,7 +56,6 @@ module.exports = class Hypercore extends EventEmitter {

this[promises] = true

this.tracer = createTracer(this)
this.storage = null
this.crypto = opts.crypto || hypercoreCrypto
this.core = null
Expand Down Expand Up @@ -290,8 +288,6 @@ module.exports = class Hypercore extends EventEmitter {
this.writable = this._isWritable()
this.autoClose = o.autoClose

if (o.core) this.tracer.setParent(o.core.tracer)

if (this.snapshotted && this.core && !this._snapshot) this._updateSnapshot()
}

Expand Down Expand Up @@ -402,7 +398,6 @@ module.exports = class Hypercore extends EventEmitter {
onupdate: this._oncoreupdate.bind(this),
onconflict: this._oncoreconflict.bind(this)
})
this.tracer.setParent(this.core.tracer)

if (opts.userData) {
for (const [key, value] of Object.entries(opts.userData)) {
Expand Down Expand Up @@ -841,8 +836,6 @@ module.exports = class Hypercore extends EventEmitter {
if (this.opened === false) await this.opening
if (!isValidIndex(index)) throw ASSERTION('block index is invalid')

this.tracer.trace('get', { index })

if (this.closing !== null) throw SESSION_CLOSED()
if (this._snapshot !== null && index >= this._snapshot.compatLength) throw SNAPSHOT_NOT_AVAILABLE()

Expand Down Expand Up @@ -967,8 +960,6 @@ module.exports = class Hypercore extends EventEmitter {
async _download (range) {
if (this.opened === false) await this.opening

this.tracer.trace('download', { range })

const activeRequests = (range && range.activeRequests) || this.activeRequests

return this.replicator.addRange(activeRequests, range)
Expand Down Expand Up @@ -1011,7 +1002,6 @@ module.exports = class Hypercore extends EventEmitter {
if (writable === false) throw SESSION_NOT_WRITABLE()

blocks = Array.isArray(blocks) ? blocks : [blocks]
this.tracer.trace('append', { blocks })

const preappend = this.encryption && this._preappend

Expand Down
2 changes: 0 additions & 2 deletions lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ const { BAD_ARGUMENT, STORAGE_EMPTY, STORAGE_CONFLICT, INVALID_OPERATION, INVALI
const m = require('./messages')
const Verifier = require('./verifier')
const audit = require('./audit')
const { createTracer } = require('hypertrace')

module.exports = class Core {
constructor (header, compat, crypto, oplog, bigHeader, tree, blocks, bitfield, verifier, sessions, legacy, globalCache, onupdate, onconflict) {
this.tracer = createTracer(this)
this.onupdate = onupdate
this.onconflict = onconflict
this.preupdate = null
Expand Down
13 changes: 0 additions & 13 deletions lib/replicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const RemoteBitfield = require('./remote-bitfield')
const { REQUEST_CANCELLED, REQUEST_TIMEOUT, INVALID_CAPABILITY, SNAPSHOT_NOT_AVAILABLE } = require('hypercore-errors')
const m = require('./messages')
const caps = require('./caps')
const { createTracer } = require('hypertrace')

const DEFAULT_MAX_INFLIGHT = [16, 512]
const SCALE_LATENCY = 50
Expand Down Expand Up @@ -331,7 +330,6 @@ class RoundtripQueue {

class Peer {
constructor (replicator, protomux, channel, useSession, inflightRange) {
this.tracer = createTracer(this, { parent: replicator.core.tracer })
this.core = replicator.core
this.replicator = replicator
this.stream = protomux.stream
Expand Down Expand Up @@ -530,8 +528,6 @@ class Peer {
}

onclose (isRemote) {
this.tracer.trace('onclose')

// we might have signalled to the remote that we are done (ie not downloading) and the remote might agree on that
// if that happens, the channel might be closed by the remote. if so just renegotiate it.
// TODO: add a CLOSE_REASON to mux to we can make this cleaner...
Expand Down Expand Up @@ -682,8 +678,6 @@ class Peer {
}

async onrequest (msg) {
this.tracer.trace('onrequest', msg)

const size = this.remoteRequests.size
this.remoteRequests.set(msg.id, msg)

Expand Down Expand Up @@ -817,8 +811,6 @@ class Peer {
}

async ondata (data) {
this.tracer.trace('ondata', data)

// always allow a fork conflict proof to be sent
if (data.request === 0 && data.upgrade && data.upgrade.start === 0) {
if (await this.core.checkConflict(data, this)) return
Expand Down Expand Up @@ -888,8 +880,6 @@ class Peer {
}

onnodata ({ request }) {
this.tracer.trace('onnodata', { request })

const req = request > 0 ? this.replicator._inflight.get(request) : null

if (req === null || req.peer !== this) return
Expand Down Expand Up @@ -1397,8 +1387,6 @@ class Peer {
return
}

this.tracer.trace('send', req)

this.wireRequest.send(req)
incrementTx(this.stats.wireRequest, this.replicator.stats.wireRequest)
}
Expand All @@ -1416,7 +1404,6 @@ module.exports = class Replicator {
onupload = noop,
oninvalid = noop
} = {}) {
this.tracer = createTracer(this)
this.key = key
this.discoveryKey = core.crypto.discoveryKey(key)
this.core = core
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"hypercore-crypto": "^3.2.1",
"hypercore-errors": "^1.2.0",
"hypercore-id-encoding": "^1.2.0",
"hypertrace": "^1.2.1",
"is-options": "^1.0.1",
"protomux": "^3.5.0",
"quickbit-universal": "^2.2.0",
Expand Down

0 comments on commit 72cf1eb

Please sign in to comment.