zero/telemetry: calculate DAU and MAU (#4810)

This commit is contained in:
Denis Mishin 2023-12-11 13:37:01 -05:00 committed by GitHub
parent e0ac870442
commit c4dd965f2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 485 additions and 0 deletions

View file

@ -8,6 +8,8 @@ import (
"fmt"
"io"
"google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
structpb "google.golang.org/protobuf/types/known/structpb"
@ -33,6 +35,11 @@ func NewRecord(object recordObject) *Record {
}
}
// IsNotFound returns true if the error is a not found error.
func IsNotFound(err error) bool {
return status.Code(err) == codes.NotFound
}
// Get gets a record from the databroker and unmarshals it into the object.
func Get(ctx context.Context, client DataBrokerServiceClient, object recordObject) error {
res, err := client.Get(ctx, &GetRequest{