document prometheus API

* enable in dev and test env
* fix api/repos doc
This commit is contained in:
André Roth
2025-02-15 23:39:06 +01:00
parent 809ab47042
commit 1346352455
4 changed files with 10 additions and 1 deletions
+1
View File
@@ -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 test -f $(BINPATH)/air || go install github.com/air-verse/air@v1.52.3
cp debian/aptly.conf ~/.aptly.conf cp debian/aptly.conf ~/.aptly.conf
sed -i /enable_swagger_endpoint/s/false/true/ ~/.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 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 dpkg: prepare swagger ## Build debian packages
+2 -1
View File
@@ -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 cant be part of the same local repository. // @Description API verifies that packages actually exist in aptly database and checks constraint that conflicting packages cant be part of the same local repository.
// @Tags Repos // @Tags Repos
// @Param name path string true "Repository name" // @Param name path string true "Repository name"
// @Consume json
// @Param request body reposPackagesAddDeleteParams true "Parameters" // @Param request body reposPackagesAddDeleteParams true "Parameters"
// @Param _async query bool false "Run in background and return task object" // @Param _async query bool false "Run in background and return task object"
// @Produce json // @Produce json
@@ -623,11 +624,11 @@ type reposCopyPackageParams struct {
// @Summary Copy Package // @Summary Copy Package
// @Description Copies a package from a source to destination repository // @Description Copies a package from a source to destination repository
// @Tags Repos // @Tags Repos
// @Produce json
// @Param name path string true "Destination repo" // @Param name path string true "Destination repo"
// @Param src path string true "Source repo" // @Param src path string true "Source repo"
// @Param file path string true "File/packages to copy" // @Param file path string true "File/packages to copy"
// @Param _async query bool false "Run in background and return task object" // @Param _async query bool false "Run in background and return task object"
// @Produce json
// @Success 200 {object} task.ProcessReturnValue "msg" // @Success 200 {object} task.ProcessReturnValue "msg"
// @Failure 400 {object} Error "Bad Request" // @Failure 400 {object} Error "Bad Request"
// @Failure 404 {object} Error "Not Found" // @Failure 404 {object} Error "Not Found"
+6
View File
@@ -18,6 +18,12 @@ import (
var context *ctx.AptlyContext 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 { func apiMetricsGet() gin.HandlerFunc {
return func(c *gin.Context) { return func(c *gin.Context) {
countPackagesByRepos() countPackagesByRepos()
+1
View File
@@ -34,6 +34,7 @@ class APITest(BaseTest):
"linkMethod": "symlink" "linkMethod": "symlink"
} }
}, },
"enableMetricsEndpoint": True,
"enableSwaggerEndpoint": True "enableSwaggerEndpoint": True
} }