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

V1 api #103

Closed
wants to merge 140 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
68aa27e
First draft of the Endpoint structure
arl Jan 7, 2023
6a77236
_example/default: switch to statsviz.Endpoint
arl Jan 7, 2023
bc86b87
_example/chi: switch to statsviz.Endpoint
arl Jan 7, 2023
fb48df4
_example: simplify test scripts
arl Jan 7, 2023
8d7b7c0
_example/echo: switch to statsviz.Endpoint
arl Jan 7, 2023
904ace5
_example/fasthttp: switch to statsviz.Endpoint
arl Jan 7, 2023
0ecc9ff
_example/fiber: switch to statsviz.Endpoint
arl Jan 7, 2023
7ab3e91
_example/gin: switch to statsviz.Endpoint
arl Jan 7, 2023
b5f9dd6
_example/gorilla: switch to statsviz.Endpoint
arl Jan 7, 2023
476368d
_example/https: switch to statsviz.Endpoint
arl Jan 7, 2023
6d8d41d
_example/iris: switch to statsviz.Endpoint
arl Jan 7, 2023
d340f1f
_example/middleware: switch to statsviz.Endpoint
arl Jan 7, 2023
ef7b678
_example/mux: switch to statsviz.Endpoint
arl Jan 7, 2023
613ab08
_example/options: switch to statsviz.Endpoint
arl Jan 7, 2023
edba2fb
remove handlers.go
arl Jan 7, 2023
d945104
remove register.go
arl Jan 7, 2023
e394056
Adapt tests
arl Jan 7, 2023
43537b4
Reorganization
arl Jan 8, 2023
5ef6331
Move plot.List into Endpoint
arl Jan 8, 2023
98375cf
internal/plot: construct List with NewList
arl Jan 8, 2023
8d39b58
Improve docs
arl Jan 8, 2023
4e04e65
s/endpoint{_test}.go/statsviz{_test}.go
arl Jan 8, 2023
340f61d
Use a 'func option', to prevent misusing the API
arl Jan 10, 2023
0cc0d78
internal/plot: pre-allocate plots slice
arl Jan 10, 2023
2029f53
internal/plot: cosmetics
arl Feb 25, 2023
da622ef
internal/plot: rewrite comment
arl Feb 25, 2023
d9d9f06
internal/plot: renaming
arl Feb 25, 2023
c45812e
internal/plot: add reserved plot names to avoid conflicts
arl Feb 25, 2023
7ef3a29
Cosmetics
arl Feb 25, 2023
d01ff28
Introduce the TimeSeriesBuilder struct
arl Feb 26, 2023
4466738
internal/plot: support scatter user plots
arl Feb 27, 2023
8666e8f
First UserPlot public API
arl Feb 27, 2023
376c030
Cosmetics and typos
arl Feb 27, 2023
dd8d05b
Add new WithUserPlot Endpoint option
arl Feb 27, 2023
8074a6a
internal/plot: add test to verify all metrics are plotted
arl Feb 27, 2023
eb3dc15
Add go.mod to _example directory
arl Feb 27, 2023
fb9eaa1
Simplify non-exported user plot API
arl Feb 27, 2023
6a435d4
Move examples_test to module root
arl Feb 28, 2023
d0a13ae
.github: remove separate examples step
arl Feb 28, 2023
41d609a
.github: add go mod tidy check
arl Feb 28, 2023
f5671b3
_example/iris: fix go.mod
arl Feb 28, 2023
2410c92
On run example tests on unixes
arl Feb 28, 2023
1b40de6
ci: on linux, runs on 1.18 and 1.20
arl Feb 28, 2023
a1709d9
_example: simpler work function
arl Feb 28, 2023
2def130
_example: bump all examples to go1.17
arl Feb 28, 2023
f01468d
_example/iris: dependabot
arl Feb 28, 2023
71f5b2c
_example/gin: dependabot
arl Feb 28, 2023
b40d4b9
_example/fiber: dependabot
arl Feb 28, 2023
79f13a0
_example/fasthttp: dependabot
arl Feb 28, 2023
2082967
Increase http client timeout in examples test
arl Feb 28, 2023
be22dbb
Skip TestExamples in -short mode
arl Mar 3, 2023
b831423
Move Value func into TimeSeries struct
arl Mar 3, 2023
28afb12
_example: improve prose/comments
arl Mar 3, 2023
a63f9c6
Rename userplot option, s/AddSeries/AddTimeSeries
arl Mar 3, 2023
59caba6
Cosmetics
arl Mar 3, 2023
fc4cc80
Cosmetics
arl Mar 4, 2023
62ad353
Improve doc
arl Mar 23, 2023
04d8d5a
Improve hijack middleware and rename it to intercept
arl Mar 23, 2023
684583c
Organize imports
arl Mar 23, 2023
74a1f5f
_example: add userplots example
arl Mar 23, 2023
6c3dad9
testdata: add userplots testscript
arl Mar 23, 2023
4cda406
internal/plot: remove leftover
arl Mar 23, 2023
343afb3
README: update
arl May 2, 2023
e9bc6f2
CONTRIBUTING.md: update
arl May 2, 2023
cda5236
README+CONTRIBUTING.md: capitalize Statsviz
arl May 2, 2023
67be73d
Capitalize Statsviz in code comments
arl May 2, 2023
572452b
Cosmetics
arl May 2, 2023
1b68372
fix typo
arl Jun 19, 2023
47dab31
internal/plot: replace anonymous with named structs
arl Jun 19, 2023
59ab264
Use plain structs for user plot config, remove the builder pattern
arl Jun 19, 2023
813ac92
_example/userplot: adapt example to new api
arl Jun 19, 2023
ae3b987
internal/plot: improve histogram API go doc
arl Jun 28, 2023
8f891b4
internal/plot: remove unused structures
arl Jun 28, 2023
d6efe46
Package go doc fixes
arl Jun 28, 2023
da4d7de
s/Endpoint/Server
arl Jun 28, 2023
16832d4
_example: s/Endpoint/Server
arl Jun 28, 2023
e085223
Improve package and Server godocs
arl Jul 2, 2023
93d5e25
_example: s/endpoint/server
arl Jul 2, 2023
2136bec
testdata: remove useless comments
arl Jul 2, 2023
2bae086
Make Server zero-value useful
arl Jul 2, 2023
2f96b05
Update README.md
arl Jul 2, 2023
d2f5b3a
README.md: make sure plots are aligned on pkgsite README
arl Jul 2, 2023
acbff44
Fix use of deprecated httptest.ResponseRecorder.HeaderMap
arl Aug 2, 2023
91c1e7d
Fix, again, empty page after reload
arl Aug 2, 2023
1b4946a
static: fix use of tick suffix
arl Aug 2, 2023
0d32d43
Document TimeSeriesPlotConfig fields
arl Aug 3, 2023
2622ad6
Document user plot types
arl Aug 12, 2023
c7b32d9
Re-add Register and RegisterDefault, but deprecate the latter.
arl Aug 12, 2023
1445ae9
_example: use either Register or NewServer
arl Aug 12, 2023
d50fb48
Function taking options may error, so return an error, like before.
arl Aug 12, 2023
10823f0
_example: fix api
arl Aug 12, 2023
f1b67a7
_example: Fix gin example
arl Aug 15, 2023
c01b8b0
ci: update to go 1.19, 1.20, 1.21
arl Aug 15, 2023
24cbb57
Fix typo s/statviz/statsviz in docs
arl Sep 21, 2023
22b56d9
Update README.md
arl Sep 22, 2023
6d4bb50
_example/middleware: cosmetics
arl Sep 22, 2023
4c4d00f
_example/gin: bump gin
arl Sep 23, 2023
ee0202d
_example/iris: bump iris
arl Sep 23, 2023
5abcd20
_example/fiber: bump fiber
arl Sep 23, 2023
be70a03
_example/echo: bump echo
arl Sep 23, 2023
55f0574
ci: enable test execution order shuffling
arl Sep 23, 2023
53c695d
go.{mod,sum}: bump go-internal
arl Sep 23, 2023
b431878
go.mod: bump minimal go version to go1.19
arl Sep 23, 2023
355e0a9
_example: bump min go version to go1.19
arl Sep 23, 2023
84eda9d
ci: use go1.21 for coverage and non-linux tests
arl Sep 23, 2023
6017834
README: remove plot lists from toc
arl Sep 23, 2023
57024f8
CHANGELOG.md: add unreleased section
arl Sep 23, 2023
86e74b4
Update README
arl Sep 23, 2023
de32b21
README.md: reorganize badges
arl Sep 23, 2023
a67364c
Revert "_example/iris: bump iris"
arl Sep 24, 2023
ddd287e
_example/iris: downgrade to latest version using go1.19
arl Sep 24, 2023
e4bd3ef
README.md: improve advanced usage example code
arl Sep 24, 2023
a968c44
s/interface{}/any
arl Sep 24, 2023
5378c2b
internal/plots: register plots constructors with registerPlotFunc
arl Sep 24, 2023
519b04b
internal/plots: add 'gc-cycles' plot
arl Sep 24, 2023
8168e1f
internal/plots: add 'memory-classes' plot
arl Sep 24, 2023
29dacb8
internal/plots: move new plots in plots.go
arl Sep 24, 2023
4036d29
README.md: add 2 new plots
arl Sep 24, 2023
ad89786
internal/plots: split plots.go into 2 (add plots_list.go)
arl Sep 24, 2023
c5bab90
README: rephrase Questions section
arl Sep 25, 2023
eef1f23
go.mod: drop go1.19, use go1.20
arl Sep 30, 2023
5c8ef73
internal/plot: cosmetics
arl Sep 30, 2023
5108bf6
internal/plot: use literal map creation syntax
arl Sep 30, 2023
ae78d42
internal/plot: add cpu-classes (gc)
arl Sep 30, 2023
ac760a3
Update README.md
arl Sep 30, 2023
4dcedd9
internal/plot: disregard /godebug metrics in TestUnusedRuntimeMetrics
arl Oct 1, 2023
428d110
internal/plot: reorganize cpu-classes (gc) code
arl Oct 1, 2023
321b112
internal/plot: add mutex wait plot
arl Oct 1, 2023
eaf4c49
Update README
arl Oct 1, 2023
51df408
internal/plot: use 'foo per seconds' instead of 'foo per unit of time'
arl Oct 1, 2023
19fc056
internal/plot: add gc scan plot
arl Oct 1, 2023
a4d0997
Update README
arl Oct 1, 2023
c5e76cd
internal/static: simplify plots.js
arl Oct 3, 2023
4afcadd
internal/static: cosmetics
arl Oct 3, 2023
94602d6
internal/static: cosmetics
arl Oct 3, 2023
4d855e6
_example: work sometimes runs a forced GC
arl Oct 3, 2023
ad260bf
Enable stacked plots: add Subplot.Type and Layout.BarMode
arl Oct 3, 2023
dd9e847
internal/plot: make 'gc-cycles' a stacked bar plot
arl Oct 3, 2023
9678f65
internal/plot: make 'gc-scan' a stacked bar plot
arl Oct 3, 2023
50ca4bc
STATSVIZ_DEBUG env var selects whether assets are embedded or from di…
arl Oct 3, 2023
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
20 changes: 20 additions & 0 deletions .github/scripts/modtidy-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
TMPDIR="$(mktemp -d)"
trap 'rm -rf -- "$TMPDIR"' EXIT

