Records Retrieval Events published by
lassie
This repo provides a Golang implementation of lassie
event recorder.
It exposes a REST HTTP API that accepts lassie
retrieval events and stores them in the configured postgres database.
To install the event recorder run:
go install github.com/filecoin-project/lassie-event-recorder/cmd/recorder@latest
$ recorder --help
Usage of recorder:
-dbDSN string
The database Data Source Name. Alternatively, it may be specified via LASSIE_EVENT_RECORDER_DB_DSN environment variable. If both are present, the environment variable takes precedence.
-httpListenAddr string
The HTTP server listen address in address:port format. (default "0.0.0.0:8080")
-logLevel string
The logging level. Only applied if GOLOG_LOG_LEVEL environment variable is unset. (default "info")
To start the recorder service running locally, execute:
docker-compose up
The recorder service is then accessible on localhost:8080
.
Here is an example curl
that posts an event to the server:
curl -v -X POST --location "http://localhost:8080/v1/retrieval-events" \
-H "Content-Type: application/json" \
-d "{
\"events\": [
{
\"retrievalId\": \"d05a522e-9608-401a-a33f-1eb4ac4111a0\",
\"instanceId\": \"test-instance-id\",
\"cid\": \"bafybeic4jpi2detp5n3q6rjo7ckulebtr7dsvt2tbrtcqlnnzqmi3bzz2y\",
\"storageProviderId\": \"12D3KooWHwRmkj4Jxfo2YnKJC4YBzTNEGDW6Et4E68r7RYVXk46h\",
\"phase\": \"query\",
\"phaseStartTime\": \"2023-03-02T00:15:50.479910907Z\",
\"eventName\": \"started\",
\"eventTime\": \"2023-03-02T00:15:52.361371026Z\"
}
]
}"
To stop the containers press Ctrl + C
.
The postgres container can be accessed via port localhost:5432
for local DBMS setups or psql connections.
Lassie can talk to this local event recorder instance by using the --endpoint-url
and --endpoint-instance-id
options on either the daemon