Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
d31739d
feat: move helper logger from winston to pino[3834]
Jul 2, 2024
f2fca7e
[skip ci] Add swagger.yaml
envision-ci-agent Jul 2, 2024
2bad74e
feat: provide logger for services across di[3834]
Jul 2, 2024
55f20fc
Merge branch 'feature/3834-migrate-logger-from-winston-to-pino' of gi…
Jul 3, 2024
cc1e1ae
Merge branch 'develop' into feature/3834-migrate-logger-from-winston-…
Jul 3, 2024
2f339fd
fix: remove winston dependencies[3834]
Jul 3, 2024
bbc22b4
feat: add tranports and factory for pino logger (#3877)
ihar-tsykala Jul 9, 2024
b4cdc1c
feat: dividing code base on modules and refactore[3834]
Jul 9, 2024
d271cc6
feat: seq transport for pino logger[3834]
Jul 10, 2024
2e7abf3
Merge branch 'develop' into feature/3834-migrate-logger-from-winston-…
Jul 12, 2024
4f95a64
feat: move ai srvice to pino logger[3834]
Jul 13, 2024
aaaf10c
feat: move auth service to pino[3834]
Jul 14, 2024
4275ee1
feat: move gardian service to pino logger[3834]
Jul 14, 2024
9001d69
fix: api gate way internal error func and web sockets[3834]
Jul 14, 2024
5edb972
feat: move notification service to pino[3834]
Jul 15, 2024
00e9990
feat: move policy service to pino logger[3834]
Jul 15, 2024
0aaba57
feat: move queue service to pino logger[3834]
Jul 15, 2024
65d5004
feat: move worker service to pino logger[3834]
Jul 15, 2024
d737ef0
feat: mongo logger init and pino logger init[3834]
Jul 16, 2024
8e7bc79
feat: pino logger in common helpers for guardian service[3834]
Jul 16, 2024
d2ee8c3
feat: pino logger instead new old logger for policy service[3834]
Jul 16, 2024
b0909fb
feat: move to pino analitics-sevice[3834]
Jul 16, 2024
95de1df
refactore code[3834]
Jul 16, 2024
0fde36c
refactore code[3834]
Jul 16, 2024
eb23dc9
fix: env for common config for pino logger[3834]
Jul 16, 2024
2ae5afa
fix: linter issues[3834]
Jul 16, 2024
00b3ac6
Merge branch 'develop' into feature/3834-migrate-logger-from-winston-…
Jul 16, 2024
481ee31
docs: link to the seq logging documentation[3834]
Jul 17, 2024
672d8f8
feat: conditionat for mongo transport and refactore code[3834]
Jul 19, 2024
17ecb74
feat: subscribtions on frontent for states logger service[3834] (#3922)
ihar-tsykala Jul 24, 2024
895ead8
Merge branch 'develop' into feature/3834-migrate-logger-from-winston-…
Jul 24, 2024
abffca8
fix: configs api-gateway[3834]
Jul 24, 2024
8f7f295
feat: api key for seq and refactor code
Jul 24, 2024
46d2f36
Merge branch 'develop' into feature/3834-migrate-logger-from-winston-…
Jul 30, 2024
e5b5852
Merge branch 'develop' into feature/3834-migrate-logger-from-winston-…
Jul 30, 2024
a4ce065
refactore code
Jul 30, 2024
2c02515
Merge branch 'develop' into feature/3834-migrate-logger-from-winston-…
Jul 30, 2024
df683d4
refactore code
Jul 30, 2024
5014473
Merge branch 'develop' into feature/3834-migrate-logger-from-winston-…
Jul 30, 2024
bfbcdc6
fix: crush app in logger mongo initialization[3834]
Jul 30, 2024
306c3cb
fix: add logger setting to docker configs[3834]
Jul 30, 2024
7404db3
fix: dublicates records in db[3834]
Jul 31, 2024
38e69d9
Merge branch 'develop' into feature/3834-migrate-logger-from-winston-…
ihar-tsykala Jul 31, 2024
69241a3
Merge branch 'develop' into feature/3834-migrate-logger-from-winston-…
Jul 31, 2024
4d142b6
fix: remove log from the guardian_db
Jul 31, 2024
6cab671
Merge branch 'develop' into feature/3834-migrate-logger-from-winston-…
ihar-tsykala Jul 31, 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
3 changes: 2 additions & 1 deletion common/src/entity/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ export * from './dry-run-files.js';
export * from './policy-cache-data.js';
export * from './policy-cache.js';
export * from './assign-entity.js';
export * from './policy-test.js';
export * from './policy-test.js';
export * from './log.js';
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Entity, Enum, Property } from '@mikro-orm/core';
import { ILog, LogType } from '@guardian/interfaces';
import { BaseEntity } from '@guardian/common';
import { BaseEntity } from '../models/base-entity.js';

/**
* Log message
Expand Down
6 changes: 3 additions & 3 deletions common/src/helpers/mongo-logging-initialization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { MongoDriver } from '@mikro-orm/mongodb';
import process from 'process';

//entities
import { entities } from '../index.js';
import { Log } from '../entity/log.js';

//helpers
import { DataBaseNamingStrategy } from '../helpers/index.js';
Expand All @@ -16,7 +16,7 @@ export const DEFAULT = {
};

export async function mongoForLoggingInitialization(options: Record<string, any> = {}) {
const isMongoTransport = process.env.TRANSPORTS.includes('MONGO')
const isMongoTransport = process.env.TRANSPORTS?.includes('MONGO')

if(process.env.DB_LOGGER_NAME && isMongoTransport) {
return await MikroORM.init<MongoDriver>({
Expand All @@ -31,7 +31,7 @@ export async function mongoForLoggingInitialization(options: Record<string, any>
maxIdleTimeMS: parseInt(process.env.MAX_IDLE_TIME_MS ?? DEFAULT.MAX_IDLE_TIME_MS, 10),
},
ensureIndexes: true,
entities,
entities: [Log],
...options
});
}
Expand Down
11 changes: 11 additions & 0 deletions configs/.env.develop.guardian.system
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,17 @@ HOST_CACHE='cache'
PORT_CACHE='6379'
ENABLE_CACHE='true'

#PINO_LOGGER
TRANSPORTS="CONSOLE, MONGO"
DB_LOGGER_NAME="logger_db"
DB_LOGGER_HOST="mongo"
DB_LOGGER_COLLECTION="log"
LOG_FILE_PATH="./logs/app.log"
LOG_LEVEL="info"
SEQ_SERVER_URL="http://seq:5341"
#SEQ_UI_URL="http://localhost:5341"
#SEQ_API_KEY=""

# MONGO_INIT
MIN_POOL_SIZE="1"
MAX_POOL_SIZE="5"
Expand Down
17 changes: 14 additions & 3 deletions configs/.env.template.guardian.system
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,18 @@ HOST_CACHE='cache'
PORT_CACHE='6379'
ENABLE_CACHE='true'

#PINO_LOGGER
TRANSPORTS="CONSOLE, MONGO"
DB_LOGGER_NAME=""
DB_LOGGER_HOST=""
DB_LOGGER_COLLECTION=""
LOG_FILE_PATH=""
LOG_LEVEL=""
SEQ_SERVER_URL=""
#SEQ_UI_URL=""
#SEQ_API_KEY=""

# MONGO_INIT
MIN_POOL_SIZE="1"
MAX_POOL_SIZE="5"
MAX_IDLE_TIME_MS="30000"
MIN_POOL_SIZE=""
MAX_POOL_SIZE=""
MAX_IDLE_TIME_MS=""
11 changes: 11 additions & 0 deletions configs/.env_SSV
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ HOST_CACHE='cache'
PORT_CACHE='6379'
ENABLE_CACHE='true'

#PINO_LOGGER
TRANSPORTS="CONSOLE, MONGO"
DB_LOGGER_NAME="logger_db"
DB_LOGGER_HOST="mongo"
DB_LOGGER_COLLECTION="log"
LOG_FILE_PATH="./logs/app.log"
LOG_LEVEL="info"
SEQ_SERVER_URL="http://seq:5341"
#SEQ_UI_URL="http://localhost:5341"
#SEQ_API_KEY=""

# MONGO_INIT
MIN_POOL_SIZE="1"
MAX_POOL_SIZE="5"
Expand Down
93 changes: 55 additions & 38 deletions guardian-service/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,13 @@ import { tokenAPI } from './api/token.service.js';
import { trustChainAPI } from './api/trust-chain.service.js';
import { PolicyEngineService } from './policy-engine/policy-engine.service.js';
import {
ApplicationState,
Branding,
COMMON_CONNECTION_CONFIG,
Contract,
DataBaseHelper,
DatabaseServer,
DidDocument,
entities,
Environment,
ExternalEventChannel,
IPFS,
LargePayloadContainer,
MessageBrokerChannel,
MessageServer,
Migration,
mongoForLoggingInitialization,
OldSecretManager,
PinoLogger,
pinoLoggerInitialization,
Policy,
RetirePool,
RetireRequest,
Schema,
SecretManager,
Settings,
Token,
Topic,
TopicMemo,
TransactionLogger,
TransactionLogLvl,
Users,
ValidateConfiguration,
VcDocument,
VpDocument,
Wallet,
WiperRequest,
Workers,
AggregateVC, ApplicationState, ApprovalDocument, Artifact, ArtifactChunk, AssignEntity, BlockCache, BlockState, Branding, COMMON_CONNECTION_CONFIG,
Contract, DataBaseHelper, DatabaseServer, DidDocument, DocumentState, DryRun, DryRunFiles, Environment, ExternalDocument, ExternalEventChannel, IPFS,
LargePayloadContainer, MessageBrokerChannel, MessageServer, Migration, MintRequest, MintTransaction, mongoForLoggingInitialization, MultiDocuments,
MultiPolicy, MultiPolicyTransaction, OldSecretManager, PinoLogger, pinoLoggerInitialization, Policy, PolicyCache, PolicyCacheData, PolicyCategory,
PolicyInvitations, PolicyModule, PolicyProperty, PolicyRoles, PolicyTest, PolicyTool, Record, RetirePool, RetireRequest, Schema, SecretManager,
Settings, SplitDocuments, SuggestionsConfig, Tag, TagCache, Theme, Token, Topic, TopicMemo, TransactionLogger, TransactionLogLvl, Users,
ValidateConfiguration, VcDocument, VpDocument, Wallet, WiperRequest, Workers
} from '@guardian/common';
import { ApplicationStates, PolicyEvents, PolicyType, WorkerTaskType } from '@guardian/interfaces';
import { AccountId, PrivateKey, TopicId } from '@hashgraph/sdk';
Expand Down Expand Up @@ -80,6 +50,53 @@ import { setDefaultSchema } from './api/helpers/default-schemas.js';

export const obj = {};

const necessaryEntity = [
AggregateVC,
ApprovalDocument,
ArtifactChunk,
Artifact,
BlockCache,
BlockState,
Branding,
Contract,
DidDocument,
DocumentState,
DryRun,
ExternalDocument,
PolicyModule,
MultiDocuments,
MultiPolicyTransaction,
MultiPolicy,
PolicyInvitations,
PolicyRoles,
Policy,
RetirePool,
RetireRequest,
Schema,
Settings,
SplitDocuments,
SuggestionsConfig,
TagCache,
Tag,
Theme,
Token,
PolicyTool,
Topic,
VcDocument,
VpDocument,
WiperRequest,
Record,
PolicyCategory,
PolicyProperty,
MintRequest,
MintTransaction,
DryRunFiles,
PolicyCacheData,
PolicyCache,
AssignEntity,
PolicyTest
]

Promise.all([
Migration({
...COMMON_CONNECTION_CONFIG,
Expand All @@ -91,7 +108,7 @@ Promise.all([
useUnifiedTopology: true
},
ensureIndexes: true,
entities
entities: necessaryEntity
}, [
'v2-4-0',
'v2-7-0',
Expand Down
3 changes: 1 addition & 2 deletions logger-service/src/api/logger.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Log } from '../entity/log.js';
import { DataBaseHelper, LargePayloadContainer, MessageError, MessageResponse } from '@guardian/common';
import { DataBaseHelper, LargePayloadContainer, MessageError, MessageResponse, Log } from '@guardian/common';
import { MessageAPI } from '@guardian/interfaces';
import { Controller, Module } from '@nestjs/common';
import { ClientsModule, Ctx, MessagePattern, NatsContext, Payload, Transport } from '@nestjs/microservices';
Expand Down
3 changes: 2 additions & 1 deletion logger-service/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ApplicationState, COMMON_CONNECTION_CONFIG, DataBaseHelper, LargePayloadContainer, MessageBrokerChannel, Migration } from '@guardian/common';
import { ApplicationState, COMMON_CONNECTION_CONFIG, DataBaseHelper, LargePayloadContainer, MessageBrokerChannel, Migration, Log } from '@guardian/common';
import { ApplicationStates } from '@guardian/interfaces';
import { MikroORM } from '@mikro-orm/core';
import { MongoDriver } from '@mikro-orm/mongodb';
Expand Down Expand Up @@ -37,6 +37,7 @@ Promise.all([
maxPoolSize: parseInt(process.env.MAX_POOL_SIZE ?? DEFAULT_MONGO.MAX_POOL_SIZE, 10),
maxIdleTimeMS: parseInt(process.env.MAX_IDLE_TIME_MS ?? DEFAULT_MONGO.MAX_IDLE_TIME_MS, 10)
},
entities: [Log],
ensureIndexes: true,
}),
MessageBrokerChannel.connect('LOGGER_SERVICE'),
Expand Down