Skip to content

Commit

Permalink
fix telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
kasteph committed Oct 24, 2024
1 parent 11a75e3 commit 8f26a8c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
SHELL=/usr/bin/env bash

ANTS_REPO?=github.com/probe-lab/ashby
ANTS_COMMIT?=839c2f242c67825ff7884515e929c7ba5b16e84e

TAG?=$(shell date +%F)-$(shell echo -n ${ANTS_REPO}-${ANTS_COMMIT} | sha256sum - | cut -c -8)-$(shell git describe --always --tag --dirty)
IMAGE_NAME?=probelab:ants-${TAG}
REPO?=019120760881.dkr.ecr.us-east-1.amazonaws.com
REPO_USER?=AWS
REPO_REGION?=us-east-1



tools:
go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/[email protected]
go install github.com/volatiletech/sqlboiler/[email protected]
Expand All @@ -11,3 +24,14 @@ migrate-up:

migrate-down:
migrate -database 'postgres://ants_watch:password@localhost:5432/ants_watch?sslmode=disable' -path db/migrations down

.PHONY: build
build:
echo ${TAG}
docker build --platform="linux/amd64" -t ${IMAGE_NAME} .

.PHONY: push
push:
aws ecr get-login-password --profile probelab --region ${REPO_REGION} | docker login --username ${REPO_USER} --password-stdin ${REPO}
docker tag ${IMAGE_NAME} ${REPO}/${IMAGE_NAME}
docker push ${REPO}/${IMAGE_NAME}
2 changes: 1 addition & 1 deletion db/client_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func partitionQuery(table string, lower time.Time, upper time.Time) string {
}

func (c *DBClient) applyMigrations(cfg *config.Database, Handler *sql.DB) {
tmpDir, err := os.MkdirTemp("", "nebula")
tmpDir, err := os.MkdirTemp("", "ants-watch")
if err != nil {
log.WithError(err).WithField("pattern", "ants-watch").Warnln("Could not create tmp directory for migrations")
return
Expand Down
15 changes: 13 additions & 2 deletions queen.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import (
"github.com/volatiletech/null/v8"

"github.com/dennis-tra/nebula-crawler/maxmind"
"github.com/dennis-tra/nebula-crawler/tele"
"github.com/dennis-tra/nebula-crawler/udger"
"github.com/probe-lab/ants-watch/db"
"github.com/probe-lab/ants-watch/db/models"
tele "github.com/probe-lab/ants-watch/metrics"
)

var logger = log.Logger("ants-queen")
Expand Down Expand Up @@ -105,7 +105,18 @@ func getDbClient(ctx context.Context) *db.DBClient {
}

mP, _ := tele.NewMeterProvider()
tP, _ := tele.NewTracerProvider(ctx, "", 0)

tracesPort := os.Getenv("TRACES_PORT")
tracesPortAsInt, err := strconv.Atoi(tracesPort)
if err != nil {
logger.Errorf("Port must be an integer: %w", err)
}

tP, _ := tele.NewTracerProvider(
ctx,
os.Getenv("TRACES_HOST"),
tracesPortAsInt,
)

dbc, err := db.InitDBClient(ctx, &config.Database{
DatabaseHost: os.Getenv("DB_HOST"),
Expand Down

0 comments on commit 8f26a8c

Please sign in to comment.