Skip to content

Commit

Permalink
feat: add prometheus http metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianLoch committed Jun 23, 2024
1 parent f584d81 commit ce83633
Show file tree
Hide file tree
Showing 10 changed files with 207 additions and 79 deletions.
6 changes: 4 additions & 2 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
CASSETTE_APP_URL=https://cassette-app.de/
CASSETTE_APP_URL=https://cassette-for-spotify.app/
CASSETTE_MONGODB_URI=<CONNECTION_STRING>
CASSETTE_NETWORK_INTERFACE=0.0.0.0
CASSETTE_INTERNAL_NETWORK_INTERFACE=localhost
CASSETTE_PORT=8082
CASSETTE_INTERNAL_PORT=8083
CASSETTE_SPOTIFY_CLIENT_ID=<ID>
CASSETTE_SPOTIFY_CLIENT_KEY=<SECRET>
CASSETTE_ENV=DEV
CASSETTE_SECRET=<SOME KEY MATERIAL, THIS CAN BE SOME WEIRD BYTES OR A WEIRD SENTENCE LIKE THIS>
CASSETTE_SECRET=<SOME KEY MATERIAL, THIS CAN BE SOME WEIRD BYTES OR A WEIRD SENTENCE LIKE THIS>
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ coverage.out
node_modules/
.idea/
.vscode/
static/
static/
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RUN yarn install
COPY .git/ .git/
RUN GIT_VERSION=$(git describe --always) GIT_AUTHOR_DATE=$(git log -1 --format=%aI) BUILD_DATE=$(date +%Y-%m-%dT%H:%M:%S%z) yarn build

FROM alpine
FROM alpine:3.19
RUN apk --no-cache add ca-certificates
WORKDIR /app
COPY ./CHECKS .
Expand Down
2 changes: 1 addition & 1 deletion NOTES_ON_DOKKU.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
For the git revision to be available at build time in dokku's environment it is essential to configure dokku to keep the .git directory:
For the git revision to be available at build time in dokku's environment, it is essential to configure dokku to keep the `.git` directory:

```bash
# keep the .git directory during builds
Expand Down
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

An "audio book helper utility for Spotify&reg;".

***Try it out at https://cassette-app.de.***
***Try it out at https://cassette-for-spotify.app.***

Cassette is a small web application enabling you to pause and resume audiobooks on Spotify. Spotify offers a lot of great audiobooks but as its built with music in a broader sense in mind it does not provide essential features required in order to comfortably listen to them: pausing an audiobook and listening to some music results in you needing to think about in which chapter you left off.

Expand All @@ -17,17 +17,27 @@ Cassette tries to overcome this problem by enabling you to store your state, put


## How is this done?
Simply spoken by using the Spotify Web API. Cassette itself consists of two components, a REST service running on a server (this directory) and a web app (./web) running in your browser. The service is talking with the Spotify Web API and a MongoDB database in with the states get persisted. The web app talks with the service via a REST interface.
In a nutshell: By using the Spotify Web API.

Cassette itself consists of two parts:
- a REST service running on a server (this directory)
- a web app (./web) running in your browser

The service is talking with the Spotify Web API, and a MongoDB database in with the states get persisted.
The web app talks with the service via a REST interface.

## Current status of the project
After spending a lot of time rewriting all parts of this project I finally was able to release version 2. Although version 1, which had another name that could not be kept as it violated Spotify's branding guidelines, was available to the public already it was not really too robust, not really intuitive to use and overall not meant to be used by anyone but myself. It was more kind of a proof-of-concept project hacked together in a few days.

Version 2 is way more mature, takes care of data privacy, includes an interactive introduction tour and and a polished UI with both mobile and desktop users in mind. Its goal is to be, hopefully, useful to many users aside myself.
## Current status of the project
After spending a lot of time rewriting all parts of this project, I finally was able to release version 2.
Although version 1, which had another name that could not be kept as it violated Spotify's branding guidelines, was available to the public already, it was not really too robust, not really intuitive to use and overall not meant to be used by anyone but myself.
It was more a proof-of-concept project hacked together in a few days.

Version 2 is deployed at https://cassette-app.de.
Version 2 is way more mature, takes care of data privacy, includes an interactive introduction tour and a polished UI with both mobile and desktop users in mind.
Its goal is to be, hopefully, useful to many users aside myself.

Version 2 is deployed at https://cassette-for-spotify.app.


## Disclaimer
The authors of this project are not related to Spotify in any way beside being happy users of their platform. This service is not related to Spotify except using their API and content.
The authors of this project are not related to Spotify in any way besides being happy users of their platform.
This service is not related to Spotify; it is only using their API and content.
35 changes: 24 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/florianloch/cassette

go 1.22
go 1.22.3

toolchain go1.22.4

require (
github.com/gavv/httpexpect/v2 v2.16.0 // lock to this version, test breaks when upgrading
Expand All @@ -15,32 +17,42 @@ require (
golang.org/x/oauth2 v0.21.0
)

require (
github.com/prometheus/client_golang v1.19.1
github.com/slok/go-http-metrics v0.12.0
)

require (
github.com/TylerBrock/colorjson v0.0.0-20200706003622-8a50f05110d2 // indirect
github.com/ajg/form v1.5.1 // indirect
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/gorilla/securecookie v1.1.2 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/hpcloud/tail v1.0.0 // indirect
github.com/imkira/go-interpol v1.1.0 // indirect
github.com/klauspost/compress v1.15.0 // indirect
github.com/klauspost/compress v1.17.8 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.53.0 // indirect
github.com/prometheus/procfs v0.15.0 // indirect
github.com/rs/xid v1.5.0 // indirect
github.com/sanity-io/litter v1.5.5 // indirect
github.com/sergi/go-diff v1.0.0 // indirect
github.com/stretchr/testify v1.7.0 // indirect
github.com/stretchr/testify v1.9.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.34.0 // indirect
github.com/valyala/fasthttp v1.52.0 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.1.2 // indirect
github.com/xdg-go/stringprep v1.0.4 // indirect
Expand All @@ -51,11 +63,12 @@ require (
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
github.com/yudai/gojsondiff v1.0.0 // indirect
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/fsnotify.v1 v1.4.7 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading

0 comments on commit ce83633

Please sign in to comment.