Browse Source

Merge pull request #6750 from nocodb/nc-chore/1629-evt

chore: at import logging
pull/6753/head
mertmit 1 year ago committed by GitHub
parent
commit
a4aa258b78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      packages/nocodb/src/controllers/utils.controller.ts
  2. 14
      packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts

8
packages/nocodb/src/controllers/utils.controller.ts

@ -14,12 +14,16 @@ import { UtilsService } from '~/services/utils.service';
import { Acl } from '~/middlewares/extract-ids/extract-ids.middleware'; import { Acl } from '~/middlewares/extract-ids/extract-ids.middleware';
import { MetaApiLimiterGuard } from '~/guards/meta-api-limiter.guard'; import { MetaApiLimiterGuard } from '~/guards/meta-api-limiter.guard';
import { PublicApiLimiterGuard } from '~/guards/public-api-limiter.guard'; import { PublicApiLimiterGuard } from '~/guards/public-api-limiter.guard';
import { TelemetryService } from '~/services/telemetry.service';
@Controller() @Controller()
export class UtilsController { export class UtilsController {
private version: string; private version: string;
constructor(protected readonly utilsService: UtilsService) {} constructor(
protected readonly utilsService: UtilsService,
protected readonly telemetryService: TelemetryService,
) {}
@UseGuards(PublicApiLimiterGuard) @UseGuards(PublicApiLimiterGuard)
@Get('/api/v1/version') @Get('/api/v1/version')
@ -44,7 +48,7 @@ export class UtilsController {
scope: 'org', scope: 'org',
}) })
@HttpCode(200) @HttpCode(200)
async testConnection(@Body() body: any) { async testConnection(@Body() body: any, @Request() _req: any) {
body.pool = { body.pool = {
min: 0, min: 0,
max: 1, max: 1,

14
packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts

@ -2,7 +2,6 @@ import moment from 'moment';
import { UITypes } from 'nocodb-sdk'; import { UITypes } from 'nocodb-sdk';
import Airtable from 'airtable'; import Airtable from 'airtable';
import hash from 'object-hash'; import hash from 'object-hash';
import { T } from 'nc-help';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc'; import utc from 'dayjs/plugin/utc';
import tinycolor from 'tinycolor2'; import tinycolor from 'tinycolor2';
@ -33,6 +32,7 @@ import { ViewsService } from '~/services/views.service';
import { FormsService } from '~/services/forms.service'; import { FormsService } from '~/services/forms.service';
import { JOBS_QUEUE, JobTypes } from '~/interface/Jobs'; import { JOBS_QUEUE, JobTypes } from '~/interface/Jobs';
import { GridColumnsService } from '~/services/grid-columns.service'; import { GridColumnsService } from '~/services/grid-columns.service';
import { TelemetryService } from '~/services/telemetry.service';
dayjs.extend(utc); dayjs.extend(utc);
@ -104,6 +104,7 @@ export class AtImportProcessor {
private readonly bulkDataAliasService: BulkDataAliasService, private readonly bulkDataAliasService: BulkDataAliasService,
private readonly jobsLogService: JobsLogService, private readonly jobsLogService: JobsLogService,
private readonly gridColumnService: GridColumnsService, private readonly gridColumnService: GridColumnsService,
private readonly telemetryService: TelemetryService,
) {} ) {}
@Process(JobTypes.AtImport) @Process(JobTypes.AtImport)
@ -1981,8 +1982,10 @@ export class AtImportProcessor {
logBasic(`:: Axios fetch count: ${rtc.fetchAt.count}`); logBasic(`:: Axios fetch count: ${rtc.fetchAt.count}`);
logBasic(`:: Axios fetch time: ${rtc.fetchAt.time}`); logBasic(`:: Axios fetch time: ${rtc.fetchAt.time}`);
T.event({ this.telemetryService.sendEvent({
event: 'a:airtable-import:success', evt_type: 'a:airtable-import:success',
user_id: syncDB.user.id,
email: syncDB.user.email,
data: { data: {
stats: { stats: {
migrationTime: duration, migrationTime: duration,
@ -2515,8 +2518,9 @@ export class AtImportProcessor {
} }
} catch (e) { } catch (e) {
if (e.message) { if (e.message) {
T.event({ this.telemetryService.sendEvent({
event: 'a:airtable-import:error', evt_type: 'a:airtable-import:error',
user_id: syncDB.user.id,
data: { error: e.message }, data: { error: e.message },
}); });
console.log(e); console.log(e);

Loading…
Cancel
Save