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

feat(subscriber): add log_subscriber to write real-time logs to redis #735

Merged
merged 41 commits into from
Feb 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
2ae0d64
feat(log-subscriber): create subscriber
soma00333 Dec 28, 2024
493c96e
fix(log_subscriber): fix file name
soma00333 Jan 11, 2025
8fabc31
Merge branch 'main' into feat/log-subscriber/init
soma00333 Jan 11, 2025
130d6b0
feat(log_subscriber): add tests
soma00333 Jan 11, 2025
5235fb9
Merge branch 'feat/log-subscriber/init' of github.com:reearth/reearth…
soma00333 Jan 11, 2025
b67f6ee
feat(log_subscriber): add workflow
soma00333 Jan 11, 2025
916ec80
fix(log_subscriber): apply lint
soma00333 Jan 11, 2025
7e28570
fix(log_subscriber): fix lint
soma00333 Jan 11, 2025
9aaa478
chore(log_subscriber): add .env.example
soma00333 Jan 11, 2025
0205b70
chore(log_subscriber): update tool version in workflow
soma00333 Jan 17, 2025
dfc8928
fix(log_subscriber): fix test
soma00333 Jan 17, 2025
b84d0b0
chore(log_subscriber): add check to redis
soma00333 Jan 17, 2025
6fa0d93
fix(log_subscriber): fix NewRealMessage()
soma00333 Jan 17, 2025
0117c51
Merge branch 'main' into feat/log-subscriber/init
soma00333 Jan 17, 2025
f00a553
Rename resit_test.go to redis_test.go
soma00333 Jan 17, 2025
0ea2591
Merge branch 'feat/log-subscriber/init' of github.com:reearth/reearth…
soma00333 Jan 17, 2025
336c5c6
Update serialization to use JSON.Marshal for events
soma00333 Jan 17, 2025
7965a4b
Refactor serialization logic for logging events
soma00333 Jan 17, 2025
1fcbd03
Refactor GCS storage implementation for better abstraction
soma00333 Jan 18, 2025
3db60d0
Update saving log events to Redis with JSON serialization
soma00333 Jan 18, 2025
fa9028f
Merge branch 'main' into feat/log-subscriber/init
soma00333 Jan 25, 2025
97fd208
Refactor test for String.Clone method
soma00333 Jan 25, 2025
ecd3b3e
Merge branch 'main' of github.com:reearth/reearth-flow into feat/log-…
soma00333 Jan 25, 2025
10af632
Merge branch 'feat/log-subscriber/init' of github.com:reearth/reearth…
soma00333 Jan 25, 2025
097318e
Merge branch 'main' of github.com:reearth/reearth-flow into feat/log-…
soma00333 Feb 1, 2025
5224dd6
delete gcs integration
soma00333 Feb 1, 2025
69e4b7f
Refactor test for String Clone method
soma00333 Feb 1, 2025
e7756f0
Fix golangci-lint command in Makefile
soma00333 Feb 1, 2025
15cc724
Update expiration time to 12 hours for saving log to Redis
soma00333 Feb 1, 2025
d7040f0
Update paths to server/log_subscriber
soma00333 Feb 1, 2025
fa92b16
Remove unnecessary test parallelization in String_Clone test
soma00333 Feb 1, 2025
c95e6a1
Update Redis set expiration time to 12 hours in tests
soma00333 Feb 1, 2025
377bd6f
feat(log-subscriber): rename
soma00333 Feb 8, 2025
f2f4106
Merge branch 'main' into feat/log-subscriber/init
soma00333 Feb 8, 2025
dae1d41
Update log_subscriber to subscriber in CI workflow
soma00333 Feb 8, 2025
4642412
Update path to server subscriber in go.work file
soma00333 Feb 8, 2025
3885f50
Rename log-subscriber to subscriber for consistency
soma00333 Feb 8, 2025
a0e3b1e
Rename Redis files to log for consistency
soma00333 Feb 8, 2025
4ff81e7
resolve conflict
soma00333 Feb 13, 2025
c19af53
resolve conflixt
soma00333 Feb 14, 2025
d424b9e
Bump versions to 0.0.6 and 0.0.3 respectively
soma00333 Feb 14, 2025
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: 17 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
outputs:
ui: ${{ steps.ui.outputs.any_changed }}
api: ${{ steps.api.outputs.any_changed }}
subscriber: ${{ steps.subscriber.outputs.any_changed }}
engine: ${{ steps.engine.outputs.any_changed }}
websocket: ${{ steps.websocket.outputs.any_changed }}
steps:
Expand All @@ -29,6 +30,16 @@ jobs:
.github/workflows/deploy_api_nightly.yml
CHANGELOG.md

