Skip to content

Commit

Permalink
Add HLL support in 'calc_metric' tool
Browse files Browse the repository at this point in the history
Signed-off-by: Łukasz Gryglicki <[email protected]>
  • Loading branch information
lukaszgryglicki committed Sep 28, 2024
1 parent c685d55 commit 206a34d
Show file tree
Hide file tree
Showing 7 changed files with 534 additions and 186 deletions.
4 changes: 2 additions & 2 deletions annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ func ProcessAnnotations(ctx *Ctx, annotations *Annotations, dates []*time.Time)
if TableExists(ic, ctx, table) && TableColumnExists(ic, ctx, table, column) {
ExecSQLWithErr(ic, ctx, fmt.Sprintf("delete from \"%s\" where \"%s\" like '%%_n'", table, column))
}
WriteTSPoints(ctx, ic, &pts, "", nil)
WriteTSPoints(ctx, ic, &pts, "", []uint8{}, nil)
// Annotations from all projects into 'allprj' database
if !ctx.SkipSharedDB && ctx.SharedDB != "" {
var anots TSPoints
Expand All @@ -568,7 +568,7 @@ func ProcessAnnotations(ctx *Ctx, annotations *Annotations, dates []*time.Time)
}
ics := PgConnDB(ctx, ctx.SharedDB)
defer func() { FatalOnError(ics.Close()) }()
WriteTSPoints(ctx, ics, &anots, "", nil)
WriteTSPoints(ctx, ics, &anots, "", []uint8{}, nil)
}
} else if ctx.Debug > 0 {
Printf("Skipping annotations series write\n")
Expand Down
16 changes: 16 additions & 0 deletions calc_metric.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# on k8s node-0: 'k exec -n devstats-prod devstats-postgres-0 -- pg_dump tuf > tuf.dump'
# sftp root@node-0: 'mget tuf.dump'
# here: 'PGPASSWORD=[redacted] createdb -Ugha_admin -hlocalhost -p5432 tuf'
# here: 'PGPASSWORD=[redacted] psql -Ugha_admin -hlocalhost -p5432 tuf < tuf.dump'
if [ -z "${PG_PASS}" ]
then
echo "$0: you must specify PG_PASS=..."
exit 1
fi
make fmt && make calc_metric || exit 2
cd ../devstats || exit 3
# GHA2DB_ENABLE_METRICS_DROP=1 PG_DB=tuf GHA2DB_PROJECT=tuf GHA2DB_QOUT=1 GHA2DB_DEBUG=2 GHA2DB_SQLDEBUG=1 GHA2DB_LOCAL=1 GHA2DB_ST=1 GHA2DB_NCPUS=1 ../devstatscode/calc_metric events_hll ./events_hll.sql '2024-01-01 0' '2024-10-01 0' w 'skip_past,hll'
# GHA2DB_ENABLE_METRICS_DROP=1 PG_DB=tuf GHA2DB_PROJECT=tuf GHA2DB_QOUT=1 GHA2DB_DEBUG=2 GHA2DB_SQLDEBUG=1 GHA2DB_LOCAL=1 ../devstatscode/calc_metric multi_row_multi_column ./metrics/shared/project_countries.sql '2024-01-01 0' '2024-01-01 0' q 'multivalue,hll,merge_series:prjcntr,drop:sprjcntr' > ../devstatscode/out @>&1
# GHA2DB_ENABLE_METRICS_DROP=1 PG_DB=tuf GHA2DB_PROJECT=tuf GHA2DB_QOUT=1 GHA2DB_DEBUG=2 GHA2DB_SQLDEBUG=1 GHA2DB_LOCAL=1 GHA2DB_ST=1 GHA2DB_NCPUS=1 ../devstatscode/calc_metric multi_row_multi_column ./metrics/shared/project_countries.sql '2024-01-01 0' '2024-10-01 0' q 'multivalue,hll,merge_series:prjcntr,drop:sprjcntr'
GHA2DB_ENABLE_METRICS_DROP=1 PG_DB=tuf GHA2DB_PROJECT=tuf GHA2DB_LOCAL=1 ../devstatscode/calc_metric multi_row_multi_column ./metrics/shared/project_countries.sql '2024-01-01 0' '2024-10-01 0' w 'multivalue,hll,merge_series:prjcntr,drop:sprjcntr'
Loading

0 comments on commit 206a34d

Please sign in to comment.