![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@upstash/core-analytics
Advanced tools
This library offers some low level building blocks to record and analyze custom events in Redis. It's main purpose is to provide a simple way to record and query events in Redis without having to worry about the underlying data structure so we can build more advanced analytics features on top of it.
The quickstart below is slightly outdated. We're working on it.
Go to console.upstash.com/redis and create a new global database.
After creating the db, copy the UPSTASH_REDIS_REST_URL
and UPSTASH_REDIS_REST_TOKEN
to your .env
file.
@upstash/core-analytics
in your projectnpm install @upstash/analytics @upstash/redis
import { Analytics } from "@upstash/core-analytics";
import { Redis } from "@upstash/redis";
const analytics = new Analytics({
redis: Redis.fromEnv(),
window: "1d",
});
An event consists of a time
field and any additional key-value pairs that you can use to record any information you want.
const event = {
time: Date.now() // optional (default: Date.now())
userId: "chronark",
page: "/auth/login",
country: "DE",
}
await analytics.ingest("pageviews", event);
const result = await analytics.query("pageviews");
This project uses bun
for dependency management.
bun install
bun build
All metrics are stored in Redis Hash
data types and sharded into buckets based on the window
option.
@upstash/analytics:{TABLE}:{TIMESTAMP}
TABLE
is a namespace to group events together. ie for managing multiple projects int a single databaseTIMESTAMP
is the starting timestamp of each windowThe field of each hash is a serialized JSON object with the user's event data and the value is the number of times this event has been recorded.
{
"{\"page\": \"/auth/login\",\"country\": \"DE\"}": 5,
"{\"page\": \"/auth/login\",\"country\": \"US\"}": 2
}
FAQs
@upstash/core-analytics Serverless Analytics for Redis
The npm package @upstash/core-analytics receives a total of 100,905 weekly downloads. As such, @upstash/core-analytics popularity was classified as popular.
We found that @upstash/core-analytics demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.