Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MG-1965 - Process Event Logs #2057

Merged
merged 22 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
0ace353
Add event logs service
rodneyosodo Jan 12, 2024
8c9f881
feat: add with_payload parameter
rodneyosodo Jan 15, 2024
c0d3b97
feat: add direction parameter
rodneyosodo Jan 15, 2024
662f20e
use slog for logging as mglogger was deprecated
rodneyosodo Feb 12, 2024
b856b98
fix after rebase
rodneyosodo Apr 9, 2024
ff31a64
rename service to activitylog
rodneyosodo Apr 16, 2024
91d48a4
refactor(activitylog): remove id from activity
rodneyosodo Apr 30, 2024
8c2ed62
refactor(activitiylog): change format to activity
rodneyosodo May 2, 2024
32179b5
fix: failing tests due to change in events structure
rodneyosodo May 6, 2024
6067bf0
feat(activity-log): add db indexes
rodneyosodo May 6, 2024
df81417
feat(activitylog): add schemathesis
rodneyosodo May 6, 2024
e50330c
refactor(activitylog): Refactor authorization
rodneyosodo May 27, 2024
b5e3c99
fix(activitylog): enforce `/{type}/{id}` and remove `/activities`
rodneyosodo Jun 12, 2024
e2dfb67
fix: rename repocall to svcall
rodneyosodo Jun 13, 2024
c4596cf
fix: abstract user with channel as a valid type
rodneyosodo Jun 13, 2024
3f73574
fix: start with entitytype then ID
rodneyosodo Jun 14, 2024
20095f2
fix: change authorization for users
rodneyosodo Jun 14, 2024
3f8fa8d
fix(bootstrap): use shared event read and readSlice funcs
rodneyosodo Jun 24, 2024
376455d
refactor(journal): Rename from activitlog to journal
rodneyosodo Jun 26, 2024
e9f64a5
fix(journal): Remove empty check for operation's field
rodneyosodo Jun 26, 2024
19b7fb5
docs(journal Add doc.go): Add go documentation for the journal servic…
rodneyosodo Jun 26, 2024
ec270cc
fix(journal): Remove id generation from db
rodneyosodo Jun 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/api-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ on:
- "consumers/notifiers/api/**"
- "http/api/**"
- "invitations/api/**"
- "journal/api/**"
- "provision/api/**"
- "readers/api/**"
- "things/api/**"
Expand Down Expand Up @@ -44,6 +45,7 @@ env:
TIMESCALE_READER_URL: http://localhost:9011
SMPP_NOTIFIER_URL: http://localhost:9014
SMTP_NOTIFIER_URL: http://localhost:9015
JOURNAL_URL: http://localhost:9021

jobs:
api-test:
Expand Down Expand Up @@ -78,6 +80,11 @@ jobs:
id: changes
with:
filters: |
journal:
- ".github/workflows/api-tests.yml"
- "api/openapi/journal.yml"
- "journal/api/**"

auth:
- ".github/workflows/api-tests.yml"
- "api/openapi/auth.yml"
Expand Down Expand Up @@ -183,6 +190,17 @@ jobs:
report: false
args: '--header "Authorization: Bearer ${{ env.USER_TOKEN }}" --contrib-openapi-formats-uuid --hypothesis-suppress-health-check=filter_too_much --stateful=links'

- name: Run Journal API tests
if: steps.changes.outputs.journal == 'true'
uses: schemathesis/action@v1
with:
schema: api/openapi/journal.yml
base-url: ${{ env.JOURNAL_URL }}
checks: all
report: false
args: '--header "Authorization: Bearer ${{ env.USER_TOKEN }}" --contrib-openapi-formats-uuid --hypothesis-suppress-health-check=filter_too_much --stateful=links'


- name: Run Bootstrap API tests
if: steps.changes.outputs.bootstrap == 'true'
uses: schemathesis/action@v1
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/check-generated-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ jobs:
- "twins/twins.go"
- "twins/states.go"
- "twins/service.go"
- "journal/journal.go"

