Skip to main content
Glama

@arizeai/phoenix-mcp

Official
by Arize-ai
useTimeBin.ts1.1 kB
import { useMemo } from "react"; import { ONE_DAY_SEC, ONE_HOUR_SEC, ONE_MONTH_SEC, ONE_WEEK_SEC, ONE_YEAR_SEC, } from "@phoenix/constants/timeConstants"; /** * Given a time range, returns the appropriate time bin scale to use. Used for charting. */ export function useTimeBinScale({ timeRange, }: { timeRange: OpenTimeRange; }): TimeBinScale { return useMemo(() => { const startTime = timeRange.start; let scale: TimeBinScale = "DAY"; // TODO: Does this make sense if (startTime) { const endTime = timeRange.end || new Date(); const duration = (endTime.getTime() - startTime.getTime()) / 1000; // in seconds if (duration > 5 * ONE_YEAR_SEC) { scale = "YEAR"; } else if (duration > 5 * ONE_MONTH_SEC) { scale = "MONTH"; } else if (duration > 5 * ONE_WEEK_SEC) { scale = "WEEK"; } else if (duration > 5 * ONE_DAY_SEC) { scale = "DAY"; } else if (duration > 5 * ONE_HOUR_SEC) { scale = "HOUR"; } else { scale = "MINUTE"; } } return scale; }, [timeRange]); }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Arize-ai/phoenix'

If you have feedback or need assistance with the MCP directory API, please join our Discord server