Compare commits

...
11 Commits
Author SHA1 Message Date
Gabriel Amorim f46b1b62db Merge pull request #220 from dadosfera/feat/new-customer-monitoring
FEAT: new customer monitoring dashboard
2024-06-28 16:37:38 -03:00
Gabriel Rosa 8b6cd8a88e FEAT: customer monitoring dashboard 2024-06-21 09:21:27 -03:00
Gabriel Rosa 0c333b476a FEAT: new customer monitoring 2024-06-20 10:50:07 -03:00
Gabriel Amorim c416a2cb97 Merge pull request #219 from dadosfera/feat/pipeline-monitoring-dashboard
Feat: pipeline monitoring dashboard
2024-05-06 16:52:26 -03:00
Gabriel Rosa d03021fc9d new protospack release 2024-05-06 15:28:26 -03:00
Gabriel Rosa 574cf48726 FIX: npm audit fix 2024-05-02 12:11:46 -03:00
Gabriel Rosa 7cef404acf FEAT: get monitoring dashboard url 2024-05-02 12:11:35 -03:00
Gabriel Rosa 3c32c3c7d4 CI: Update actions/checkout to v4 2024-04-22 14:57:01 -03:00
Gabriel Amorim d44531b963 Merge pull request #218 from dadosfera/feat/choose-deploy-dockerhub
[ TECN-6603 ] CI: update action versions and choose wether to upload to dockerhub
2024-01-10 10:05:47 -03:00
Gabriel Rosa 36c80b480e CI: update action versions and choose wether to upload to dockerhub 2024-01-04 14:58:47 -03:00
Rafael Santana eeef97679c Merge pull request #217 from dadosfera/ci/dockerhub
UPDATE: updating maestro to deploy image to dockerhub
2023-11-26 21:18:32 -03:00
14 changed files with 2520 additions and 1795 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ module.exports = {
extends: [ extends: [
'eslint:recommended', 'eslint:recommended',
'plugin:@typescript-eslint/recommended', 'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended', 'prettier',
], ],
root: true, root: true,
env: { env: {
+16 -10
View File
@@ -13,6 +13,11 @@ on:
- stg - stg
- stg2 - stg2
- prd - prd
push_to_dockerhub:
description: "Push image to Dockerhub?"
required: true
type: boolean
default: false
jobs: jobs:
extract_environment: extract_environment:
@@ -39,11 +44,11 @@ jobs:
new_release_version: ${{ (steps.semantic.outputs.new_release_published == 'true' && steps.semantic.outputs.new_release_version) || (github.event_name == 'workflow_dispatch' && '0.0.0') }} new_release_version: ${{ (steps.semantic.outputs.new_release_published == 'true' && steps.semantic.outputs.new_release_version) || (github.event_name == 'workflow_dispatch' && '0.0.0') }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- if: github.event_name != 'workflow_dispatch' - if: github.event_name != 'workflow_dispatch'
name: Semantic Release name: Semantic Release
uses: cycjimmy/semantic-release-action@v3 uses: cycjimmy/semantic-release-action@v4
id: semantic id: semantic
with: with:
extra_plugins: | extra_plugins: |
@@ -76,7 +81,7 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Update Pip - name: Update Pip
run: | run: |
@@ -95,14 +100,14 @@ jobs:
python3 -m pip install awsebcli --upgrade python3 -m pip install awsebcli --upgrade
- name: Configure AWS Region - name: Configure AWS Region
uses: aws-actions/configure-aws-credentials@v1-node16 uses: aws-actions/configure-aws-credentials@v4
id: aws id: aws
with: with:
aws-region: us-east-1 aws-region: us-east-1
- name: Login to AWS ECR - name: Login to AWS ECR
id: login_ecr id: login_ecr
uses: aws-actions/amazon-ecr-login@v1 uses: aws-actions/amazon-ecr-login@v2
- name: Build, Tag, and Push Image to AWS ECR - name: Build, Tag, and Push Image to AWS ECR
env: env:
@@ -114,20 +119,21 @@ jobs:
docker-compose -f build.docker-compose.yml push docker-compose -f build.docker-compose.yml push
- name: Login to Docker Hub - name: Login to Docker Hub
if: ${{inputs.push_to_dockerhub}}
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
username: dadosfera username: dadosfera
password: ${{ secrets.DOCKERHUB_PASSWORD }} password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build, Tag, and Push Image to Dockerhub - name: Build, Tag, and Push Image to Dockerhub
if: ${{inputs.push_to_dockerhub}}
env: env:
ENV: ${{ needs.extract_environment.outputs.environment }} ENV: ${{ needs.extract_environment.outputs.environment }}
IMAGE_TAG: ${{ needs.semantic_release.outputs.new_release_version }} IMAGE_TAG: ${{ needs.semantic_release.outputs.new_release_version }}
ACCOUNT_ID: ${{ steps.aws.outputs.aws-account-id }} ACCOUNT_ID: ${{ steps.aws.outputs.aws-account-id }}
run: | run: |
docker-compose -f build.docker-compose.dockerhub.yml build docker-compose -f build.docker-compose.dockerhub.yml build
docker-compose -f build.docker-compose.dockerhub.yml push docker-compose -f build.docker-compose.dockerhub.yml push
- name: Create ZIP file to Deploy AWS Beanstalk - name: Create ZIP file to Deploy AWS Beanstalk
env: env:
@@ -162,7 +168,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Extract Docs BlockId and PageId - name: Extract Docs BlockId and PageId
env: env:
+1
View File
@@ -12,6 +12,7 @@
"start:debug" "start:debug"
], ],
"runtimeExecutable": "npm", "runtimeExecutable": "npm",
"runtimeVersion": "18.10.0",
"skipFiles": [ "skipFiles": [
"<node_internals>/**" "<node_internals>/**"
], ],
+40 -1
View File
@@ -490,6 +490,45 @@
] ]
} }
}, },
"/pipelinesV2/monitoring-dashboard": {
"get": {
"operationId": "PipelinesController_getMonitoringDashboard",
"parameters": [
{
"name": "dadosfera-lang",
"in": "header",
"required": false,
"schema": {
"enum": [
"pt-br",
"en-us"
],
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
},
"tags": [
"PipelinesV2"
],
"security": [
{
"access-token": []
}
]
}
},
"/pipelinesV2": { "/pipelinesV2": {
"post": { "post": {
"operationId": "PipelinesController_create", "operationId": "PipelinesController_create",
@@ -1752,7 +1791,7 @@
} }
}, },
"info": { "info": {
"title": "Maestro - feat/generate-token", "title": "Maestro - feat/new-customer-monitoring",
"description": "This is the Maestro API", "description": "This is the Maestro API",
"version": "1.0.0", "version": "1.0.0",
"contact": {} "contact": {}
+62 -1
View File
@@ -2663,6 +2663,45 @@
] ]
} }
}, },
"/pipelinesV2/monitoring-dashboard": {
"get": {
"operationId": "PipelinesController_getMonitoringDashboard",
"parameters": [
{
"name": "dadosfera-lang",
"in": "header",
"required": false,
"schema": {
"enum": [
"pt-br",
"en-us"
],
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
},
"tags": [
"PipelinesV2"
],
"security": [
{
"access-token": []
}
]
}
},
"/pipelinesV2": { "/pipelinesV2": {
"post": { "post": {
"operationId": "PipelinesController_create", "operationId": "PipelinesController_create",
@@ -5060,6 +5099,28 @@
] ]
} }
}, },
"/customers/monitoring-dashboard": {
"get": {
"operationId": "CustomersController_getCustomerMonitoringDashboard",
"parameters": [],
"responses": {
"200": {
"description": ""
}
},
"tags": [
"Customers"
],
"security": [
{
"access-token": []
},
{
"access-token": []
}
]
}
},
"/health": { "/health": {
"get": { "get": {
"operationId": "HealthController_check", "operationId": "HealthController_check",
@@ -5076,7 +5137,7 @@
} }
}, },
"info": { "info": {
"title": "Maestro - feat/generate-token", "title": "Maestro - feat/new-customer-monitoring",
"description": "This is the Maestro API", "description": "This is the Maestro API",
"version": "1.0.0", "version": "1.0.0",
"contact": {} "contact": {}
+2290 -1764
View File
File diff suppressed because it is too large Load Diff
+3 -4
View File
@@ -29,7 +29,7 @@
"dependencies": { "dependencies": {
"@aws-sdk/client-secrets-manager": "^3.112.0", "@aws-sdk/client-secrets-manager": "^3.112.0",
"@dadosfera/dadosfera-logs": "^1.0.0-beta.4", "@dadosfera/dadosfera-logs": "^1.0.0-beta.4",
"@dadosfera/protospack-v2": "3.31.0", "@dadosfera/protospack-v2": "3.33.0",
"@grpc/grpc-js": "^1.6.7", "@grpc/grpc-js": "^1.6.7",
"@grpc/proto-loader": "^0.6.13", "@grpc/proto-loader": "^0.6.13",
"@nestjs/cli": "^9.4.2", "@nestjs/cli": "^9.4.2",
@@ -80,11 +80,10 @@
"@types/passport-google-oauth20": "^2.0.11", "@types/passport-google-oauth20": "^2.0.11",
"@types/passport-oauth2": "^1.4.11", "@types/passport-oauth2": "^1.4.11",
"@types/supertest": "^2.0.12", "@types/supertest": "^2.0.12",
"@typescript-eslint/eslint-plugin": "^5.29.0", "@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.29.0", "@typescript-eslint/parser": "^5.62.0",
"eslint": "^8.18.0", "eslint": "^8.18.0",
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^27.5.1", "jest": "^27.5.1",
"nock": "^13.2.7", "nock": "^13.2.7",
"prettier": "^2.7.1", "prettier": "^2.7.1",
+19 -11
View File
@@ -67,7 +67,6 @@ export const PERMISSIONS_GROUPS = {
}, },
}, },
}, },
PIPELINE: { PIPELINE: {
title: { title: {
'pt-br': 'Coletar | Pipelines', 'pt-br': 'Coletar | Pipelines',
@@ -117,7 +116,6 @@ export const PERMISSIONS_GROUPS = {
}, },
}, },
}, },
CONNECTION: { CONNECTION: {
title: { title: {
'pt-br': 'Coletar | Fontes de dados', 'pt-br': 'Coletar | Fontes de dados',
@@ -157,7 +155,6 @@ export const PERMISSIONS_GROUPS = {
}, },
}, },
}, },
NETWORK_CONFIG: { NETWORK_CONFIG: {
title: { title: {
'pt-br': 'Coletar | Redes', 'pt-br': 'Coletar | Redes',
@@ -187,7 +184,6 @@ export const PERMISSIONS_GROUPS = {
// }, // },
}, },
}, },
OUTPUT: { OUTPUT: {
title: { title: {
'pt-br': 'Output', 'pt-br': 'Output',
@@ -237,7 +233,6 @@ export const PERMISSIONS_GROUPS = {
}, },
}, },
}, },
TRANSFORMATIONS: { TRANSFORMATIONS: {
title: { title: {
'pt-br': 'Micro-transformações', 'pt-br': 'Micro-transformações',
@@ -287,7 +282,6 @@ export const PERMISSIONS_GROUPS = {
}, },
}, },
}, },
CATALOG: { CATALOG: {
title: { title: {
'pt-br': 'Explorar | Catálogo', 'pt-br': 'Explorar | Catálogo',
@@ -368,7 +362,6 @@ export const PERMISSIONS_GROUPS = {
}, },
}, },
}, },
CONNECTORS: { CONNECTORS: {
title: { title: {
'pt-br': 'Conectores', 'pt-br': 'Conectores',
@@ -418,7 +411,6 @@ export const PERMISSIONS_GROUPS = {
}, },
}, },
}, },
SNOWFLAKE: { SNOWFLAKE: {
title: { title: {
'pt-br': 'Explorar | Consolidar', 'pt-br': 'Explorar | Consolidar',
@@ -438,7 +430,6 @@ export const PERMISSIONS_GROUPS = {
}, },
}, },
}, },
ZENDESK: { ZENDESK: {
title: { title: {
'pt-br': 'Zendesk', 'pt-br': 'Zendesk',
@@ -458,7 +449,6 @@ export const PERMISSIONS_GROUPS = {
}, },
}, },
}, },
DATAVIZ: { DATAVIZ: {
title: { title: {
'pt-br': 'Analisar | Visualização', 'pt-br': 'Analisar | Visualização',
@@ -497,7 +487,6 @@ export const PERMISSIONS_GROUPS = {
}, },
}, },
}, },
MODULES: { MODULES: {
title: { title: {
'pt-br': 'Módulos da Dadosfera', 'pt-br': 'Módulos da Dadosfera',
@@ -594,6 +583,25 @@ export const PERMISSIONS_GROUPS = {
}, },
}, },
}, },
CUSTOMER: {
title: {
'pt-br': 'Organização',
'en-us': 'Organization',
'es-es': 'Organización',
},
permissions: {
MONITORING_DASHBOARD: {
seqid: 47,
claim: 'customer:monitoring-dashboard',
usage: PermissionUsages.PUBLIC,
name: {
'pt-br': 'Ver o dashboard de monitoramento',
'en-us': 'View the monitoring dashboard',
'es-es': 'Ver el dashboard de monitoreo',
},
},
},
},
}; };
export interface DadosferaModule { export interface DadosferaModule {
name: string; name: string;
+3 -1
View File
@@ -164,6 +164,8 @@ export class AuthClientService implements OnModuleInit {
async oauthSignIn(data: { username: string; token: string }) { async oauthSignIn(data: { username: string; token: string }) {
const { username, token } = data; const { username, token } = data;
return lastValueFrom(this.authService.AuthOauthSignIn({ token, username })); return lastValueFrom(
this.authService.AuthOauthSignIn({ token, username, refreshToken: '' }),
);
} }
} }
@@ -22,6 +22,7 @@ import { CustomersService } from './customers.service';
import { CustomerDto, CustomerLinksResponse } from './dtos/customers'; import { CustomerDto, CustomerLinksResponse } from './dtos/customers';
import { RequestUser, User } from 'src/decorators/user.decorator'; import { RequestUser, User } from 'src/decorators/user.decorator';
import type { StringValue } from 'ms'; import type { StringValue } from 'ms';
import { PackTheMetadata } from 'src/utils/ PackTheMetadata';
@ApiInternalOnlyController() @ApiInternalOnlyController()
@ApiTags('Customers') @ApiTags('Customers')
@@ -71,4 +72,17 @@ export class CustomersController {
}; };
return this.customersService.generateToken(exp, data); return this.customersService.generateToken(exp, data);
} }
@Get('monitoring-dashboard')
@RequireAllPermissions(
PERMISSIONS_GROUPS.CUSTOMER.permissions.MONITORING_DASHBOARD,
)
async getCustomerMonitoringDashboard(
@User() user: RequestUser,
): Promise<{ url: string }> {
this.logger.info('getCustomerMonitoringDashboard');
const metadata = PackTheMetadata(user);
return this.customersService.getMonitoringDashboardUrl(metadata);
}
} }
+9 -2
View File
@@ -4,11 +4,18 @@ import { ClientsModule } from '@nestjs/microservices';
import { DucClient } from '../duc/client.config'; import { DucClient } from '../duc/client.config';
import { CustomersController } from './customers.controller'; import { CustomersController } from './customers.controller';
import { CustomersService } from './customers.service'; import { CustomersService } from './customers.service';
import { PipelinesClientConfiguration } from '../pipelinesV2/pipelines-client';
const client = new DucClient(); const ducClient = new DucClient();
const piFactoryClient = new PipelinesClientConfiguration();
@Module({ @Module({
imports: [ClientsModule.register([client.providerOptions])], imports: [
ClientsModule.register([
ducClient.providerOptions,
piFactoryClient.providerOptions,
]),
],
controllers: [CustomersController], controllers: [CustomersController],
providers: [CustomersService, DadosferaLogger], providers: [CustomersService, DadosferaLogger],
exports: [CustomersService], exports: [CustomersService],
@@ -22,20 +22,34 @@ import {
} from '@aws-sdk/client-secrets-manager'; } from '@aws-sdk/client-secrets-manager';
import getEnv from 'src/utils/getEnv'; import getEnv from 'src/utils/getEnv';
import { logger } from 'elastic-apm-node'; import { logger } from 'elastic-apm-node';
import {
ReadService,
ProtoServices as PipelineProtoServices,
} from '@dadosfera/protospack-v2/dist/lib/PipelineV2';
import { Metadata } from '@grpc/grpc-js';
import { PipelinesClientConfiguration } from '../pipelinesV2/pipelines-client';
// This function will accept any string, which may result in a bug. // This function will accept any string, which may result in a bug.
@Injectable() @Injectable()
export class CustomersService implements OnModuleInit { export class CustomersService implements OnModuleInit {
private customerService: CustomersProtoService; private customerService: CustomersProtoService;
private pipelineReadService: ReadService.PipelineV2ReadService;
constructor( constructor(
@Inject(DucClient.name) private readonly grpcClient: ClientGrpc, @Inject(DucClient.name) private readonly grpcClient: ClientGrpc,
@Inject(PipelinesClientConfiguration.name)
private readonly pipelinesGrpcClient: ClientGrpc,
) {} ) {}
onModuleInit() { onModuleInit() {
this.customerService = this.grpcClient.getService<CustomersProtoService>( this.customerService = this.grpcClient.getService<CustomersProtoService>(
ProtoServices.CustomersProtoService, ProtoServices.CustomersProtoService,
); );
this.pipelineReadService =
this.pipelinesGrpcClient.getService<ReadService.PipelineV2ReadService>(
PipelineProtoServices.PipelineV2ReadService,
);
} }
async getLinks(customerId: string) { async getLinks(customerId: string) {
@@ -120,4 +134,21 @@ export class CustomersService implements OnModuleInit {
// const decoded = jwt.decode(jwt_token, { complete: true }); // const decoded = jwt.decode(jwt_token, { complete: true });
return jwt_token; return jwt_token;
} }
async getMonitoringDashboardUrl(metadata: Metadata) {
logger.info('CustomersService - getMonitoringDashboardUrl');
const res = await lastValueFrom(
this.pipelineReadService.PipelineV2GetDashboardUrl(
{
dashboard_id: '45',
exp: '15m',
metabase_customer_name: 'dadosferatech',
},
metadata,
),
);
logger.info('Done');
return res;
}
} }
@@ -14,6 +14,7 @@ import {
Patch, Patch,
HttpException, HttpException,
BadRequestException, BadRequestException,
CacheTTL,
} from '@nestjs/common'; } from '@nestjs/common';
import { import {
ApiCreatedResponse, ApiCreatedResponse,
@@ -86,6 +87,18 @@ export class PipelinesController {
this.logger = dadosferaLogger.logger; this.logger = dadosferaLogger.logger;
} }
@Get('monitoring-dashboard')
async getMonitoringDashboard(@User() user: RequestUser) {
this.logger.info('PipelinesController - getMonitoringDashboard', { user });
const metadata = PackTheMetadata(user);
const response =
await this.pipelinesClientService.getMonitoringDashboardUrl(metadata);
return response;
}
@Post() @Post()
@ApiCreatedResponse({ type: IPipelineV2 }) @ApiCreatedResponse({ type: IPipelineV2 })
async create( async create(
@@ -321,4 +321,22 @@ export class PipelinesService implements OnModuleInit {
); );
}); });
} }
async getMonitoringDashboardUrl(metadata: Metadata) {
this.logger.info('PipelinesClientService - getMonitoringDashboardUrl');
const res = await lastValueFrom(
this.pipelineReadService.PipelineV2GetDashboardUrl(
{
dashboard_id: '83',
exp: '15m',
metabase_customer_name: 'dadosferatech',
},
metadata,
),
);
this.logger.info('Done');
return res;
}
} }