A link shortening service.
Intention was in creation of a simple functionality showcasing usage of Clean Architecture, Prometheus, Grafana and Alertmanager, and different types of storages.
$ git clone https://github.com/vkuksa/shortly.git && cd shortly
$ make
$ make test
Supported metrics:
shortly_http_request_count
(Total number of requests by route)shortly_http_request_seconds
(Total amount of request time by route, in seconds)shortly_error_count
(Errors notification)
Prometheus supported as datasource. Refer to ./grafana/provisioning/datasources/prometheus_ds.yml
configuration file.
Triggers upon alert of shortly_error_count with "internal" appears.
Implement REST and GraphQL interfaces for data fetching
Endpoints:
POST /links for retrieving encoded link
GET /links/{uuid} for retrieving link info
GET /{uuid} for re-dirrection
Endpoint: /graphql
Query or mutation is specified in "query" url parameter
Query example: /graphql?query={link(uuid:"aHR0cHM6Ly93d3cuZ29vZ2xlLmNvbS9tYXBz"){uuid,url,count,createdAt,expiresAt}}
Mutation example: /graphql?query=mutation+_{shorten(url:"https://google.com/"){uuid}}
Uses index creation for efficient lookup over uuid field
Using SwissMap https://github.com/dolthub/swiss as a main storage