- name: changed files for subscriber
id: subscriber
uses: tj-actions/changed-files@v45
with:
files: |
server/subscriber/**
.github/workflows/ci.yml
.github/workflows/ci_subscriber.yml
CHANGELOG.md

- name: changed files for ui
id: ui
uses: tj-actions/changed-files@v45
Expand Down Expand Up @@ -64,6 +75,10 @@ jobs:
needs: prepare
if: needs.prepare.outputs.api == 'true'
uses: ./.github/workflows/ci_api.yml
ci-subscriber:
needs: prepare
if: needs.prepare.outputs.subscriber == 'true'
uses: ./.github/workflows/ci_subscriber.yml
ci-ui:
needs: prepare
if: needs.prepare.outputs.ui == 'true'
Expand All @@ -80,6 +95,7 @@ jobs:
runs-on: ubuntu-latest
needs:
- ci-api
- ci-subscriber
- ci-ui
- ci-websocket
- ci-engine
Expand Down Expand Up @@ -181,4 +197,4 @@ jobs:
new_tag_short: ${{ needs.ci-collect-info.outputs.new_tag_short }}
name: ${{ needs.ci-collect-info.outputs.name }}
sha: ${{ github.sha }}
secrets: inherit
secrets: inherit
43 changes: 43 additions & 0 deletions .github/workflows/ci_subscriber.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: ci-subscriber
on:
workflow_call:
env:
GO_VERSION: "1.22"

jobs:
ci-subscriber-lint:
runs-on: ubuntu-latest
if: github.event_name != 'push' || !startsWith(github.event.head_commit.message, 'v')
steps:
- name: checkout
uses: actions/checkout@v4
- name: set up
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.59.1
args: --timeout=10m
working-directory: server/subscriber

ci-subscriber-test:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: set up
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: server/subscriber/go.sum
- name: test
run: go test ./... -v -race -coverprofile=coverage.txt -covermode=atomic -timeout 10m
working-directory: server/subscriber
- name: Send coverage report
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: subscriber
46 changes: 23 additions & 23 deletions engine/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ homepage = "https://github.com/reearth/reearth-flow"
license = "MIT OR Apache-2.0"
repository = "https://github.com/reearth/reearth-flow"
rust-version = "1.84" # Remember to update clippy.toml as well
version = "0.0.5"
version = "0.0.6"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


[profile.dev]
opt-level = 0
Expand Down
11 changes: 8 additions & 3 deletions engine/compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
networks:
reearth-flow-net:
external: true
services:
gcs:
image: fsouza/fake-gcs-server
ports:
- 4443:4443
volumes:
- ./tmp/gcs/data:/data # :/data/{bucket-name}
- ./tmp/gcs/data:/data/reearth-flow-oss-bucket # :/data/{bucket-name}
command: --scheme http # Allow http
networks:
- reearth-flow-net
pubsub:
build:
context: .
Expand All @@ -14,7 +19,7 @@ services:
environment:
- PROJECT_ID=local-project
- TOPIC_IDS=flow-edge-pass-through-topic,flow-log-stream-topic,flow-job-complete-topic # Corresponding pull-type subscriptions({TOPIC}-sub) will be created automatically
extra_hosts: # For other docker-compose services
- ${DOCKER_HOST_INTERNAL:-host.docker.internal}:${DOCKER_HOST_GATEWAY:-host-gateway}
ports:
- 8085:8085
networks:
- reearth-flow-net
2 changes: 1 addition & 1 deletion engine/plateau-gis-quality-checker/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
description = "Re:Earth Flow GIS Quality Checker"
name = "plateau-gis-quality-checker"
version = "0.0.2"
version = "0.0.3"

authors.workspace = true
edition.workspace = true
Expand Down
3 changes: 3 additions & 0 deletions engine/worker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ cargo run --package reearth-flow-worker -- --workflow gs://reearth-flow-assets/w

### Local Development
``` sh
# Create a network
docker network create reearth-flow-net

# GCS Emulator
export STORAGE_EMULATOR_HOST=http://localhost:4443
# Cloud Pub/Sub Emulator
Expand Down
5 changes: 4 additions & 1 deletion go.work
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
go 1.22.3

use ./server/api
use (
./server/api
./server/subscriber
)
Loading