Metrics and logs - MongoDB Submission (#43)
Adds MongoDB-backed submission for survey statistics/metrics and introduces MongoDB ObjectID-based participant/task identifiers to support upserts and linking metrics to a participant. It introduces breaking changes to the exsisting json stat and metric files. Delete the old ones Changes: Add internal/storage/MongoStorage and wire pm survey submit / pm start to submit local .pm/*.json files to MongoDB. Extend stats/metrics models to include MongoDB _id / participant_id fields and add participant ID propagation into task metrics. Update app initialization to generate ObjectIDs for new participants and expose GetParticipantID() via StatsService.
This commit is contained in:
@@ -3,6 +3,8 @@ package models
|
||||
import (
|
||||
"context"
|
||||
"log/slog"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
|
||||
type App struct {
|
||||
@@ -57,5 +59,6 @@ type StatsService interface {
|
||||
Load(ctx context.Context) error
|
||||
Save(ctx context.Context) error
|
||||
GetStatistics() (Statistics, error)
|
||||
GetParticipantID() primitive.ObjectID
|
||||
RecordTaskRun(ctx context.Context, run TaskRunMetrics) error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user