Skip to content

Commit

Permalink
feat: add metrics endpoint
Browse files Browse the repository at this point in the history
This adds a Prometheus format metrics endpoint at `/metrics`.

This endpoint publishes metrics for request count and request duration.
  • Loading branch information
morremeyer committed Nov 19, 2023
1 parent 86b7b76 commit bc946c0
Show file tree
Hide file tree
Showing 20 changed files with 675 additions and 534 deletions.
125 changes: 65 additions & 60 deletions api/docs.go

Large diffs are not rendered by default.

125 changes: 65 additions & 60 deletions api/swagger.json

Large diffs are not rendered by default.

124 changes: 64 additions & 60 deletions api/swagger.yaml

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ require (
gorm.io/gorm v1.25.5
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
)

require (
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/bytedance/sonic v1.10.2 // indirect
Expand Down Expand Up @@ -53,6 +63,7 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.17.0
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
Expand Down
23 changes: 21 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM=
github.com/bytedance/sonic v1.10.2 h1:GQebETVBxYB7JGWJtLBi07OVzWwt+8dWA00gEVW2ZFE=
github.com/bytedance/sonic v1.10.2/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk=
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d h1:77cEq6EriyTZ0g/qfRdp61a3Uu/AWrgIq2s0ClJV1g0=
Expand Down Expand Up @@ -68,9 +72,12 @@ github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGF
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
Expand Down Expand Up @@ -112,6 +119,8 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
Expand All @@ -126,11 +135,19 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q=
github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY=
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 h1:v7DLqVdK4VrYkVD5diGdl4sxJurKJEMnODWRJlxV9oM=
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU=
github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY=
github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY=
github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI=
github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8=
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.20.0/go.mod h1:IzD0RJ65iWH0w97OQQebJEvTZYvsCUm9WVLWBQrJRjo=
Expand Down Expand Up @@ -185,6 +202,7 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg=
golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -219,6 +237,7 @@ golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
Expand Down
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ func main() {
ctx = context.WithValue(ctx, database.ContextURL, url)
controller := controllers.Controller{DB: db.WithContext(ctx)}

r, err := router.Config(url)
r, teardown, err := router.Config(url)
defer teardown()

if err != nil {
log.Fatal().Msg(err.Error())
}
Expand Down
62 changes: 31 additions & 31 deletions pkg/controllers/account_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ func (co Controller) RegisterAccountRoutes(r *gin.RouterGroup) {

// Account with ID
{
r.OPTIONS("/:accountId", co.OptionsAccountDetail)
r.GET("/:accountId", co.GetAccount)
r.PATCH("/:accountId", co.UpdateAccount)
r.DELETE("/:accountId", co.DeleteAccount)
r.OPTIONS("/:id", co.OptionsAccountDetail)
r.GET("/:id", co.GetAccount)
r.PATCH("/:id", co.UpdateAccount)
r.DELETE("/:id", co.DeleteAccount)
}
}

Expand All @@ -135,13 +135,13 @@ func (co Controller) OptionsAccountList(c *gin.Context) {
// @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs
// @Tags Accounts
// @Success 204
// @Failure 400 {object} httperrors.HTTPError
// @Failure 404 {object} httperrors.HTTPError
// @Failure 500 {object} httperrors.HTTPError
// @Param accountId path string true "ID formatted as string"
// @Router /v1/accounts/{accountId} [options]
// @Failure 400 {object} httperrors.HTTPError
// @Failure 404 {object} httperrors.HTTPError
// @Failure 500 {object} httperrors.HTTPError
// @Param id path string true "ID formatted as string"
// @Router /v1/accounts/{id} [options]
func (co Controller) OptionsAccountDetail(c *gin.Context) {
id, err := uuid.Parse(c.Param("accountId"))
id, err := uuid.Parse(c.Param("id"))
if err != nil {
httperrors.InvalidUUID(c)
return
Expand Down Expand Up @@ -262,14 +262,14 @@ func (co Controller) GetAccounts(c *gin.Context) {
// @Description Returns a specific account
// @Tags Accounts
// @Produce json
// @Success 200 {object} AccountResponse
// @Failure 400 {object} httperrors.HTTPError
// @Failure 404 {object} httperrors.HTTPError
// @Failure 500 {object} httperrors.HTTPError
// @Param accountId path string true "ID formatted as string"
// @Router /v1/accounts/{accountId} [get]
// @Success 200 {object} AccountResponse
// @Failure 400 {object} httperrors.HTTPError
// @Failure 404 {object} httperrors.HTTPError
// @Failure 500 {object} httperrors.HTTPError
// @Param id path string true "ID formatted as string"
// @Router /v1/accounts/{id} [get]
func (co Controller) GetAccount(c *gin.Context) {
id, err := uuid.Parse(c.Param("accountId"))
id, err := uuid.Parse(c.Param("id"))
if err != nil {
httperrors.InvalidUUID(c)
return
Expand All @@ -289,15 +289,15 @@ func (co Controller) GetAccount(c *gin.Context) {
// @Description Updates an account. Only values to be updated need to be specified.
// @Tags Accounts
// @Produce json
// @Success 200 {object} AccountResponse
// @Failure 400 {object} httperrors.HTTPError
// @Failure 404 {object} httperrors.HTTPError
// @Failure 500 {object} httperrors.HTTPError
// @Param accountId path string true "ID formatted as string"
// @Param account body models.AccountCreate true "Account"
// @Router /v1/accounts/{accountId} [patch]
// @Success 200 {object} AccountResponse
// @Failure 400 {object} httperrors.HTTPError
// @Failure 404 {object} httperrors.HTTPError
// @Failure 500 {object} httperrors.HTTPError
// @Param id path string true "ID formatted as string"
// @Param account body models.AccountCreate true "Account"
// @Router /v1/accounts/{id} [patch]
func (co Controller) UpdateAccount(c *gin.Context) {
id, err := uuid.Parse(c.Param("accountId"))
id, err := uuid.Parse(c.Param("id"))
if err != nil {
httperrors.InvalidUUID(c)
return
Expand Down Expand Up @@ -336,13 +336,13 @@ func (co Controller) UpdateAccount(c *gin.Context) {
// @Tags Accounts
// @Produce json
// @Success 204
// @Failure 400 {object} httperrors.HTTPError
// @Failure 404 {object} httperrors.HTTPError
// @Failure 500 {object} httperrors.HTTPError
// @Param accountId path string true "ID formatted as string"
// @Router /v1/accounts/{accountId} [delete]
// @Failure 400 {object} httperrors.HTTPError
// @Failure 404 {object} httperrors.HTTPError
// @Failure 500 {object} httperrors.HTTPError
// @Param id path string true "ID formatted as string"
// @Router /v1/accounts/{id} [delete]
func (co Controller) DeleteAccount(c *gin.Context) {
id, err := uuid.Parse(c.Param("accountId"))
id, err := uuid.Parse(c.Param("id"))
if err != nil {
httperrors.InvalidUUID(c)
return
Expand Down
62 changes: 31 additions & 31 deletions pkg/controllers/allocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ func (co Controller) RegisterAllocationRoutes(r *gin.RouterGroup) {

// Transaction with ID
{
r.OPTIONS("/:allocationId", co.OptionsAllocationDetail)
r.GET("/:allocationId", co.GetAllocation)
r.PATCH("/:allocationId", co.UpdateAllocation)
r.DELETE("/:allocationId", co.DeleteAllocation)
r.OPTIONS("/:id", co.OptionsAllocationDetail)
r.GET("/:id", co.GetAllocation)
r.PATCH("/:id", co.UpdateAllocation)
r.DELETE("/:id", co.DeleteAllocation)
}
}

Expand All @@ -109,13 +109,13 @@ func (co Controller) OptionsAllocationList(c *gin.Context) {
// @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs
// @Tags Allocations
// @Success 204
// @Failure 400 {object} httperrors.HTTPError
// @Failure 404 {object} httperrors.HTTPError
// @Failure 500 {object} httperrors.HTTPError
// @Param allocationId path string true "ID formatted as string"
// @Router /v1/allocations/{allocationId} [options]
// @Failure 400 {object} httperrors.HTTPError
// @Failure 404 {object} httperrors.HTTPError
// @Failure 500 {object} httperrors.HTTPError
// @Param id path string true "ID formatted as string"
// @Router /v1/allocations/{id} [options]
func (co Controller) OptionsAllocationDetail(c *gin.Context) {
id, err := uuid.Parse(c.Param("allocationId"))
id, err := uuid.Parse(c.Param("id"))
if err != nil {
httperrors.InvalidUUID(c)
return
Expand Down Expand Up @@ -224,14 +224,14 @@ func (co Controller) GetAllocations(c *gin.Context) {
// @Description Returns a specific allocation
// @Tags Allocations
// @Produce json
// @Success 200 {object} AllocationResponse
// @Failure 400 {object} httperrors.HTTPError
// @Failure 404 {object} httperrors.HTTPError
// @Failure 500 {object} httperrors.HTTPError
// @Param allocationId path string true "ID formatted as string"
// @Router /v1/allocations/{allocationId} [get]
// @Success 200 {object} AllocationResponse
// @Failure 400 {object} httperrors.HTTPError
// @Failure 404 {object} httperrors.HTTPError
// @Failure 500 {object} httperrors.HTTPError
// @Param id path string true "ID formatted as string"
// @Router /v1/allocations/{id} [get]
func (co Controller) GetAllocation(c *gin.Context) {
id, err := uuid.Parse(c.Param("allocationId"))
id, err := uuid.Parse(c.Param("id"))
if err != nil {
httperrors.InvalidUUID(c)
return
Expand All @@ -257,15 +257,15 @@ func (co Controller) GetAllocation(c *gin.Context) {
// @Tags Allocations
// @Accept json
// @Produce json
// @Success 200 {object} AllocationResponse
// @Failure 400 {object} httperrors.HTTPError
// @Failure 404 {object} httperrors.HTTPError
// @Failure 500 {object} httperrors.HTTPError
// @Param allocationId path string true "ID formatted as string"
// @Param allocation body models.AllocationCreate true "Allocation"
// @Router /v1/allocations/{allocationId} [patch]
// @Success 200 {object} AllocationResponse
// @Failure 400 {object} httperrors.HTTPError
// @Failure 404 {object} httperrors.HTTPError
// @Failure 500 {object} httperrors.HTTPError
// @Param id path string true "ID formatted as string"
// @Param allocation body models.AllocationCreate true "Allocation"
// @Router /v1/allocations/{id} [patch]
func (co Controller) UpdateAllocation(c *gin.Context) {
id, err := uuid.Parse(c.Param("allocationId"))
id, err := uuid.Parse(c.Param("id"))
if err != nil {
httperrors.InvalidUUID(c)
return
Expand Down Expand Up @@ -304,13 +304,13 @@ func (co Controller) UpdateAllocation(c *gin.Context) {
// @Description Deletes an allocation
// @Tags Allocations
// @Success 204
// @Failure 400 {object} httperrors.HTTPError
// @Failure 404 {object} httperrors.HTTPError
// @Failure 500 {object} httperrors.HTTPError
// @Param allocationId path string true "ID formatted as string"
// @Router /v1/allocations/{allocationId} [delete]
// @Failure 400 {object} httperrors.HTTPError
// @Failure 404 {object} httperrors.HTTPError
// @Failure 500 {object} httperrors.HTTPError
// @Param id path string true "ID formatted as string"
// @Router /v1/allocations/{id} [delete]
func (co Controller) DeleteAllocation(c *gin.Context) {
id, err := uuid.Parse(c.Param("allocationId"))
id, err := uuid.Parse(c.Param("id"))
if err != nil {
httperrors.InvalidUUID(c)
return
Expand Down
Loading

0 comments on commit bc946c0

Please sign in to comment.