Playing with the python prometheus query API

The last few days have been a bit icky around here, with my house apparently proudly residing in the major city with the dirtiest air in the world. So, I needed a distraction... It has also been quite hot, so I wondered how my energy usage was going. I have prometheus monitoring of my power draw, so now seemed as good a time as any to learn how to do some historical querying over the API. I ended up with a python script which can output things like this: "Yesterday had a maximum temperature of 38 and we used 28.36 kwh. The average for similar days is 25.56 kwh." The code is on github if it is of interest to others. I am sure I could push more of this processing down into the prometheus engine, but I couldn't see how to do it today. Hints welcome!

Continue ReadingPlaying with the python prometheus query API

Prometheus 2.12, query logging, and startup failures on macos

  • Post author:
  • Post category:Prometheus

Prometheus v2.12 added active query logging. The basic idea is that there is a mmaped JSON file that contains all of the queries currently running. If prometheus was to crash, that file would therefore be a list of the queries running at the time of the crash. Overall, not a bad idea. Some friends had recently added prometheus to their development environments. This is wired up to grafana dashboards for their microservices, and prometheus is configured to store 14 days worth of time series data via a persistent volume from the developer desktops. We did this because it is valuable for the developers to be able to see the history of metrics before and after their changes. Now we have a developer using macos as their primary development platform, and since prometheus 2.12 it hasn't worked. Specifically this developer is using parallels to provide the docker virtual machine on his mac. You can summarise the startup for prometheus in the dev environment like this: $ docker run ...stuff... ...snip... level=error ts=2019-09-15T02:20:23.520Z caller=query_logger.go:94 component=activeQueryTracker msg="Failed to mmap" file=/prometheus-data/data/queries.active Attemptedsize=20001 err="invalid argument" panic: Unable to create mmap-ed active query log goroutine 1 [running]: github.com/prometheus/prometheus/promql.NewActiveQueryTracker(0x7fff9917af38, 0x15, 0x14, 0x2a6b7c0, 0xc00003c7e0, 0x2a6b7c0) /app/promql/query_logger.go:112 +0x4d2 main.main()…

Continue ReadingPrometheus 2.12, query logging, and startup failures on macos

The Ghost Brigades (2)

  • Post author:
  • Post category:Book

The second time around I think my opinion has changed a little. I found the plot a little hard to believe (perhaps I am scarred by other book's twee explorations of the motivations of alien species), and overall the book not as good as Old Man's War. Then again, its far from the worst book I have read this year. Original post about this book. [award: nominee prometheus 2007] [isbn: 0765354063]

Continue ReadingThe Ghost Brigades (2)

Buying Time

  • Post author:
  • Post category:Book

This book isn't Haldeman's best work (checkout The Forever War, The Forever Peace, or Marsbound for examples of his really good stuff). I found the characters largely unsympathetic, and the plot quite slow. The book is also odd in that it was written in 1989, but is full of stuff you'd expect to see from a Heinlein novel like The Moon Is a Harsh Mistress -- global conspiracies, Russian space colonies with vigilante law, that sort of thing. Interestingly, the plot twist is much more smoothly done than many other Haldeman novels, which is nice.

Continue ReadingBuying Time

The Ghost Brigades

  • Post author:
  • Post category:Book

This book is a really good sequel, and just as good as Old Man's War. While some of the characters reappear, the story stands on its own and is quite entertaining. I enjoyed this book a lot. There's something about bright green genetically engineered super soldiers killing aliens that makes me happy. [award: nominee prometheus 2007] [isbn: 0765354063]

Continue ReadingThe Ghost Brigades

The System of the World

  • Post author:
  • Post category:Book

The final book of the Baroque Cycle, and it feels like a real achievement to have gone through them all. They have their slow spots, but also excellent action and characters I love. Best of all, this book focuses on the latter two, with only one section of long theoretical dialog (about the nature of God in this case), which was so common in the other books and somethings so hard to follow. This story line was well worth the 2,500 or so pages it took, and the last book was a pleasure to read. It feels like there should be more books in this universe, but I'm not aware of any -- perhaps later? [award: winner prometheus 2005] [isbn: 0060750863;0060750863]

Continue ReadingThe System of the World

Friday

  • Post author:
  • Post category:Book

This is the first Heinlein book I have read in a long time -- since High School in fact. I read this one simply on an impulse, as the back cover description made it sound interesting. Heinlein isn't on the list of authors that I am pursuing at the moment, although I might consider changing that. This book covers a more complicated Earth than the one we have right now, although in some ways its more simple. The main character Friday doesn't ever seem to have trouble making friends, and portions of the book are just a series of her romantic entanglements. Most of the complexities are political. The story is mostly about a journey, both physical as well as emotional, and interestingly there isn't a consistent opposing force. I suspect that might be unusual, at least for the stuff I read. This book was good, even if the constant romantic entanglements seemed extraneous. [award: winner nebula 1982; winner hugo 1982; winner locus 1983; winner prometheus 1983] [isbn: 034530988x]

Continue ReadingFriday

End of content

No more pages to load