From 755aebe3d96537cb39ba166bb189d8e5dab29f9c Mon Sep 17 00:00:00 2001 From: Blayne Chard Date: Wed, 15 Jan 2025 10:18:43 +1300 Subject: [PATCH] refactor: suggestions from code review Co-authored-by: Wentao Kuang --- packages/lambda-analytic-cloudfront/src/log.stats.ts | 2 +- packages/lambda-analytic-cloudfront/src/log/referer.ts | 1 - packages/lambda-analytic-cloudfront/src/log/tile.url.ts | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/lambda-analytic-cloudfront/src/log.stats.ts b/packages/lambda-analytic-cloudfront/src/log.stats.ts index 17cb5c062..114d11777 100644 --- a/packages/lambda-analytic-cloudfront/src/log.stats.ts +++ b/packages/lambda-analytic-cloudfront/src/log.stats.ts @@ -31,7 +31,7 @@ export interface LogStats { tileSet: string; /** - * zoom level of the request served + * zoom level of the request served in WebMercatorQuad zoom scales */ z: number; diff --git a/packages/lambda-analytic-cloudfront/src/log/referer.ts b/packages/lambda-analytic-cloudfront/src/log/referer.ts index fcf1cd6e9..75cb45dfe 100644 --- a/packages/lambda-analytic-cloudfront/src/log/referer.ts +++ b/packages/lambda-analytic-cloudfront/src/log/referer.ts @@ -12,7 +12,6 @@ export function getUrlHost(ref: string): string { export function _getUrlHost(ref: string): string { if (ref == null) return 'unknown'; if (ref === '-') return 'unknown'; - // console.log(ref) try { const { hostname } = new URL(ref); diff --git a/packages/lambda-analytic-cloudfront/src/log/tile.url.ts b/packages/lambda-analytic-cloudfront/src/log/tile.url.ts index 04f871d79..2c0a417bc 100644 --- a/packages/lambda-analytic-cloudfront/src/log/tile.url.ts +++ b/packages/lambda-analytic-cloudfront/src/log/tile.url.ts @@ -41,6 +41,7 @@ export interface TileUrlInfo { /** closes zoom level in web mercator quad */ webMercatorZoom: number; } + export function parseTileUrl(status: number, url: string): TileUrlInfo | undefined { if (!url.startsWith('/v1/tiles')) return; if (status > 399) return;