diff --git a/Makefile b/Makefile index d39dccd8..770d9d9d 100644 --- a/Makefile +++ b/Makefile @@ -131,6 +131,7 @@ serve: prepare swagger-install ## Run development server (auto recompiling) test -f $(BINPATH)/air || go install github.com/air-verse/air@v1.52.3 cp debian/aptly.conf ~/.aptly.conf sed -i /enable_swagger_endpoint/s/false/true/ ~/.aptly.conf + sed -i /enable_metrics_endpoint/s/false/true/ ~/.aptly.conf PATH=$(BINPATH):$$PATH air -build.pre_cmd 'swag init -q --propertyStrategy pascalcase --markdownFiles docs --generalInfo docs/swagger.conf' -build.exclude_dir docs,system,debian,pgp/keyrings,pgp/test-bins,completion.d,man,deb/testdata,console,_man,systemd,obj-x86_64-linux-gnu -- api serve -listen 0.0.0.0:3142 dpkg: prepare swagger ## Build debian packages diff --git a/api/repos.go b/api/repos.go index 77dd5172..588beaca 100644 --- a/api/repos.go +++ b/api/repos.go @@ -420,6 +420,7 @@ func apiReposPackagesAddDelete(c *gin.Context, taskNamePrefix string, cb func(li // @Description API verifies that packages actually exist in aptly database and checks constraint that conflicting packages can’t be part of the same local repository. // @Tags Repos // @Param name path string true "Repository name" +// @Consume json // @Param request body reposPackagesAddDeleteParams true "Parameters" // @Param _async query bool false "Run in background and return task object" // @Produce json @@ -623,11 +624,11 @@ type reposCopyPackageParams struct { // @Summary Copy Package // @Description Copies a package from a source to destination repository // @Tags Repos -// @Produce json // @Param name path string true "Destination repo" // @Param src path string true "Source repo" // @Param file path string true "File/packages to copy" // @Param _async query bool false "Run in background and return task object" +// @Produce json // @Success 200 {object} task.ProcessReturnValue "msg" // @Failure 400 {object} Error "Bad Request" // @Failure 404 {object} Error "Not Found" diff --git a/api/router.go b/api/router.go index 5f7c4940..62dd5c2f 100644 --- a/api/router.go +++ b/api/router.go @@ -18,6 +18,12 @@ import ( var context *ctx.AptlyContext +// @Summary Get Metrics +// @Description **Get Prometheus Metrics** +// @Tags Status +// @Produce text/plain +// @Success 200 {string} string Metrics +// @Router /api/metrics [get] func apiMetricsGet() gin.HandlerFunc { return func(c *gin.Context) { countPackagesByRepos() diff --git a/system/api_lib.py b/system/api_lib.py index 20036b86..26245c81 100644 --- a/system/api_lib.py +++ b/system/api_lib.py @@ -34,6 +34,7 @@ class APITest(BaseTest): "linkMethod": "symlink" } }, + "enableMetricsEndpoint": True, "enableSwaggerEndpoint": True }