feat: telemetry add force to improve url fetch logic
This commit is contained in:
parent
1db0832d98
commit
ac7b44e862
@ -6,20 +6,17 @@ import { prisma } from './_client';
|
|||||||
import {
|
import {
|
||||||
BaseQueryFilters,
|
BaseQueryFilters,
|
||||||
getDateQuery,
|
getDateQuery,
|
||||||
getTimestampIntervalQuery,
|
|
||||||
parseTelemetryFilters,
|
parseTelemetryFilters,
|
||||||
} from '../utils/prisma';
|
} from '../utils/prisma';
|
||||||
import { SESSION_COLUMNS } from '../utils/const';
|
import { SESSION_COLUMNS } from '../utils/const';
|
||||||
|
|
||||||
export async function recordTelemetryEvent(req: Request) {
|
export async function recordTelemetryEvent(req: Request) {
|
||||||
const {
|
const { name, title, start, fullNum, force, ...others } = req.query;
|
||||||
url = req.headers.referer,
|
|
||||||
name,
|
const url =
|
||||||
title,
|
req.query.url && force === 'true'
|
||||||
start,
|
? req.query.url
|
||||||
fullNum,
|
: req.headers.referer ?? req.query.url;
|
||||||
...others
|
|
||||||
} = req.query;
|
|
||||||
|
|
||||||
if (!(url && typeof url === 'string')) {
|
if (!(url && typeof url === 'string')) {
|
||||||
return;
|
return;
|
||||||
|
@ -58,7 +58,8 @@ telemetryRouter.get(
|
|||||||
'/:workspaceId/:telemetryId.gif',
|
'/:workspaceId/:telemetryId.gif',
|
||||||
validate(
|
validate(
|
||||||
query('name').optional().isString(),
|
query('name').optional().isString(),
|
||||||
query('url').optional().isURL()
|
query('url').optional().isURL(),
|
||||||
|
query('force').optional().isBoolean()
|
||||||
),
|
),
|
||||||
async (req, res) => {
|
async (req, res) => {
|
||||||
if (env.isTest) {
|
if (env.isTest) {
|
||||||
@ -85,7 +86,8 @@ telemetryRouter.get(
|
|||||||
query('url').optional().isURL(),
|
query('url').optional().isURL(),
|
||||||
query('title').optional().isString(),
|
query('title').optional().isString(),
|
||||||
query('start').optional().isNumeric(),
|
query('start').optional().isNumeric(),
|
||||||
query('fullNum').optional().isBoolean()
|
query('fullNum').optional().isBoolean(),
|
||||||
|
query('force').optional().isBoolean()
|
||||||
),
|
),
|
||||||
async (req, res) => {
|
async (req, res) => {
|
||||||
const title = req.query.title || 'visitor';
|
const title = req.query.title || 'visitor';
|
||||||
|
Loading…
Reference in New Issue
Block a user