Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log request domains in quota aggregation #15

Merged
merged 3 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/beige-houses-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'uhttp-exit-app': patch
---

Log domain no quota reporting
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"typescript": "^5.4.5"
},
"dependencies": {
"@hoprnet/uhttp-lib": "^3.0.2",
"@hoprnet/uhttp-lib": "^3.3.0",
"debug": "^4.3.4",
"sqlite3": "^5.1.7",
"ws": "^8.18.0"
Expand Down
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -545,12 +545,16 @@ async function reportToDiscoveryPlatform({
}) {
const lastReqSeg = cacheEntry.segments.get(cacheEntry.count - 1) as Segment.Segment;
const rpcMethod = determineRPCmethod(reqPayload.body);
const url = new URL(reqPayload.endpoint);
const domain = url.hostname;

const quotaRequest: DpApi.QuotaParams = {
clientId: reqPayload.clientId,
rpcMethod,
segmentCount: cacheEntry.count,
lastSegmentLength: lastReqSeg.body.length,
chainId: reqPayload.chainId,
domain,
type: 'request',
};

Expand All @@ -561,6 +565,7 @@ async function reportToDiscoveryPlatform({
segmentCount: segments.length,
lastSegmentLength: lastRespSeg.body.length,
chainId: reqPayload.chainId,
domain,
type: 'response',
};

Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -573,10 +573,10 @@
"@noble/curves" "^1.3.0"
"@noble/hashes" "^1.3.3"

"@hoprnet/uhttp-lib@^3.0.2":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@hoprnet/uhttp-lib/-/uhttp-lib-3.0.2.tgz#5ad0f5fd0771cb1b1ff895d23fe3c5678c5a1b43"
integrity sha512-J2LDSH0Fu7DlH/e3Iv1NKW9JTb7Y7xXD1LxkuHI9hyDm3cePSG3g1f6DR1p+rJLldRFgVqnuJENOaz/kRPmx6g==
"@hoprnet/uhttp-lib@^3.3.0":
version "3.3.0"
resolved "https://registry.yarnpkg.com/@hoprnet/uhttp-lib/-/uhttp-lib-3.3.0.tgz#11ab38f3da1bd6dca6ecc93e19e582fc827ab313"
integrity sha512-oFw+eCSO2uyaCmp48JazzyilPSZ8Z2SW7JAoq40YpKbiilG7rqWW+sdVWHegjqdN2RNJJnNFonXT+7UWdE0mSw==
dependencies:
"@hoprnet/uhttp-crypto" "^1.0.1"
debug "^4.3.4"
Expand Down
Loading