Giter Site home page Giter Site logo

Comments (3)

skx avatar skx commented on September 26, 2024

So I started working on this again. The specific problem is that we throw away the timezone when we parse the date/time from the YAML report.

I first of all looked at different parsing-libraries, such as this one:

Then I realized that we can simplify this problem enormously:

  • If we receive a HTTP-upload we know that puppet "just ran".
  • So don't bother parsing the time: field.
  • Instead we regard the time that puppet ran as the insert-time.

So our insertion code changes from:

stmt, err := tx.Prepare("INSERT INTO reports(fqdn,state,yaml_file,executed_at,runtime, failed, changed, total, skipped) values(?,?,?,?,?,?,?,?,?)")

To this:

stmt, err := tx.Prepare("INSERT INTO reports(fqdn,state,yaml_file,executed_at,runtime, failed, changed, total, skipped) values(?,?,?,'NOW()',?,?,?,?,?)")

That will let us calculate relative times in the DB-layer, I think?

from puppet-summary.

skx avatar skx commented on September 26, 2024

To recap. There are two possible solutions here:

  • Get better at parsing the submission-time, from the YAML upload.
  • Avoid the problem entirely and record the time the report was received.
    • This is close to the time that puppet ran, but obviously not 100% identical.
    • Since the time the report is received is local to the puppet-usummary server we can calculate the difference to now when we handle serving the HTML/JSON/XML reports and it'll all "just work".

I'm leaning toward to the second solution due to simplicity but it will require a DB-change, which means that either we need to explain to users how to make that change, or we must insist the local database is wiped and recreated, orphaning any existing reports.

Due to this breaking-change I don't want to do anything hasty, on that basis I'm going to make the next release before coming back to this issue.

from puppet-summary.

skx avatar skx commented on September 26, 2024

Plan:

  • Stop populating / using the AtUnix field.
  • Reports will be written to $prefix/$hostname/$hash
    • Where $hash is the hash of the report-contents.
    • This will still allow us to identify duplicate-submissions.
  • Add a new field to the database, as a migration, which will be the submission time.
    • If this is present use it. (i.e. New submissions.)
    • If not fall back to the the At field.

from puppet-summary.

Related Issues (20)

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.