Browse Source

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

chore: at import logging
pull/6753/head
mertmit 12 months 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 { MetaApiLimiterGuard } from '~/guards/meta-api-limiter.guard';
import { PublicApiLimiterGuard } from '~/guards/public-api-limiter.guard';
import { TelemetryService } from '~/services/telemetry.service';
@Controller()
export class UtilsController {
private version: string;
constructor(protected readonly utilsService: UtilsService) {}
constructor(
protected readonly utilsService: UtilsService,
protected readonly telemetryService: TelemetryService,
) {}
@UseGuards(PublicApiLimiterGuard)
@Get('/api/v1/version')
@ -44,7 +48,7 @@ export class UtilsController {
scope: 'org',
})
@HttpCode(200)
async testConnection(@Body() body: any) {
async testConnection(@Body() body: any, @Request() _req: any) {
body.pool = {
min: 0,
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 Airtable from 'airtable';
import hash from 'object-hash';
import { T } from 'nc-help';
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import tinycolor from 'tinycolor2';
@ -33,6 +32,7 @@ import { ViewsService } from '~/services/views.service';
import { FormsService } from '~/services/forms.service';
import { JOBS_QUEUE, JobTypes } from '~/interface/Jobs';
import { GridColumnsService } from '~/services/grid-columns.service';
import { TelemetryService } from '~/services/telemetry.service';
dayjs.extend(utc);
@ -104,6 +104,7 @@ export class AtImportProcessor {
private readonly bulkDataAliasService: BulkDataAliasService,
private readonly jobsLogService: JobsLogService,
private readonly gridColumnService: GridColumnsService,
private readonly telemetryService: TelemetryService,
) {}
@Process(JobTypes.AtImport)
@ -1981,8 +1982,10 @@ export class AtImportProcessor {
logBasic(`:: Axios fetch count: ${rtc.fetchAt.count}`);
logBasic(`:: Axios fetch time: ${rtc.fetchAt.time}`);
T.event({
event: 'a:airtable-import:success',
this.telemetryService.sendEvent({
evt_type: 'a:airtable-import:success',
user_id: syncDB.user.id,
email: syncDB.user.email,
data: {
stats: {
migrationTime: duration,
@ -2515,8 +2518,9 @@ export class AtImportProcessor {
}
} catch (e) {
if (e.message) {
T.event({
event: 'a:airtable-import:error',
this.telemetryService.sendEvent({
evt_type: 'a:airtable-import:error',
user_id: syncDB.user.id,
data: { error: e.message },
});
console.log(e);

Loading…
Cancel
Save