mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-09 23:27:43 +02:00
zero/telemetry: calculate DAU and MAU (#4810)
This commit is contained in:
parent
e0ac870442
commit
c4dd965f2d
9 changed files with 485 additions and 0 deletions
|
@ -5,11 +5,13 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
"github.com/pomerium/pomerium/internal/log"
|
||||
"github.com/pomerium/pomerium/internal/zero/analytics"
|
||||
"github.com/pomerium/pomerium/internal/zero/bootstrap"
|
||||
"github.com/pomerium/pomerium/internal/zero/reconciler"
|
||||
"github.com/pomerium/pomerium/pkg/cmd/pomerium"
|
||||
|
@ -43,6 +45,7 @@ func Run(ctx context.Context, opts ...Option) error {
|
|||
eg.Go(func() error { return run(ctx, "pomerium-core", c.runPomeriumCore, src.WaitReady) })
|
||||
eg.Go(func() error { return run(ctx, "zero-reconciler", c.runReconciler, src.WaitReady) })
|
||||
eg.Go(func() error { return run(ctx, "connect-log", c.RunConnectLog, nil) })
|
||||
eg.Go(func() error { return run(ctx, "zero-analytics", c.runAnalytics, src.WaitReady) })
|
||||
return eg.Wait()
|
||||
}
|
||||
|
||||
|
@ -117,3 +120,13 @@ func (c *controller) runReconciler(ctx context.Context) error {
|
|||
reconciler.WithDataBrokerClient(c.GetDataBrokerServiceClient()),
|
||||
)
|
||||
}
|
||||
|
||||
func (c *controller) runAnalytics(ctx context.Context) error {
|
||||
err := analytics.Collect(ctx, c.GetDataBrokerServiceClient(), time.Second*30)
|
||||
if err != nil && ctx.Err() == nil {
|
||||
log.Ctx(ctx).Error().Err(err).Msg("error collecting analytics, disabling")
|
||||
return nil
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue