@helia/verified-fetch 7.1.0 → 7.2.1

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 CHANGED
@@ -805,6 +805,82 @@ 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
+ The `dur` field is in milliseconds, so `dur=100` took 100ms. It is possible
815
+ to measure in greater precision, but given these are network operations it's
816
+ better to limit the precision and have a smaller header size, since
817
+ downloading the headers impacts the time to first byte.
818
+
819
+ To prevent the header value growing too large, PeerIDs/CIDs are truncated to
820
+ their first 10 characters and common strings are abbreviated.
821
+
822
+ The values you may expect to see are described in the following table. Note
823
+ that not all of them may be present in a given response.
824
+
825
+ Router, block broker and transport abbreviations used in the `desc` fields
826
+ follow.
827
+
828
+ | Timing metric | Elaboration | Detail | Example |
829
+ | ------------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
830
+ | d | DNSLink.resolve | Resolving a DNSLink to an IPFS path or IPNS name | `d;dur=0.200` |
831
+ | i | IPFS.resolve | Resolving a CID + path to a CID | `i;dur=0.200` |
832
+ | n | IPNS.resolve | Resolving an IPNS name to an IPFS path | `n;dur=0.200` |
833
+ | 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"` |
834
+ | 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"` |
835
+ | 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"` |
836
+ | 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"` |
837
+
838
+ A full header might look like:
839
+
840
+ ```
841
+ i;dur=0,p;dur=0;desc="h,bagqbeaawn",p;dur=0;desc="h,bagqbeaawn",p;dur=1;desc="h,bagqbeaa7n",p;dur=1;desc="h,bagqbeaa7n",f;dur=1;desc="h,4",f;dur=1;desc="h,4",f;dur=144;desc="l,0",f;dur=144;desc="l,0",c;dur=206;desc="t,bagqbeaa7n,h",b;dur=1;desc="t,bagqbeaa7n,bafybeigoc"
842
+ ```
843
+
844
+ Here resolving a CID to a CID+path took less than a millisecond (e.g. a bare
845
+ CID was requested).
846
+
847
+ Two HTTP Gateway providers were found in the routing (`bagqbeaawn` and
848
+ `bagqbeaa7n`). They are found twice because two block brokers are configured
849
+ (bitswap and trustless-gateway) which both make a routing request (results
850
+ are cached internally so the duration to find them the second time differs).
851
+
852
+ It took 206ms to connect to `bagqbeaa7n` over HTTP, and 1s to retrieve the
853
+ block for the CID `bafybeigo` from the Trustless Gateway `bagqbeaa7n`.
854
+
855
+ All PeerIDs and CIDs above are truncated to 10 characters.
856
+
857
+ #### Router abbreviations
858
+
859
+ | Router | Elaboration |
860
+ | ------ | --------------------- |
861
+ | h | HTTP Gateway |
862
+ | l | Libp2p (e.g. Kad-DHT) |
863
+
864
+ #### Block broker abbreviations
865
+
866
+ | Block Broker | Elaboration |
867
+ | ------------ | ----------------- |
868
+ | t | Trustless Gateway |
869
+ | b | Bitswap |
870
+
871
+ #### Transport abbreviations
872
+
873
+ | Transport | Elaboration |
874
+ | --------- | ------------- |
875
+ | t | TCP |
876
+ | h | HTTP |
877
+ | w | WebSockets |
878
+ | r | WebRTC |
879
+ | d | WebRTC-Direct |
880
+ | q | QUIC |
881
+ | b | WebTransport |
882
+ | u | Unknown |
883
+
808
884
  # Install
809
885
 
810
886
  ```console