asset: use embed over vfsdata implementation#3115
asset: use embed over vfsdata implementation#3115jan--f wants to merge 5 commits intoprometheus:mainfrom
Conversation
|
Not really sure what I'm doing when it comes to circleCI. I'll keep working at it, but if anyone wants to help I'm all ears 👂. |
|
Any chance of resurrecting this PR? Using the standard library |
|
Rebased. I'd love to move this forward too. @roidelapluie approved this in prometheus, maybe he can help? |
|
Thanks very much @jan--f I'll take a look soon. |
|
Thanks, we probably want to figure out #3299 first, unless someone has good insight into circleCI. |
|
Should we resume here now @jan--f ? |
|
@gotjosh Absolutely, I might need a day or two to get to it. |
This replicates work done in the prometheus repo in prometheus/prometheus#10220 plus a few follow up PRs. Asset compression is handled via https://github.com/prometheus/common/tree/main/assets Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
be0e56e to
7679407
Compare
Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
This will cause a lint failure Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
|
Seems like the circleci pipeline is running into https://discuss.circleci.com/t/orbs-cannot-find-a-definition-for-command-named/34530 @gotjosh wdyt...should I work on both fixing the circleci orb and the actions workflow or is there a reason to prioritize one over the other? |
|
Hello @jan--f , Sorry for having you wait this long. I definitely think this change is worth updating. The Circle CI is no longer relevant, and your GH action change was merged. So, I would assume this unblocks this change. Can you pick this up again or do you want to delegate this? I'll provide some speedy reviews. Kind regards, Solomon Jacobs |
This change removes the final usage of `shurcooL/vfsgen`. The change has
a couple of benefits:
* We no longer check in binary data. This improves the code review
process and reduces merge conflicts.
* Fewer dependencies.
* Simplifies the build process for downstream distributions such as
Debian.
* Removes logic around different build targets.
Additional differences between `vfsgen` and `embed`.
1) `embed` does not compress files, wheras `vfsgen` compresses the files
before adding them to the binary. However, the files are decompressed
before sending them. This means that the binary size in this change
slightly increases:
```sh
❯ du alertmanager-vfsgen
40540 alertmanager-vfsgen
❯ du alertmanager-embed
41756 alertmanager-embed
```
In the future, we should ensure that we only send compressed files over
the network. Moreover, we should compress the files before the build.
2) `vfsgen` will memory map the files on startup, i.e.,
```go
var Assets = func() http.FileSystem {
fs := vfsgen۰FS{ // map-like type
```
`embed` serves files from read-only section of the binary, see
https://github.com/golang/go/blob/9d828e80fa1f3cc52de60428cae446b35b576de8/src/embed/embed.go#L151
For this reason, this change should reduce the overall heap usage and
startup time.
3) The build still appears to be reproducible, tested by touching
`ui/app/script.js`. This is a deliberate decision in `embed`, i.e.,
golang/go#44854
4) With this change, we no longer send the `Last-Modified: Thu, 01 Jan
1970 00:00:01 GMT` HTTP header. Since we have disabled all caching,
this seems fair. In the future, we should enable caching.
Closes: prometheus#3115
Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
This change removes the final usage of `shurcooL/vfsgen`. The change has
a couple of benefits:
* We no longer check in binary data. This improves the code review
process and reduces merge conflicts.
* Fewer dependencies.
* Simplifies the build process for downstream distributions such as
Debian.
* Removes logic around different build targets.
Additional differences between `vfsgen` and `embed`.
1) `embed` does not compress files, wheras `vfsgen` compresses the files
before adding them to the binary. However, the files are decompressed
before sending them. This means that the binary size in this change
slightly increases:
```sh
❯ du alertmanager-vfsgen
40540 alertmanager-vfsgen
❯ du alertmanager-embed
41756 alertmanager-embed
```
In the future, we should ensure that we only send compressed files over
the network. Moreover, we should compress the files before the build.
2) `vfsgen` will memory map the files on startup, i.e.,
```go
var Assets = func() http.FileSystem {
fs := vfsgen۰FS{ // map-like type
```
`embed` serves files from read-only section of the binary, see
https://github.com/golang/go/blob/9d828e80fa1f3cc52de60428cae446b35b576de8/src/embed/embed.go#L151
For this reason, this change should reduce the overall heap usage and
startup time.
3) The build still appears to be reproducible, tested by touching
`ui/app/script.js`. This is a deliberate decision in `embed`, i.e.,
golang/go#44854
4) With this change, we no longer send the `Last-Modified: Thu, 01 Jan
1970 00:00:01 GMT` HTTP header. Since we have disabled all caching,
this seems fair. In the future, we should enable caching.
Closes: prometheus#3115
Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
This change removes the final usage of `shurcooL/vfsgen`. The change has
a couple of benefits:
* We no longer check in binary data. This improves the code review
process and reduces merge conflicts.
* Fewer dependencies.
* Simplifies the build process for downstream distributions such as
Debian.
* Removes logic around different build targets.
Additional differences between `vfsgen` and `embed`.
1) `embed` does not compress files, wheras `vfsgen` compresses the files
before adding them to the binary. However, the files are decompressed
before sending them. This means that the binary size in this change
slightly increases:
```sh
❯ du alertmanager-vfsgen
40540 alertmanager-vfsgen
❯ du alertmanager-embed
41756 alertmanager-embed
```
In the future, we should ensure that we only send compressed files over
the network. Moreover, we should compress the files before the build.
2) `vfsgen` will memory map the files on startup, i.e.,
```go
var Assets = func() http.FileSystem {
fs := vfsgen۰FS{ // map-like type
```
`embed` serves files from read-only section of the binary, see
https://github.com/golang/go/blob/9d828e80fa1f3cc52de60428cae446b35b576de8/src/embed/embed.go#L151
For this reason, this change should reduce the overall heap usage and
startup time.
3) The build still appears to be reproducible, tested by touching
`ui/app/script.js`. This is a deliberate decision in `embed`, i.e.,
golang/go#44854
4) With this change, we no longer send the `Last-Modified: Thu, 01 Jan
1970 00:00:01 GMT` HTTP header. Since we have disabled all caching,
this seems fair. In the future, we should enable caching.
Closes: prometheus#3115
Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
This change removes the final usage of `shurcooL/vfsgen`. The change has
a couple of benefits:
* We no longer check in binary data. This improves the code review
process and reduces merge conflicts.
* Fewer dependencies.
* Simplifies the build process for downstream distributions such as
Debian.
* Removes logic around different build targets.
Additional differences between `vfsgen` and `embed`.
1) `embed` does not compress files, wheras `vfsgen` compresses the files
before adding them to the binary. However, the files are decompressed
before sending them. This means that the binary size in this change
slightly increases:
```sh
❯ du alertmanager-vfsgen
40540 alertmanager-vfsgen
❯ du alertmanager-embed
41756 alertmanager-embed
```
In the future, we should ensure that we only send compressed files over
the network. Moreover, we should compress the files before the build.
2) `vfsgen` will memory map the files on startup, i.e.,
```go
var Assets = func() http.FileSystem {
fs := vfsgen۰FS{ // map-like type
```
`embed` serves files from read-only section of the binary, see
https://github.com/golang/go/blob/9d828e80fa1f3cc52de60428cae446b35b576de8/src/embed/embed.go#L151
For this reason, this change should reduce the overall heap usage and
startup time.
3) The build still appears to be reproducible, tested by touching
`ui/app/script.js`. This is a deliberate decision in `embed`, i.e.,
golang/go#44854
4) With this change, we no longer send the `Last-Modified: Thu, 01 Jan
1970 00:00:01 GMT` HTTP header. Since we have disabled all caching,
this seems fair. In the future, we should enable caching.
Closes: prometheus#3115
Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
This change removes the final usage of `shurcooL/vfsgen`. The change has
a couple of benefits:
* We no longer check in binary data. This improves the code review
process and reduces merge conflicts.
* Fewer dependencies.
* Simplifies the build process for downstream distributions such as
Debian.
* Removes logic around different build targets.
Additional differences between `vfsgen` and `embed`.
1) `embed` does not compress files, wheras `vfsgen` compresses the files
before adding them to the binary. However, the files are decompressed
before sending them. This means that the binary size in this change
slightly increases:
```sh
❯ du alertmanager-vfsgen
40540 alertmanager-vfsgen
❯ du alertmanager-embed
41756 alertmanager-embed
```
In the future, we should ensure that we only send compressed files over
the network. Moreover, we should compress the files before the build.
2) `vfsgen` will memory map the files on startup, i.e.,
```go
var Assets = func() http.FileSystem {
fs := vfsgen۰FS{ // map-like type
```
`embed` serves files from read-only section of the binary, see
https://github.com/golang/go/blob/9d828e80fa1f3cc52de60428cae446b35b576de8/src/embed/embed.go#L151
For this reason, this change should reduce the overall heap usage and
startup time.
3) The build still appears to be reproducible, tested by touching
`ui/app/script.js`. This is a deliberate decision in `embed`, i.e.,
golang/go#44854
4) With this change, we no longer send the `Last-Modified: Thu, 01 Jan
1970 00:00:01 GMT` HTTP header. Since we have disabled all caching,
this seems fair. In the future, we should enable caching.
Closes: prometheus#3115
Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
This change removes the final usage of `shurcooL/vfsgen`. The change has
a couple of benefits:
* We no longer check in binary data. This improves the code review
process and reduces merge conflicts.
* Fewer dependencies.
* Simplifies the build process for downstream distributions such as
Debian.
* Removes logic around different build targets.
Additional differences between `vfsgen` and `embed`.
1) `embed` does not compress files, wheras `vfsgen` compresses the files
before adding them to the binary. However, the files are decompressed
before sending them. This means that the binary size in this change
slightly increases:
```sh
❯ du alertmanager-vfsgen
40540 alertmanager-vfsgen
❯ du alertmanager-embed
41756 alertmanager-embed
```
In the future, we should ensure that we only send compressed files over
the network. Moreover, we should compress the files before the build.
2) `vfsgen` will memory map the files on startup, i.e.,
```go
var Assets = func() http.FileSystem {
fs := vfsgen۰FS{ // map-like type
```
`embed` serves files from read-only section of the binary, see
https://github.com/golang/go/blob/9d828e80fa1f3cc52de60428cae446b35b576de8/src/embed/embed.go#L151
For this reason, this change should reduce the overall heap usage and
startup time.
3) The build still appears to be reproducible, tested by touching
`ui/app/script.js`. This is a deliberate decision in `embed`, i.e.,
golang/go#44854
4) With this change, we no longer send the `Last-Modified: Thu, 01 Jan
1970 00:00:01 GMT` HTTP header. Since we have disabled all caching,
this seems fair. In the future, we should enable caching.
Closes: prometheus#3115
Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
This change removes the final usage of `shurcooL/vfsgen`. The change has
a couple of benefits:
* We no longer check in binary data. This improves the code review
process and reduces merge conflicts.
* Fewer dependencies.
* Simplifies the build process for downstream distributions such as
Debian.
* Removes logic around different build targets.
Additional differences between `vfsgen` and `embed`.
1) `embed` does not compress files, wheras `vfsgen` compresses the files
before adding them to the binary. However, the files are decompressed
before sending them. This means that the binary size in this change
slightly increases:
```sh
❯ du alertmanager-vfsgen
40540 alertmanager-vfsgen
❯ du alertmanager-embed
41756 alertmanager-embed
```
In the future, we should ensure that we only send compressed files over
the network. Moreover, we should compress the files before the build.
2) `vfsgen` will memory map the files on startup, i.e.,
```go
var Assets = func() http.FileSystem {
fs := vfsgen۰FS{ // map-like type
```
`embed` serves files from read-only section of the binary, see
https://github.com/golang/go/blob/9d828e80fa1f3cc52de60428cae446b35b576de8/src/embed/embed.go#L151
For this reason, this change should reduce the overall heap usage and
startup time.
3) The build still appears to be reproducible, tested by touching
`ui/app/script.js`. This is a deliberate decision in `embed`, i.e.,
golang/go#44854
4) With this change, we no longer send the `Last-Modified: Thu, 01 Jan
1970 00:00:01 GMT` HTTP header. Since we have disabled all caching,
this seems fair. In the future, we should enable caching.
Closes: prometheus#3115
Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
This change removes the final usage of `shurcooL/vfsgen`. The change has
a couple of benefits:
* We no longer check in binary data. This improves the code review
process and reduces merge conflicts.
* Fewer dependencies.
* Simplifies the build process for downstream distributions such as
Debian.
* Removes logic around different build targets.
Additional differences between `vfsgen` and `embed`.
1) `embed` does not compress files, wheras `vfsgen` compresses the files
before adding them to the binary. However, the files are decompressed
before sending them. This means that the binary size in this change
slightly increases:
```sh
❯ du alertmanager-vfsgen
40540 alertmanager-vfsgen
❯ du alertmanager-embed
41756 alertmanager-embed
```
In the future, we should ensure that we only send compressed files over
the network. Moreover, we should compress the files before the build.
2) `vfsgen` will memory map the files on startup, i.e.,
```go
var Assets = func() http.FileSystem {
fs := vfsgen۰FS{ // map-like type
```
`embed` serves files from read-only section of the binary, see
https://github.com/golang/go/blob/9d828e80fa1f3cc52de60428cae446b35b576de8/src/embed/embed.go#L151
For this reason, this change should reduce the overall heap usage and
startup time.
3) The build still appears to be reproducible, tested by touching
`ui/app/script.js`. This is a deliberate decision in `embed`, i.e.,
golang/go#44854
4) With this change, we no longer send the `Last-Modified: Thu, 01 Jan
1970 00:00:01 GMT` HTTP header. Since we have disabled all caching,
this seems fair. In the future, we should enable caching.
Closes: prometheus#3115
Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
This change removes the final usage of `shurcooL/vfsgen`. The change has
a couple of benefits:
* We no longer check in binary data. This improves the code review
process and reduces merge conflicts.
* Fewer dependencies.
* Simplifies the build process for downstream distributions such as
Debian.
* Removes logic around different build targets.
Additional differences between `vfsgen` and `embed`.
1) `embed` does not compress files, wheras `vfsgen` compresses the files
before adding them to the binary. However, the files are decompressed
before sending them. This means that the binary size in this change
slightly increases:
```sh
❯ du alertmanager-vfsgen
40540 alertmanager-vfsgen
❯ du alertmanager-embed
41756 alertmanager-embed
```
In the future, we should ensure that we only send compressed files over
the network. Moreover, we should compress the files before the build.
2) `vfsgen` will memory map the files on startup, i.e.,
```go
var Assets = func() http.FileSystem {
fs := vfsgen۰FS{ // map-like type
```
`embed` serves files from read-only section of the binary, see
https://github.com/golang/go/blob/9d828e80fa1f3cc52de60428cae446b35b576de8/src/embed/embed.go#L151
For this reason, this change should reduce the overall heap usage and
startup time.
3) The build still appears to be reproducible, tested by touching
`ui/app/script.js`. This is a deliberate decision in `embed`, i.e.,
golang/go#44854
4) With this change, we no longer send the `Last-Modified: Thu, 01 Jan
1970 00:00:01 GMT` HTTP header. Since we have disabled all caching,
this seems fair. In the future, we should enable caching.
Closes: prometheus#3115
Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
This change removes the final usage of `shurcooL/vfsgen`. The change has
a couple of benefits:
* We no longer check in binary data. This improves the code review
process and reduces merge conflicts.
* Fewer dependencies.
* Simplifies the build process for downstream distributions such as
Debian.
* Removes logic around different build targets.
Additional differences between `vfsgen` and `embed`.
1) `embed` does not compress files, wheras `vfsgen` compresses the files
before adding them to the binary. However, the files are decompressed
before sending them. This means that the binary size in this change
slightly increases:
```sh
❯ du alertmanager-vfsgen
40540 alertmanager-vfsgen
❯ du alertmanager-embed
41756 alertmanager-embed
```
In the future, we should ensure that we only send compressed files over
the network. Moreover, we should compress the files before the build.
2) `vfsgen` will memory map the files on startup, i.e.,
```go
var Assets = func() http.FileSystem {
fs := vfsgen۰FS{ // map-like type
```
`embed` serves files from read-only section of the binary, see
https://github.com/golang/go/blob/9d828e80fa1f3cc52de60428cae446b35b576de8/src/embed/embed.go#L151
For this reason, this change should reduce the overall heap usage and
startup time.
3) The build still appears to be reproducible, tested by touching
`ui/app/script.js`. This is a deliberate decision in `embed`, i.e.,
golang/go#44854
4) With this change, we no longer send the `Last-Modified: Thu, 01 Jan
1970 00:00:01 GMT` HTTP header. Since we have disabled all caching,
this seems fair. In the future, we should enable caching.
Closes: prometheus#3115
Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
This change removes `shurcooL/vfsgen`. The change has a couple of
benefits:
* Fewer dependencies.
* Simplifies the build process for downstream distributions such as
Debian.
* Removes logic around different build targets.
A few additional differences between `vfsgen` and `embed` now follow.
1) `embed` does not compress files, whereas `vfsgen` compresses the files
before adding them to the binary. However, the files are decompressed
before sending them. This means that the binary size in this change
slightly increases:
```sh
❯ du alertmanager-vfsgen
40540 alertmanager-vfsgen
❯ du alertmanager-embed
41756 alertmanager-embed
```
In the future, we should ensure that we only send compressed files over
the network. Moreover, we should compress the files before the build.
2) `vfsgen` will memory map the files on startup, i.e.,
```go
var Assets = func() http.FileSystem {
fs := vfsgen۰FS{ // map-like type
```
`embed` serves files from read-only section of the binary, see
https://github.com/golang/go/blob/9d828e80fa1f3cc52de60428cae446b35b576de8/src/embed/embed.go#L151
For this reason, this change should reduce the overall heap usage and
startup time.
3) The build still appears to be reproducible, tested by touching
`ui/app/script.js`. This is a deliberate decision in `embed`, i.e.,
golang/go#44854
4) With this change, we no longer send the `Last-Modified: Thu, 01 Jan
1970 00:00:01 GMT` HTTP header. Since we have disabled all caching,
this seems fair. In the future, we should enable caching.
Closes: prometheus#3115
Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
This change removes `shurcooL/vfsgen`. The change has a couple of
benefits:
* Fewer dependencies.
* Simplifies the build process for downstream distributions such as
Debian.
* Removes logic around different build targets.
A few additional differences between `vfsgen` and `embed` now follow.
1) `embed` does not compress files, whereas `vfsgen` compresses the files
before adding them to the binary. However, the files are decompressed
before sending them. This means that the binary size in this change
slightly increases:
```sh
❯ du alertmanager-vfsgen
40540 alertmanager-vfsgen
❯ du alertmanager-embed
41756 alertmanager-embed
```
In the future, we should ensure that we only send compressed files over
the network. Moreover, we should compress the files before the build.
2) `vfsgen` will memory map the files on startup, i.e.,
```go
var Assets = func() http.FileSystem {
fs := vfsgen۰FS{ // map-like type
```
`embed` serves files from read-only section of the binary, see
https://github.com/golang/go/blob/9d828e80fa1f3cc52de60428cae446b35b576de8/src/embed/embed.go#L151
For this reason, this change should reduce the overall heap usage and
startup time.
3) The build still appears to be reproducible, tested by touching
`ui/app/script.js`. This is a deliberate decision in `embed`, i.e.,
golang/go#44854
4) With this change, we no longer send the `Last-Modified: Thu, 01 Jan
1970 00:00:01 GMT` HTTP header. Since we have disabled all caching,
this seems fair. In the future, we should enable caching.
Closes: prometheus#3115
Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
This change removes `shurcooL/vfsgen`. The change has a couple of
benefits:
* Fewer dependencies.
* Simplifies the build process for downstream distributions such as
Debian.
* Removes logic around different build targets.
A few additional differences between `vfsgen` and `embed` now follow.
1) `embed` does not compress files, whereas `vfsgen` compresses the files
before adding them to the binary. However, the files are decompressed
before sending them. This means that the binary size in this change
slightly increases:
```sh
❯ du alertmanager-vfsgen
40540 alertmanager-vfsgen
❯ du alertmanager-embed
41756 alertmanager-embed
```
In the future, we should ensure that we only send compressed files over
the network. Moreover, we should compress the files before the build.
2) `vfsgen` will memory map the files on startup, i.e.,
```go
var Assets = func() http.FileSystem {
fs := vfsgen۰FS{ // map-like type
```
`embed` serves files from read-only section of the binary, see
https://github.com/golang/go/blob/9d828e80fa1f3cc52de60428cae446b35b576de8/src/embed/embed.go#L151
For this reason, this change should reduce the overall heap usage and
startup time.
3) The build still appears to be reproducible, tested by touching
`ui/app/script.js`. This is a deliberate decision in `embed`, i.e.,
golang/go#44854
4) With this change, we no longer send the `Last-Modified: Thu, 01 Jan
1970 00:00:01 GMT` HTTP header. Since we have disabled all caching,
this seems fair. In the future, we should enable caching.
Closes: prometheus#3115
Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
This change removes `shurcooL/vfsgen`. The change has a couple of
benefits:
* Fewer dependencies.
* Simplifies the build process for downstream distributions such as
Debian.
* Removes logic around different build targets.
A few additional differences between `vfsgen` and `embed` now follow.
1) `embed` does not compress files, whereas `vfsgen` compresses the files
before adding them to the binary. However, the files are decompressed
before sending them. This means that the binary size in this change
slightly increases:
```sh
❯ du alertmanager-vfsgen
40540 alertmanager-vfsgen
❯ du alertmanager-embed
41756 alertmanager-embed
```
In the future, we should ensure that we only send compressed files over
the network. Moreover, we should compress the files before the build.
2) `vfsgen` will memory map the files on startup, i.e.,
```go
var Assets = func() http.FileSystem {
fs := vfsgen۰FS{ // map-like type
```
`embed` serves files from read-only section of the binary, see
https://github.com/golang/go/blob/9d828e80fa1f3cc52de60428cae446b35b576de8/src/embed/embed.go#L151
For this reason, this change should reduce the overall heap usage and
startup time.
3) The build still appears to be reproducible, tested by touching
`ui/app/script.js`. This is a deliberate decision in `embed`, i.e.,
golang/go#44854
4) With this change, we no longer send the `Last-Modified: Thu, 01 Jan
1970 00:00:01 GMT` HTTP header. Since we have disabled all caching,
this seems fair. In the future, we should enable caching.
Closes: prometheus#3115
Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
This change removes `shurcooL/vfsgen`. The change has a couple of
benefits:
* Fewer dependencies.
* Simplifies the build process for downstream distributions such as
Debian.
* Removes logic around different build targets.
A few additional differences between `vfsgen` and `embed` now follow.
1) `embed` does not compress files, whereas `vfsgen` compresses the files
before adding them to the binary. However, the files are decompressed
before sending them. This means that the binary size in this change
slightly increases:
```sh
❯ du alertmanager-vfsgen
40540 alertmanager-vfsgen
❯ du alertmanager-embed
41756 alertmanager-embed
```
In the future, we should ensure that we only send compressed files over
the network. Moreover, we should compress the files before the build.
2) `vfsgen` will memory map the files on startup, i.e.,
```go
var Assets = func() http.FileSystem {
fs := vfsgen۰FS{ // map-like type
```
`embed` serves files from read-only section of the binary, see
https://github.com/golang/go/blob/9d828e80fa1f3cc52de60428cae446b35b576de8/src/embed/embed.go#L151
For this reason, this change should reduce the overall heap usage and
startup time.
3) The build still appears to be reproducible, tested by touching
`ui/app/script.js`. This is a deliberate decision in `embed`, i.e.,
golang/go#44854
4) With this change, we no longer send the `Last-Modified: Thu, 01 Jan
1970 00:00:01 GMT` HTTP header. Since we have disabled all caching,
this seems fair. In the future, we should enable caching.
Closes: prometheus#3115
Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
Signed-off-by: VAN LINT <marnix.vanlint@worldline.com>
This change removes `shurcooL/vfsgen`. The change has a couple of
benefits:
* Fewer dependencies.
* Simplifies the build process for downstream distributions such as
Debian.
* Removes logic around different build targets.
A few additional differences between `vfsgen` and `embed` now follow.
1) `embed` does not compress files, whereas `vfsgen` compresses the files
before adding them to the binary. However, the files are decompressed
before sending them. This means that the binary size in this change
slightly increases:
```sh
❯ du alertmanager-vfsgen
40540 alertmanager-vfsgen
❯ du alertmanager-embed
41756 alertmanager-embed
```
In the future, we should ensure that we only send compressed files over
the network. Moreover, we should compress the files before the build.
2) `vfsgen` will memory map the files on startup, i.e.,
```go
var Assets = func() http.FileSystem {
fs := vfsgen۰FS{ // map-like type
```
`embed` serves files from read-only section of the binary, see
https://github.com/golang/go/blob/9d828e80fa1f3cc52de60428cae446b35b576de8/src/embed/embed.go#L151
For this reason, this change should reduce the overall heap usage and
startup time.
3) The build still appears to be reproducible, tested by touching
`ui/app/script.js`. This is a deliberate decision in `embed`, i.e.,
golang/go#44854
4) With this change, we no longer send the `Last-Modified: Thu, 01 Jan
1970 00:00:01 GMT` HTTP header. Since we have disabled all caching,
this seems fair. In the future, we should enable caching.
Closes: prometheus#3115
Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
Signed-off-by: VAN LINT <marnix.vanlint@worldline.com>
This change removes `shurcooL/vfsgen`. The change has a couple of
benefits:
* Fewer dependencies.
* Simplifies the build process for downstream distributions such as
Debian.
* Removes logic around different build targets.
A few additional differences between `vfsgen` and `embed` now follow.
1) `embed` does not compress files, whereas `vfsgen` compresses the files
before adding them to the binary. However, the files are decompressed
before sending them. This means that the binary size in this change
slightly increases:
```sh
❯ du alertmanager-vfsgen
40540 alertmanager-vfsgen
❯ du alertmanager-embed
41756 alertmanager-embed
```
In the future, we should ensure that we only send compressed files over
the network. Moreover, we should compress the files before the build.
2) `vfsgen` will memory map the files on startup, i.e.,
```go
var Assets = func() http.FileSystem {
fs := vfsgen۰FS{ // map-like type
```
`embed` serves files from read-only section of the binary, see
https://github.com/golang/go/blob/9d828e80fa1f3cc52de60428cae446b35b576de8/src/embed/embed.go#L151
For this reason, this change should reduce the overall heap usage and
startup time.
3) The build still appears to be reproducible, tested by touching
`ui/app/script.js`. This is a deliberate decision in `embed`, i.e.,
golang/go#44854
4) With this change, we no longer send the `Last-Modified: Thu, 01 Jan
1970 00:00:01 GMT` HTTP header. Since we have disabled all caching,
this seems fair. In the future, we should enable caching.
Closes: prometheus#3115
Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
This replicates work done in the prometheus repo in prometheus/prometheus#10220 plus a few follow up PRs. Asset compression is handled via https://github.com/prometheus/common/tree/main/assets
Signed-off-by: Jan Fajerski jfajersk@redhat.com