@helia/verified-fetch 7.0.4 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -0
- package/dist/index.min.js +61 -61
- package/dist/index.min.js.map +4 -4
- package/dist/src/index.d.ts +82 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +71 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/url-resolver.d.ts.map +1 -1
- package/dist/src/url-resolver.js +4 -3
- package/dist/src/url-resolver.js.map +1 -1
- package/dist/src/utils/abbreviate.d.ts +4 -0
- package/dist/src/utils/abbreviate.d.ts.map +1 -0
- package/dist/src/utils/abbreviate.js +45 -0
- package/dist/src/utils/abbreviate.js.map +1 -0
- package/dist/src/utils/server-timing.js +1 -1
- package/dist/src/utils/server-timing.js.map +1 -1
- package/dist/src/verified-fetch.d.ts.map +1 -1
- package/dist/src/verified-fetch.js +54 -1
- package/dist/src/verified-fetch.js.map +1 -1
- package/package.json +16 -14
- package/src/index.ts +83 -1
- package/src/url-resolver.ts +4 -3
- package/src/utils/abbreviate.ts +57 -0
- package/src/utils/server-timing.ts +1 -1
- package/src/verified-fetch.ts +59 -1
package/README.md
CHANGED
|
@@ -805,6 +805,77 @@ To add your own plugin:
|
|
|
805
805
|
|
|
806
806
|
For a detailed explanation of the pipeline, please refer to the discussion in [Issue #167](https://github.com/ipfs/helia-verified-fetch/issues/167).
|
|
807
807
|
|
|
808
|
+
### Server-Timing
|
|
809
|
+
|
|
810
|
+
Detailed timing is found in the [Server-Timing](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Server-Timing)
|
|
811
|
+
HTTP header that is returned with every response when a resource is requested
|
|
812
|
+
with the `withServerTiming` init option set to `true`.
|
|
813
|
+
|
|
814
|
+
To prevent the header value growing too large, PeerIDs/CIDs are truncated to
|
|
815
|
+
their first 10 characters and common strings are abbreviated.
|
|
816
|
+
|
|
817
|
+
The values you may expect to see are described in the following table. Note
|
|
818
|
+
that not all of them may be present in a given response.
|
|
819
|
+
|
|
820
|
+
Router, block broker and transport abbreviations used in the `desc` fields
|
|
821
|
+
follow.
|
|
822
|
+
|
|
823
|
+
| Timing metric | Elaboration | Detail | Example |
|
|
824
|
+
| ------------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
|
|
825
|
+
| d | DNSLink.resolve | Resolving a DNSLink to an IPFS path or IPNS name | `d;dur=0.200` |
|
|
826
|
+
| i | IPFS.resolve | Resolving a CID + path to a CID | `i;dur=0.200` |
|
|
827
|
+
| n | IPNS.resolve | Resolving an IPNS name to an IPFS path | `n;dur=0.200` |
|
|
828
|
+
| p | Provider | A provider was found. The `desc` field contains the routing system that found the provider and the first 10 characters of the PeerId | `p;dur=0.000;desc="h,bagqbeaawn"` |
|
|
829
|
+
| f | Find Providers | The total duration of the routing systems Find Providers operation. The `desc` field contains the routing system and how many providers were found | `f;dur=2.000;desc="h,4"` |
|
|
830
|
+
| c | Connect | How long it took to connect to a provider. The `desc` field contains the type of provider, the first 10 characters of their PeerId and the transport used | `b;dur=0.000;desc="t,bagqbeaa7n,bafybeigoc,t"` |
|
|
831
|
+
| b | Block | How long it took to retrieve a block from the provider once connected. The `desc` field contains the type of provider, the first 10 characters of their PeerId and the first 10 characters of the CID | `b;dur=0.000;desc="t,bagqbeaa7n,bafybeigoc"` |
|
|
832
|
+
|
|
833
|
+
A full header might look like:
|
|
834
|
+
|
|
835
|
+
```
|
|
836
|
+
i;dur=0.000,p;dur=0.000;desc="h,bagqbeaawn",p;dur=0.000;desc="h,bagqbeaawn",p;dur=1.000;desc="h,bagqbeaa7n",p;dur=1.000;desc="h,bagqbeaa7n",f;dur=1.000;desc="h,4",f;dur=1.000;desc="h,4",f;dur=144.000;desc="l,0",f;dur=144.000;desc="l,0",c;dur=206.000;desc="t,bagqbeaa7n,h",b;dur=1.000;desc="t,bagqbeaa7n,bafybeigoc"
|
|
837
|
+
```
|
|
838
|
+
|
|
839
|
+
Here resolving a CID to a CID+path took less than a millisecond (e.g. a bare
|
|
840
|
+
CID was requested).
|
|
841
|
+
|
|
842
|
+
Two HTTP Gateway providers were found in the routing (`bagqbeaawn` and
|
|
843
|
+
`bagqbeaa7n`). They are found twice because two block brokers are configured
|
|
844
|
+
(bitswap and trustless-gateway) which both make a routing request (results
|
|
845
|
+
are cached internally so the duration to find them the second time differs).
|
|
846
|
+
|
|
847
|
+
It took 206ms to connect to `bagqbeaa7n` over HTTP, and 1s to retrieve the
|
|
848
|
+
block for the CID `bafybeigo` from the Trustless Gateway `bagqbeaa7n`.
|
|
849
|
+
|
|
850
|
+
All PeerIDs and CIDs above are truncated to 10 characters.
|
|
851
|
+
|
|
852
|
+
#### Router abbreviations
|
|
853
|
+
|
|
854
|
+
| Router | Elaboration |
|
|
855
|
+
| ------ | --------------------- |
|
|
856
|
+
| h | HTTP Gateway |
|
|
857
|
+
| l | Libp2p (e.g. Kad-DHT) |
|
|
858
|
+
|
|
859
|
+
#### Block broker abbreviations
|
|
860
|
+
|
|
861
|
+
| Block Broker | Elaboration |
|
|
862
|
+
| ------------ | ----------------- |
|
|
863
|
+
| t | Trustless Gateway |
|
|
864
|
+
| b | Bitswap |
|
|
865
|
+
|
|
866
|
+
#### Transport abbreviations
|
|
867
|
+
|
|
868
|
+
| Transport | Elaboration |
|
|
869
|
+
| --------- | ------------- |
|
|
870
|
+
| t | TCP |
|
|
871
|
+
| h | HTTP |
|
|
872
|
+
| w | WebSockets |
|
|
873
|
+
| r | WebRTC |
|
|
874
|
+
| d | WebRTC-Direct |
|
|
875
|
+
| q | QUIC |
|
|
876
|
+
| b | WebTransport |
|
|
877
|
+
| u | Unknown |
|
|
878
|
+
|
|
808
879
|
# Install
|
|
809
880
|
|
|
810
881
|
```console
|