Commit Graph

13313 Commits

Author SHA1 Message Date
Gus Eggert
bb68a68525
feat: port collect-profiles.sh to 'ipfs diag profile' (#8786)
* feat: add block profiling to collect-profiles.sh

* feat: add more profiles to 'ipfs diag profile'

This adds mutex and block profiles, and brings the command up-to-par
with 'collect-profiles.sh', so that we can remove it.

Profiles are also now collected concurrently, which improves the
runtime from (profile_time * num_profiles) to just (profile_time).

Note that this has a backwards-incompatible change, removing
--cpu-profile-time in favor of the more general --profile-time, which
covers all sampling profiles.

* docs(cli): ipfs diag profile

* add CLI flag to select specific diag collectors

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2022-04-12 11:58:03 -04:00
Jorropo
ca4a3ed961 fix: assets: correctly use the argument err in the WalkDirFunc Hashing Files 2022-04-12 02:36:19 +02:00
Franky W
70398d275c Change assets.Asset from a func to the embed.FS
This removes the delegation to the function and requires all callers
that used the `asset.Asset` func to access to asset via the `embed.FS`
2022-04-12 02:36:19 +02:00
Franky W
9210c08fa6 Remove gobindata
Since go1.16, there are built in tools that allow for embeding
filesystem inside the binary. We now make use of the `embed` package to
have all files put into the binary, removing the need to generate the
files and removes dependencies

Co-authored-by: Jorropo <jorropo.pgm@gmail.com>
2022-04-12 02:36:19 +02:00
Gus Eggert
9bd346e250
fix: fix context plumbing in gateway handlers (#8871)
This ensures that child contexts are passed around between
the handlers so that traces show the call hierarchy correctly.
2022-04-11 23:09:00 +02:00
makeworld
52bf133946
fix(gw): missing return if dir fails to finalize (#8806) 2022-04-08 23:09:23 +02:00
Adin Schmahmann
e1c8d78d7d
chore: update deps (#8859) 2022-04-08 22:31:26 +02:00
Ian Davis
fbf76663f4
fix(gw): update metrics only when payload data sent (#8827)
* fix: report gateway http metrics only when response is successful
* fix(gw): 304 Not Modified as no-op

This fix ensures we don't do any additional work when Etag match
what user already has in their own cache.

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2022-04-08 22:07:44 +02:00
Adin Schmahmann
d18f1f7ea9 Merge branch 'release' 2022-04-08 15:23:32 -04:00
Adin Schmahmann
0e8b121aba
Merge pull request #8861 from ipfs/release-v0.12.2
Release v0.12.2
2022-04-08 15:00:45 -04:00
Adin Schmahmann
9b5ff415a0 Release v0.12.2 2022-04-08 14:42:41 -04:00
Adin Schmahmann
d7b60d44fd build: update to Go 1.16.15 2022-04-08 14:42:41 -04:00
Adin Schmahmann
2e4fdb267d ci: test against the correct version of go-ipfs-http-client 2022-04-08 14:42:41 -04:00
Adin Schmahmann
5fc3338c75 docs: update changelog for v0.12.2 and v0.11.1 2022-04-08 14:42:41 -04:00
Adin Schmahmann
2685983536 chore: update go-codec-dagpb 2022-04-08 14:42:41 -04:00
Marcin Rataj
5d712166b2
feat: detect changes in go-libp2p-resource-manager (#8857)
This adds simple check that will scream loud and clear every time
go-libp2p libraries change any of the implicit defaults
related to go-libp2p-resource-manager
2022-04-08 17:43:30 +02:00
Marten Seemann
514411bedb
feat: opt-in Swarm.ResourceMgr (go-libp2p v0.18) (#8680)
* update go-libp2p to v0.18.0

* initialize the resource manager

* add resource manager stats/limit commands

* load limit file when building resource manager

* log absent limit file

* write rcmgr to file when IPFS_DEBUG_RCMGR is set

* fix: mark swarm limit|stats as experimental

* feat(cfg): opt-in Swarm.ResourceMgr

This ensures we can safely test the resource manager without impacting
default behavior.

- Resource manager is disabled by default
    - Default for Swarm.ResourceMgr.Enabled is false for now
- Swarm.ResourceMgr.Limits allows user to tweak limits per specific
  scope in a way that is persisted across restarts
- 'ipfs swarm limit system' outputs human-readable json
- 'ipfs swarm limit system new-limits.json' sets new runtime limits
  (but does not change Swarm.ResourceMgr.Limits in the config)

Conventions to make libp2p devs life easier:
- 'IPFS_RCMGR=1 ipfs daemon' overrides the config and enables resource manager
- 'limit.json' overrides implicit defaults from libp2p (if present)

* docs(config): small tweaks

* fix: skip libp2p.ResourceManager if disabled

This ensures 'ipfs swarm limit|stats' work only when enabled.

* fix: use NullResourceManager when disabled

This reverts commit b19f7c9eca.
after clarification feedback from
https://github.com/ipfs/go-ipfs/pull/8680#discussion_r841680182

* style: rename IPFS_RCMGR to LIBP2P_RCMGR

preexisting libp2p toggles use LIBP2P_ prefix

* test: Swarm.ResourceMgr

* fix: location of opt-in limit.json and rcmgr.json.gz

Places these files inside of IPFS_PATH

* Update docs/config.md

* feat: expose rcmgr metrics when enabled (#8785)

* add metrics for the resource manager
* export protocol and service name in Prometheus metrics
* fix: expose rcmgr metrics only when enabled

Co-authored-by: Marcin Rataj <lidel@lidel.org>

* refactor: rcmgr_metrics.go

* refactor: rcmgr_defaults.go

This file defines implicit limit defaults used when Swarm.ResourceMgr.Enabled

We keep vendored copy to ensure go-ipfs is not impacted when go-libp2p
decides to change defaults in any of the future releases.

* refactor: adjustedDefaultLimits

Cleans up the way we initialize defaults and adds a fix for case
when connection manager runs with high limits.

It also hides `Swarm.ResourceMgr.Limits` until we have a better
understanding what syntax makes sense.

* chore: cleanup after a review

* fix: restore go-ipld-prime v0.14.2

* fix: restore go-ds-flatfs v0.5.1

Co-authored-by: Lucas Molas <schomatis@gmail.com>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
2022-04-07 21:06:35 -04:00
Marcin Rataj
7871a0beb7
feat(cmds): add support for CAR v2 imports (#8854)
* feat: add support for carv2 import
* update to multicodec 0.4.0
* add sharness test for carv2

Co-authored-by: Keenan Nemetz <keenan.nemetz@gmail.com>
2022-04-07 04:33:13 +02:00
Marcin Rataj
dd06dd0018
chore: add CODEOWNERS (#8852) 2022-04-06 09:14:15 -07:00
Justin Johnson
7b2c7c7f16
docs(logging): environment variables (#8833)
- Document IPFS_LOGGING deprecation
  as alias to GOLOG_LOG_LEVEL and expand doc
  to include per-subsystem log levels.

- Document IPFS_LOGGING_FMT deprecation
  as alias to GOLOG_LOG_FMT.
2022-04-06 17:24:23 +02:00
Marcin Rataj
e309682545
fix: unknown fetcher type error (#8830)
match RetryFetcher as HttpFetcher
2022-04-06 02:10:13 +02:00
Marcin Rataj
5ae47522cc
chore: deprecate tar commands (#8849)
Closes #7951
2022-04-06 02:06:17 +02:00
Jorropo
4df7b7922f
Merge pull request #8838 from Jorropo/fix/ErrNotFound-hopefully-final
chore: bump go-ipld-format v0.4.0 and fix related sharness tests
2022-04-05 21:07:15 +02:00
Gus Eggert
f855bfe6ef
feat: add basic gateway tracing (#8595)
* add deprecation warning when tracer plugins are loaded
* add response format attribute to span in gateway handler
* add note about tracing's experimental status in godoc
* add nil check for TTL when adding name span attrs
* add basic sharness test for integration with otel collector
* add nil check in UnixFSAPI.processLink
* test: sharness check all json objs for swarm span
* add env var docs to docs/environment-variables.md
* chore: pin the otel collector version
* add tracing spans per response type (#8841)
* docs: tracing with jaeger-ui

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2022-04-04 19:24:05 +02:00
Lucas Molas
282ac7f1f5
fix(cli): ipfs add with multiple files of same name (#8493) 2022-04-03 10:40:38 -04:00
Jorropo
ac297a829e chore: block/blockstoreutil remove unused ProcRmOutput function 2022-04-02 05:07:51 +02:00
Jorropo
f72110c2d8 fix: use error instead of strings as error in blockstoreutil/remove 2022-04-02 05:07:51 +02:00
Jorropo
e36f28d581 chore: bump go-ipld-format v0.4.0 and fix related sharness tests 2022-04-02 05:07:51 +02:00
Marcin Rataj
5fa556945e
fix(gw): validate requested CAR version (#8835)
* fix(gw): validate requested CAR version

This adds validation of 'application/vnd.ipld.car;version=n' passed
in the Accept header by HTTP clients to align Gateway behavior with
the spec submitted to IANA.

* test: fix comment in test/sharness/t0118-gateway-car.sh

Co-authored-by: Gus Eggert <gus@gus.dev>

Co-authored-by: Gus Eggert <gus@gus.dev>
2022-04-01 09:12:46 -07:00
Gus Eggert
46c3689b75
feat: re-enable docker sharness tests (#8808)
The Docker sharness tests were disabled years ago when go-ipfs moved
from Travis to CircleCI. This makes the tweaks necessary to re-enable
them.

The Docker image has since moved to be based on BusyBox which doesn't
have the requisite wget version for the existing tests to work, so
this adds some functionality to the pollEndpoint program to support
polling HTTP endpoints as well.
2022-03-30 11:07:26 -04:00
Marcin Rataj
d6de97b417
docs: gateway.md (#8825)
Adds link to relevant pages at docs.ipfs.io
2022-03-28 16:31:36 +02:00
Lucas Molas
d92887086f
fix(core/commands): do not cache config (#8824) 2022-03-27 08:11:45 -04:00
Omicron166
d13a09a076
remove unused import (#8787) 2022-03-25 08:48:16 -07:00
Jorropo
d02e4aa841 CI: force running go-ipfs-http-client and go-ipfs-api tests
This test is actually testing is the ipfs binary (from the path).
Using the go-ipfs-http-client code.
But most PR only update the binary. HOWEVER Golang does not check PATH for caching.
So as far as golang knows: go-ipfs-http-client is old, it havn't changed, and it doesn't run it.

That leads us to this test not running on most important PR.
2022-03-24 17:48:05 +01:00
Marcin Rataj
a61c53f87f
feat(cmds): document deprecated RPC API commands (#8802)
* feat(cmds): add deprecated and experimental status

Added programmatic state annotation introduced in
https://github.com/ipfs/go-ipfs-cmds/pull/225
for already deprecated / experimental commands.

* chore: go-ipfs-cmds v0.7.0

Co-authored-by: Lucas Molas <schomatis@gmail.com>
2022-03-22 20:46:32 +01:00
Lucas Molas
c8543904d9
Merge pull request #8793 from ipfs/kylehuntsman/fix/repo/omitempty-error
fix(fsrepo): deep merge when setting config
2022-03-22 11:02:29 -03:00
Lucas Molas
f62bd64fdb allow config to fail as we have no empty default 2022-03-21 19:03:37 -03:00
Adin Schmahmann
beaa8fc29b
feat: add gateway histogram metrics (#8443)
* feat(gw): response type histogram metrics

- response-type agnostic firstContentBlockGetMetric which counts the
  latency til the first content block.

- car/block/file/gen-dir-index duration histogram metrics that show how
  long each response type takes

* docs: improve metrics descriptions
* feat: more gw histogram buckets

0.05, 0.1, 0.25, 0.5, 1, 2, 5, 10, 30, 60 secs
as suggested in reviews at https://github.com/ipfs/go-ipfs/pull/8443

Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: Gus Eggert <gus@gus.dev>
2022-03-21 15:57:08 +01:00
Hector Sanjuan
0dabcc2db6
Merge pull request #8803 from ipfs/bubble-err-not-found
ErrNotFound changes: bubble tagged libraries.
2022-03-19 16:13:10 +01:00
Hector Sanjuan
943187d001 ErrNotFound changes: bubble tagged libraries.
Additionally fixes tests for new error message which went from

`ipld: <cid> not found`

to

`<cid> not found`
2022-03-19 00:16:45 +01:00
Dimitris Apostolou
6c6a55056d Fix typos 2022-03-18 00:58:36 +01:00
Jorropo
09aed2d63b
Merge pull request #8757 from ipfs/feat/err-not-found
Bubble ErrNotFound improvements.

The is a really nice UX improvement because it know tell you which ipld block is missing instead of a generic "not found".
2022-03-18 00:42:40 +01:00
Jorropo
7c2033f215 chore: update deps
The commits has been moved from the PR to master to avoid the deps breaking when github is gonna GC the PR commits.
2022-03-18 00:28:29 +01:00
Gus Eggert
da2b9bd71a
Merge pull request #8784 from ipfs/release-v0.12.1
Release v0.12.1
2022-03-17 12:52:26 -04:00
Marcin Rataj
4cabdfefbf
feat(gateway): Block and CAR response formats (#8758)
* feat: serveRawBlock implements ?format=block
* feat: serveCar implements ?format=car
* feat(gw): ?format= or Accept HTTP header

- extracted file-like content type responses to separate .go files
- Accept HTTP header with support for application/vnd.ipld.* types

* fix: use .bin for raw block content-disposition

.raw may be handled by something, depending on OS, and .bin
seems to be universally "binary file" across all systems:
https://en.wikipedia.org/wiki/List_of_filename_extensions_(A%E2%80%93E)

* refactor: gateway_handler_unixfs.go

- Moved UnixFS response handling to gateway_handler_unixfs*.go files.
- Removed support for X-Ipfs-Gateway-Prefix (Closes #7702)

* refactor: prefix cleanup and readable paths

- removed dead code after X-Ipfs-Gateway-Prefix is gone
  (https://github.com/ipfs/go-ipfs/issues/7702)
- escaped special characters in content paths returned with http.Error
  making them both safer and easier to reason about (e.g. when invisible
  whitespace Unicode is used)
2022-03-17 17:15:24 +01:00
Dave Justice
6774ef9dfd
fix: allow ipfs-companion browser extension to access RPC API (#8690)
* fix: add companion ids to allow origins

- fixes #8689
- Adds the chrome-extension ids for ipfs-companion and
ipfs-companion-beta to the allowed origins list, this
allows us to accesss ipfs api from a manifest v3 extension.
- added tests in t0401-api-browser-security.sh

* fix: companion when custom CORS *-Origin is set

Companion extension should be able to access RPC API even when custom
Access-Control-Allow-Origin is set

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2022-03-17 00:07:52 +01:00
Lucas Molas
e14f580ba7
Merge pull request #8638 from ipfs/schomatis/fix/core/node/unwrap-fx-error
fix(core/node): unwrap fx error in node construction
2022-03-16 19:45:51 -03:00
Lucas Molas
519863ecab fix(core/node): unwrap fx error in node construction 2022-03-16 19:32:31 -03:00
Lucas Molas
3c09c260bf remove todo 2022-03-16 19:03:03 -03:00
Gus Eggert
bc33ed4c35
Update PATCH_RELEASE_TEMPLATE.md 2022-03-16 17:50:46 -04:00