Skip to content

Commit

Permalink
Process Prometheus results into Odoo16 metered billing records
Browse files Browse the repository at this point in the history
  • Loading branch information
HappyTetrahedron committed Nov 10, 2023
1 parent 9f0cdea commit 32b2c97
Show file tree
Hide file tree
Showing 85 changed files with 244 additions and 6,949 deletions.
19 changes: 2 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,8 @@ ensure-prometheus: .cache/prometheus ## Ensures that Prometheus is installed in

.PHONY: test
test: export ACR_DB_URL = postgres://user:password@localhost:55432/db?sslmode=disable
test: COMPOSE_FILE = docker-compose-test.yml
test: compose_args = -p reporting-test
test: ensure-prometheus docker-compose-down ping-postgres ## Run full test suite
go run github.com/appuio/appuio-cloud-reporting migrate
go run github.com/appuio/appuio-cloud-reporting migrate --seed
test:
go test ./... -tags integration -coverprofile cover.out -covermode atomic
@$(COMPOSE_CMD) $(compose_args) down

.PHONY: gen-golden
gen-golden: export ACR_DB_URL = postgres://user:password@localhost:55432/db?sslmode=disable
gen-golden: COMPOSE_FILE = docker-compose-test.yml
gen-golden: compose_args = -p reporting-test
gen-golden: ensure-prometheus docker-compose-down ping-postgres ## Update golden files
go run github.com/appuio/appuio-cloud-reporting migrate
go run github.com/appuio/appuio-cloud-reporting migrate --seed
go test ./pkg/invoice -update
@$(COMPOSE_CMD) $(compose_args) down

.PHONY: fmt
fmt: ## Run 'go fmt' and `jsonnetfmt` against code
Expand All @@ -74,7 +59,7 @@ generate: ## Generate additional code and artifacts
@go generate ./...

.PHONY: clean
clean: docker-compose-down ## Cleans local build artifacts
clean:
rm -rf docs/node_modules $(docs_out_dir) dist .cache

.cache/prometheus:
Expand Down
15 changes: 0 additions & 15 deletions Makefile.compose.mk

This file was deleted.

87 changes: 0 additions & 87 deletions check_command.go

This file was deleted.

18 changes: 5 additions & 13 deletions common_flags.go
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
package main

import (
"github.com/appuio/appuio-cloud-reporting/pkg/db"
"github.com/urfave/cli/v2"
)

const defaultTestForRequiredFlags = "<required>"

func newDbURLFlag(destination *string) *cli.StringFlag {
return &cli.StringFlag{Name: "db-url", Usage: "Database connection URL in the form of postgres://user@host:port/db-name?option=value",
EnvVars: envVars("DB_URL"), Destination: destination, Required: true, DefaultText: defaultTestForRequiredFlags}
}
const defaultTextForRequiredFlags = "<required>"
const defaultTextForOptionalFlags = "<optional>"

func newPromURLFlag(destination *string) *cli.StringFlag {
return &cli.StringFlag{Name: "prom-url", Usage: "Prometheus connection URL in the form of http://host:port",
EnvVars: envVars("PROM_URL"), Destination: destination, Value: "http://localhost:9090"}
}

func queryNames(queries []db.Query) []string {
names := make([]string, len(queries))
for i := range queries {
names[i] = queries[i].Name
}
return names
func newOdooURLFlag(destination *string) *cli.StringFlag {
return &cli.StringFlag{Name: "odoo-url", Usage: "URL of the Odoo Metered Billing API",
EnvVars: envVars("ODOO_URL"), Destination: destination, Value: "http://localhost:8080"}
}
11 changes: 0 additions & 11 deletions docker-compose-test.yml

This file was deleted.

15 changes: 0 additions & 15 deletions docker-compose.yml

This file was deleted.

78 changes: 0 additions & 78 deletions invoice_command.go

This file was deleted.

4 changes: 0 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,7 @@ func newApp() (context.Context, context.CancelFunc, *cli.App) {
},
},
Commands: []*cli.Command{
newMigrateCommand(),
newReportCommand(),
newCheckMissingCommand(),
newInvoiceCommand(),
newTmapCommand(),
},
ExitErrHandler: func(context *cli.Context, err error) {
if err == nil {
Expand Down
80 changes: 0 additions & 80 deletions migrate_command.go

This file was deleted.

Loading

0 comments on commit 32b2c97

Please sign in to comment.