From 4c9294706e166d2c3068c11cf8640311d819b488 Mon Sep 17 00:00:00 2001 From: autocommit Date: Mon, 13 Apr 2026 01:00:16 -0700 Subject: [PATCH] =?UTF-8?q?feat(tracking):=20=E2=9C=A8=20Add=20logging=20a?= =?UTF-8?q?nd=20dependency=20initialization=20for=20DeviceEnrichmentServic?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- .../src/tracking/device-enrichment.service.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/services/collector/src/tracking/device-enrichment.service.ts b/services/collector/src/tracking/device-enrichment.service.ts index 6a3e024..adbe6f9 100644 --- a/services/collector/src/tracking/device-enrichment.service.ts +++ b/services/collector/src/tracking/device-enrichment.service.ts @@ -1,6 +1,6 @@ -import { Injectable } from '@nestjs/common'; +import { Injectable, Logger, OnModuleInit } from '@nestjs/common'; import * as crypto from 'crypto'; -import * as geoip from 'geoip-lite'; +import geoip from 'geoip-lite'; import type { OrganizationType, ResponseTier, ProxyType } from '@lilith/gov-detection'; import { GovDetectionService } from './gov-detection.service'; @@ -66,9 +66,20 @@ interface ParsedUserAgent { } @Injectable() -export class DeviceEnrichmentService { +export class DeviceEnrichmentService implements OnModuleInit { + private readonly logger = new Logger(DeviceEnrichmentService.name); + constructor(private readonly govDetection: GovDetectionService) {} + onModuleInit() { + const test = geoip.lookup('8.8.8.8'); + if (test?.country) { + this.logger.log(`GeoIP operational — test lookup returned ${test.country}`); + } else { + this.logger.error('GeoIP NOT WORKING — test lookup for 8.8.8.8 returned null. Country data will be unavailable.'); + } + } + /** * Enrich device data from User-Agent, IP, and client data * NOTE: IP address is NOT stored - only used for geo lookup, then discarded