mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 11:34:26 +00:00
fix: emit only if data and marshal invalid metadata
* fix(emitter): only emit if there are log records * fix(actions): marshal invalid metadata value into string
This commit is contained in:
parent
966df56026
commit
ed4983d3fd
@ -22,6 +22,14 @@ func UserMetadataListFromQuery(c *actions.FieldConfig, metadata *query.UserMetad
|
|||||||
|
|
||||||
for i, md := range metadata.Metadata {
|
for i, md := range metadata.Metadata {
|
||||||
var value interface{}
|
var value interface{}
|
||||||
|
if !json.Valid(md.Value) {
|
||||||
|
var err error
|
||||||
|
md.Value, err = json.Marshal(string(md.Value))
|
||||||
|
if err != nil {
|
||||||
|
logging.WithError(err).Debug("unable to marshal unknow value")
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
err := json.Unmarshal(md.Value, &value)
|
err := json.Unmarshal(md.Value, &value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logging.WithError(err).Debug("unable to unmarshal into map")
|
logging.WithError(err).Debug("unable to unmarshal into map")
|
||||||
|
@ -49,6 +49,9 @@ func (l *databaseLogStorage) QuotaUnit() quota.Unit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (l *databaseLogStorage) Emit(ctx context.Context, bulk []logstore.LogRecord) error {
|
func (l *databaseLogStorage) Emit(ctx context.Context, bulk []logstore.LogRecord) error {
|
||||||
|
if len(bulk) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
builder := squirrel.Insert(accessLogsTable).
|
builder := squirrel.Insert(accessLogsTable).
|
||||||
Columns(
|
Columns(
|
||||||
accessTimestampCol,
|
accessTimestampCol,
|
||||||
|
@ -42,6 +42,9 @@ func (l *databaseLogStorage) QuotaUnit() quota.Unit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (l *databaseLogStorage) Emit(ctx context.Context, bulk []logstore.LogRecord) error {
|
func (l *databaseLogStorage) Emit(ctx context.Context, bulk []logstore.LogRecord) error {
|
||||||
|
if len(bulk) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
builder := squirrel.Insert(executionLogsTable).
|
builder := squirrel.Insert(executionLogsTable).
|
||||||
Columns(
|
Columns(
|
||||||
executionTimestampCol,
|
executionTimestampCol,
|
||||||
|
Loading…
Reference in New Issue
Block a user