MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / getMetrics

Function getMetrics

apps/api/src/controllers/insights.controller.ts:146–166  ·  view source on GitHub ↗
(
  req: FastifyRequest<{
    Params: { projectId: string };
    Querystring: z.infer<typeof zGetMetricsQuery>;
  }>,
  reply: FastifyReply
)

Source from the content-addressed store, hash-verified

144});
145
146export async function getMetrics(
147 req: FastifyRequest<{
148 Params: { projectId: string };
149 Querystring: z.infer<typeof zGetMetricsQuery>;
150 }>,
151 reply: FastifyReply
152) {
153 const projectId = await getProjectId(req as RequestWithProjectParam);
154 const { timezone } = await getSettingsForProject(projectId);
155 const { startDate, endDate } = getChartStartEndDate(req.query, timezone);
156 reply.send(
157 await overviewService.getMetrics({
158 projectId,
159 filters: req.query.filters,
160 startDate,
161 endDate,
162 interval: getDefaultIntervalByDates(startDate, endDate) ?? 'day',
163 timezone,
164 })
165 );
166}
167
168// ---------------------------------------------------------------------------
169// Analytics — live visitors

Callers

nothing calls this directly

Calls 6

getSettingsForProjectFunction · 0.90
getChartStartEndDateFunction · 0.90
getMetricsMethod · 0.80
getProjectIdFunction · 0.70
sendMethod · 0.45

Tested by

no test coverage detected