# Copy files before 'go mod tidy' potentially modifies them.
cp go.{mod,sum} "${TMPDIR}"

go mod tidy

diff go.mod "${TMPDIR}/go.mod"
diff go.sum "${TMPDIR}/go.sum"

if ! git diff --no-index --quiet go.mod "${TMPDIR}/go.mod"; then
echo -ne "\n\nRunning 'go mod tidy' modified go.mod"
exit 1
fi
if ! git diff --no-index --quiet go.sum "${TMPDIR}/go.sum"; then
echo -ne "\n\nRunning 'go mod tidy' modified go.sum"
exit 1
fi
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.19.x
go-version: 1.21.x
- run: go test -coverprofile=coverage.txt
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
Expand Down
16 changes: 4 additions & 12 deletions .github/workflows/tests-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,14 @@ jobs:
test:
strategy:
matrix:
go-version: [1.17.x, 1.18.x, 1.19.x]
go-version: [1.20.x, 1.21.x]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: go mod tidy check
run: .github/scripts/modtidy-check.sh
- name: Tests
run: go test -race ./...

test-examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.19.x
- name: Test Examples
run: cd _example && go test -race .
run: go test -race -shuffle=on ./...
4 changes: 2 additions & 2 deletions .github/workflows/tests-others.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.19.x
go-version: 1.21.x
- name: Tests
run: go test -race ./...
run: go test -race -shuffle=on ./...
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Unreleased
==============
* Add light/dark mode selector (#108)

v0.5.2 / 2023-03-29
==============
* Ensure all files have a correct Content-Type (#106)
Expand Down
23 changes: 15 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Contributing
============

First of all, thank you for considering to contribute to statsviz!
First of all, thank you for considering to contribute to Statsviz!

Pull-requests are welcome!


## Go library

The statsviz Go public API is relatively light so there's not much to do and at the moment
The Statsviz Go public API is relatively light so there's not much to do and at the moment
it's unlikely that the API will change. However some new options can be added to
`statsviz.Register` without breaking compatibility.

Expand All @@ -29,6 +29,12 @@ The user interface aims to be simple, light and minimal.
Assets are located in the `internal/static` directory and are embedded with
[`go:embed`](https://pkg.go.dev/embed).

Depending on what your modifications are, it's always a good idea to check that
some of the examples in [./_example](./_example/) work with your modifications
to Statsviz. To do so `cd` to the directory of the example and run:

go mod edit -replace=github.com/arl/statsviz=../../


## Documentation

Expand All @@ -38,21 +44,22 @@ are welcome!

## Examples

There are many Go libraries to handle HTTP routing.
There are many Go libraries to handle HTTP requests, routing, etc..

Feel free to add an example to show how to register statsviz with your favourite
Feel free to add an example to show how to register Statsviz with your favourite
library.

Please add a directory under `./_example`. For instance, if you want to add an
example showing how to register statsviz within library `foobar`:
To do so, please add a directory under `./_example`. For instance, if you want to add an
example showing how to register Statsviz within library `foobar`:

- create a directory `./_example/foobar/`
- create a file `./_example/foobar/main.go`
- call `go example.Work()` as the first line of your example (see other
examples). This forces the garbage collector to _do something_ so that
statsviz interface won't remain static when an user runs your example.
Statsviz interface won't remain static when an user runs your example.
- the code should be `gofmt`ed
- the example should compile and run
- when ran, statsviz interface should be accessible at http://localhost:8080/debug/statsviz
- when ran, Statsviz interface should be accessible at http://localhost:8080/debug/statsviz


Thank you!
Loading