Skip to content

Commit

Permalink
Merge branch 'dev' (0.4.3-1)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosabalde committed Jan 30, 2025
2 parents b584b84 + 8650231 commit 82b94b8
Show file tree
Hide file tree
Showing 11 changed files with 190 additions and 20 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
- 0.4.3-1 (2025-01-30):
+ Fixed zoom reset in charts.

- 0.4.2-1 (2025-01-28):
+ Fixed handling of gaps in metrics.
+ Moved the Go project to the GitHub namespace.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SHELL := /bin/bash
ROOT := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
UMASK := 022

VERSION := 0.4.2
VERSION := 0.4.3
ITERATION := 1
REVISION := $(shell cd '$(ROOT)' && git rev-parse --short HEAD)
ENVIRONMENT ?= production
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/allenta/varnishmon)](https://goreportcard.com/report/github.com/allenta/varnishmon)
[![Go Reference](https://pkg.go.dev/badge/github.com/allenta/varnishmon.svg)](https://pkg.go.dev/github.com/allenta/varnishmon)

`varnishmon` is a utility inspired by the [classic `atop` tool](https://www.atoptool.nl). It periodically collects metrics from [Varnish Cache](https://varnish-cache.org) / [Varnish Enterprise](https://www.varnish-software.com/products/varnish-enterprise/) using the [`varnishstat` utility](https://varnish-cache.org/docs/trunk/reference/varnishstat.html), stores them in a [DuckDB](https://duckdb.org) database, and provides a simple built-in web interface for visualizing the timeseries data. **In summary, `varnishmon` is a tool designed to effortlessly record, visualize, and share `varnishstat` output with minimal setup.**
`varnishmon` is a utility inspired by the [classic `atop` tool](https://www.atoptool.nl). It periodically collects metrics from [Varnish Cache](https://varnish-cache.org) / [Varnish Enterprise](https://www.varnish-software.com/products/varnish-enterprise/) using the [`varnishstat` utility](https://varnish-cache.org/docs/trunk/reference/varnishstat.html), stores them in a [DuckDB](https://duckdb.org) database, and provides a simple built-in web interface for visualizing the timeseries data. **In summary, `varnishmon` is a tool designed to effortlessly record, visualize, and share historical `varnishstat` output with minimal setup.**

![varnishmon demo](extras/demo.png)

Expand Down
2 changes: 1 addition & 1 deletion assets/static/app.js

Large diffs are not rendered by default.

23 changes: 6 additions & 17 deletions assets/webpack/src/js/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,23 +200,21 @@ class Chart {
}

handleGraphRelayout(event) {
// Extract the zoom range of the graph.
// Extract the zoom range of the graph, if any. This includes detecting the
// no-zoom / zoom-reset event.
if (event['xaxis.range[0]'] && event['xaxis.range[1]']) {
this.graph.zoomRange = [
new Date(event['xaxis.range[0]']),
new Date(event['xaxis.range[1]']),
];
} else if (event['xaxis.range'] && Array.isArray(event['xaxis.range']) && event['xaxis.range'].length === 2) {
this.graph.zoomRange = [
new Date(event['xaxis.range'][0]),
new Date(event['xaxis.range'][1]),
];
this.graph.zoomRange = null;
} else {
this.graph.zoomRange = null;
}

// If the zoom range goes beyond the original range, adjust it to the
// original range.
// If the zoom range goes beyond the current range, adjust it to the
// current range.
if (this.graph.zoomRange != null) {
if (helpers.dateToUnix(this.graph.zoomRange[0]) < helpers.dateToUnix(this.graph.range[0])) {
this.graph.zoomRange[0] = this.graph.range[0];
Expand All @@ -238,15 +236,6 @@ class Chart {
}
}

// In the zoom range is identical to the original range, reset the zoom
// range so listeners can detect the no-zoom event.
if (this.graph.zoomRange != null) {
if (helpers.dateToUnix(this.graph.zoomRange[0]) === helpers.dateToUnix(this.graph.range[0]) &&
helpers.dateToUnix(this.graph.zoomRange[1]) === helpers.dateToUnix(this.graph.range[1])) {
this.graph.zoomRange = null;
}
}

// Force a re-render of the graph. The zoom range is already applied, but we
// might want to adjust other properties of the graph (e.g., the data mode),
// or the adjusted zoom range itself.
Expand All @@ -255,7 +244,7 @@ class Chart {
// Inform listeners about the zoom event.
this.notifyEventListeners('zoom', {
target: this,
range: this.graph.zoomRange,
range: this.graph.zoomRange, // null if no zoom.
});
}

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ require (
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.7.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI=
github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
Expand Down
47 changes: 47 additions & 0 deletions pkg/workers/api/mock_Application.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions pkg/workers/mock_APIHandler.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions pkg/workers/mock_Application.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions pkg/workers/storage/mock_Application.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 82b94b8

Please sign in to comment.