- name: Set up protoc
if: steps.changes.outputs.proto == 'true'
Expand Down Expand Up @@ -157,6 +158,8 @@ jobs:
mv ./twins/mocks/states.go ./twins/mocks/states.go.tmp
mv ./twins/mocks/repository.go ./twins/mocks/repository.go.tmp
mv ./twins/mocks/cache.go ./twins/mocks/cache.go.tmp
mv ./journal/mocks/repository.go ./journal/mocks/repository.go.tmp
mv ./journal/mocks/service.go ./journal/mocks/service.go.tmp

make mocks

Expand Down Expand Up @@ -208,3 +211,5 @@ jobs:
check_mock_changes ./twins/mocks/states.go "Twins States ./twins/mocks/states.go"
check_mock_changes ./twins/mocks/repository.go "Twins Repository ./twins/mocks/repository.go"
check_mock_changes ./twins/mocks/cache.go "Twins Cache ./twins/mocks/cache.go"
check_mock_changes ./journal/mocks/repository.go "Journal Repository ./journal/mocks/repository.go"
check_mock_changes ./journal/mocks/service.go "Journal Service ./journal/mocks/service.go"
13 changes: 13 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ jobs:
- "pkg/uuid/**"
- "pkg/messaging/**"

journal:
- "journal/**"
- "cmd/journal/**"
- "auth.pb.go"
- "auth_grpc.pb.go"
- "auth/**"
- "pkg/events/**"

http:
- "http/**"
- "cmd/http/**"
Expand Down Expand Up @@ -268,6 +276,11 @@ jobs:
run: |
mkdir coverage

- name: Run Journal tests
if: steps.changes.outputs.journal == 'true' || steps.changes.outputs.workflow == 'true'
run: |
go test --race -v -count=1 -coverprofile=coverage/journal.out ./journal/...

- name: Run auth tests
if: steps.changes.outputs.auth == 'true' || steps.changes.outputs.workflow == 'true'
run: |
Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ MG_DOCKER_IMAGE_NAME_PREFIX ?= magistrala
BUILD_DIR = build
SERVICES = auth users things http coap ws lora influxdb-writer influxdb-reader mongodb-writer \
mongodb-reader cassandra-writer cassandra-reader postgres-writer postgres-reader timescale-writer timescale-reader cli \
bootstrap opcua twins mqtt provision certs smtp-notifier smpp-notifier invitations
TEST_API_SERVICES = auth bootstrap certs http invitations notifiers provision readers things twins users
bootstrap opcua twins mqtt provision certs smtp-notifier smpp-notifier invitations journal
TEST_API_SERVICES = journal auth bootstrap certs http invitations notifiers provision readers things twins users
TEST_API = $(addprefix test_api_,$(TEST_API_SERVICES))
DOCKERS = $(addprefix docker_,$(SERVICES))
DOCKERS_DEV = $(addprefix docker_dev_,$(SERVICES))
Expand Down Expand Up @@ -73,7 +73,7 @@ endef
ADDON_SERVICES = bootstrap cassandra-reader cassandra-writer certs \
influxdb-reader influxdb-writer lora-adapter mongodb-reader mongodb-writer \
opcua-adapter postgres-reader postgres-writer provision smpp-notifier smtp-notifier \
timescale-reader timescale-writer twins
timescale-reader timescale-writer twins journal

EXTERNAL_SERVICES = vault prometheus

Expand Down Expand Up @@ -177,6 +177,7 @@ test_api_twins: TEST_API_URL := http://localhost:9018
test_api_provision: TEST_API_URL := http://localhost:9016
test_api_readers: TEST_API_URL := http://localhost:9009 # This can be the URL of any reader service.
test_api_notifiers: TEST_API_URL := http://localhost:9014 # This can be the URL of any notifier service.
test_api_journal: TEST_API_URL := http://localhost:9021

$(TEST_API):
$(call test_api_service,$(@),$(TEST_API_URL))
Expand Down
Loading
Loading