Skip to content

"Device story" page on API - realtime replacement #606

Closed

Description

@matschaffer

http://realtime.safecast.org/ today requires a lot of manual administration (for each new device) and uses a polling model that places a huge load on the database behind api.safecast.org. With many devices and high traffic, the system today will likely fall over.

In talking with @robouden today I think what might make the most sense for the future of http://realtime.safecast.org/ is to build a new DeviceStory (still not sure on the name) model/controller/view in api.safecast.org

Inside API we could pull http://tt.safecast.org/devices once every N minutes (maybe 5).

For any device that doesn't already have a DeviceStory model, we create one. This model would be the home for a few things:

  • metadata about the device, as initially provided by ttserve (and possibly updated, if ttserve sends us a new name)
  • comments about the device (from users logged into api)
  • current owner of the device (an api user)
  • photo attachments of the device
  • embeds/links to grafana/kibana (keyed on device URN)

Note that one important aspect of this is that there could be multiple stories for a given piece of hardware (e.g., if it changes hands). But we still need a way to link to the latest story for a given device URN.

Echoing what I said to eito on slack

Things to work on:

Activity

  1. matschaffer commented on Dec 1, 2019

    @matschaffer
    ContributorAuthor

    @auspicacious @eitoball @ZacharyCChang0828 @robouden @thinrope @Frangible @rayozzie - pinging a few folks for comment, feel free to add your thoughts.

    This was the result of a morning roundtable with @robouden @Frangible and myself that we should be able to build something like this into API (especially now that we're on postgres 9.5 and can leverage jsonb columns as well).

    While we could also try to build up realtime to support something like this, building it into API seems like a better play to the strengths of the available team (basically none of us have deep wordpress expertise afaik).

  2. robouden commented on Dec 2, 2019

    @robouden
    Contributor

    Thanks for the generation of the issue. I will add comments later.
    Ray already implemented the device_urn at http://tt.safecast.org/devices

  3. robouden commented on Dec 5, 2019

    @robouden
    Contributor
  4. robouden commented on Dec 5, 2019

    @robouden
    Contributor

    Sorry. closed. the issue by accident.

  5. robouden commented on Dec 6, 2019

    @robouden
    Contributor

    Switched the issue to high priority because we have about 170 new devices coming online in the near future and I would like to have RT replacement being auto-scalable.

  6. matschaffer commented on Dec 10, 2019

    @matschaffer
    ContributorAuthor

    There was some question from @auspicacious regarding usage of grafana in this scope.

    It would be great if we could lean on grafana to do most of the visualization work for any given device that flows through ttserve/ingest.safecast.org (basically everything except the bgeigie nano)

    The big shortcoming is the map click behavior. Ideally this would show a recent payload (CPM, PM2.5) data but right now it just shows the geohash & document count which isn’t terribly useful.

    Compare https://grafana.safecast.cc/d/Med5wakZk/device-checker?orgId=1
    Device_Checker_-_Grafana

    With https://realtime.safecast.org/map/
    Map___SAFECAST

    Hopefully behavior is configurable, or we can get assistance from grafana community on a PR.

    Or if not we may need to include a custom map in the scope of this issue.


    Additionally, total decomissioning of realtime would be blocked on some work on the tile map.

    Since the fixed sensor icons (e.g., from https://safecast.org/tilemap/?y=36.2&x=138.69&z=8&l=0&m=0) and graphs
    Screenshot_12_10_19__3_12_PM

    Are fed from the realtime server

    https://realtime.safecast.org/plots_new/out/100351_640x400.png?t=1575958755

    Safecast_Tile_Map

    cc @Frangible and @robouden incase I'm misrepresenting anything here.

  7. deleted a comment from Lugulbanda on Dec 10, 2019
  8. robouden commented on Dec 10, 2019

    @robouden
    Contributor

    On Grafana we can customize the rollovers. I did some testing see the screenshot.Screen Shot 2019-12-10 at 18.51.28.jpg

  9. matschaffer commented on Dec 10, 2019

    @matschaffer
    ContributorAuthor
  10. matschaffer commented on Dec 10, 2019

    @matschaffer
    ContributorAuthor
  11. robouden commented on Dec 11, 2019

    @robouden
    Contributor
  12. matschaffer commented on Dec 11, 2019

    @matschaffer
    ContributorAuthor
  13. eitoball commented on Dec 11, 2019

    @eitoball
    Member

    current owner of the device (an api user)

    How do we associate DeviceStory model with users? Would admin user do it by hand? Or else?

  14. 27 remaining items

  15. linked a pull request that will close this issueImage attachments #765on Jan 27, 2021
  16. removed a link to a pull requestImage attachments #765on Feb 18, 2021
  17. matschaffer commented on Apr 14, 2021

    @matschaffer
    ContributorAuthor

    Gonna close this out since it's largely done.

    I opened a few followups:

  18. matschaffer commented on Apr 14, 2021

    @matschaffer
    ContributorAuthor

    Also wanted to say big thanks for making this whole thing possible.

    We haven't been able to totally remove rt.safecast.org yet, but we're pretty close. And in the mean time, these pages have provided a great exploration space for the new Airnote devices from http://blues.io/

    @rdeskins @Nakushi64 and @eitoball ~

    youreawesome

  19. nokton commented on Apr 14, 2021

    @nokton
    Member
  20. matschaffer commented on Apr 14, 2021

    @matschaffer
    ContributorAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions