diff --git a/internal/observability/event/id.go b/internal/observability/event/id.go index d0be045a1..69272738c 100644 --- a/internal/observability/event/id.go +++ b/internal/observability/event/id.go @@ -3,14 +3,23 @@ package event import ( "fmt" - "github.com/hashicorp/boundary/internal/db" + "github.com/hashicorp/vault/sdk/helper/base62" ) +// This modified newId has been done to stop a circular +// dependency with the errors package that is caused by importing +// boundary/internal/db func newId(prefix string) (string, error) { const op = "event.newId" - id, err := db.NewPublicId(prefix) - if err != nil { - return "", fmt.Errorf("%s: %w", op, err) + if prefix == "" { + return "", fmt.Errorf("%s: missing prefix: %w", op, ErrInvalidParameter) } - return id, nil + var publicId string + var err error + + publicId, err = base62.Random(10) + if err != nil { + return "", fmt.Errorf("%s: unable to generate id %v: %w", op, err, ErrIo) + } + return fmt.Sprintf("%s_%s", prefix, publicId), nil }