Git Product home page Git Product logo

spark-stats's Introduction

Filecoin Station

ci

filstation.app

Install

Release notes and all versions of Filecoin Station can be found on the releases page.

Each release has packages for desktop platforms:

  • Windows: .exe

  • macOS: .dmg

  • Linux: .AppImage

    Currently this application uses libsecret. Depending on your distribution, you will need to run the following command:

    • Debian/Ubuntu: sudo apt-get install libsecret-1-dev
    • Red Hat-based: sudo yum install libsecret-devel
    • Arch Linux: sudo pacman -S libsecret

Documentation

See /docs

Security

See SECURITY.md

License

SPDX-License-Identifier: Apache-2.0 OR MIT

spark-stats's People

Contributors

bajtos avatar dependabot[bot] avatar juliangruber avatar patricknercessian avatar

Watchers

 avatar

spark-stats's Issues

Avoid returning data for incomplete/partial days for new dashboards

As per @bajtos

We are already 'using Grafana's feature called "time shift" to hide the most recent data in the charts. "-1d" for daily values, "-30d" for monthly values' for other dashboards

But 'Maybe we can implement this inside the spark-stats service? We already have some logic to handle date ranges; it understands the concept of “today”. But maybe not “this month”.'

// Provide default values for "from" and "to" when not specified
if (!to) {
to = today()
shouldRedirect = true
}
if (!from) {
from = to
shouldRedirect = true
}
if (shouldRedirect) {
res.setHeader('cache-control', `public, max-age=${600 /* 10min */}`)
res.setHeader('location', `${pathname}?${new URLSearchParams({ from, to })}`)
res.writeHead(302) // Found
res.end()
return { from, to }
}

Maybe we can modify the SQL queries to something like this: MAX(filter.to, date_trunc('month', now()) - "1 month")

If we never return stats for the current period (day/week/month), then we can also simplify the response cache control header:

const setCacheControlForStatsResponse = (res, filter) => {
// We cannot simply compare filter.to vs today() because there may be a delay in finalizing
// stats for the previous day. Let's allow up to one hour for the finalization.
const boundary = getDayAsISOString(new Date(Date.now() - 3600_000))
if (filter.to >= boundary) {
// response includes partial data for today, cache it for 10 minutes only
res.setHeader('cache-control', 'public, max-age=600')
} else {
// historical data should never change, cache it for one year
res.setHeader('cache-control', `public, max-age=${365 * 24 * 3600}, immutable`)
}
}
'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.