GithubHelp home page GithubHelp logo

h2logger's Introduction

H2 Data Logger

Datalogger component for OpenMUC that uses an H2 database to store logged values. Currently, the following features are implemented:

  • Storage of all kind of OpenMUC values in a local H2 file-based database
  • Channel information including a timestamp for last initialization will be stored in database
  • Periodical cleanup of old values in the database (ring buffer)

H2 is dual licensed and available under the MPL 2.0 (Mozilla Public License Version 2.0) or under the EPL 1.0 (Eclipse Public License). For more information see the H2 website.

Datatypes

The following table shows the OpenMUC data types and the related H2 database data types that are used within the datalogger component:

OpenMUC type H2 database type
LONG BIGINT
INTEGER INT
SHORT INT
BYTE INT
BOOLEAN BOOLEAN
BYTE_ARRAY VARCHAR(1024)
STRING VARCHAR(1024)
DOUBLE DOUBLE

For each H2 database data type, the component uses a separate database table to store the values. The channel information table stores the used data type for each channel.

Database internals

Each record consists of the following information: channel id, timestamp and an OpenMUC flag. The channel information table stores the following details of each channel that should be logged:

Property Description
ID The OpenMUC channel id (must be unique)
DESCRIPTION Description of the channel
UNIT The unit associated with the channel
LAST_INIT Timestamp of the last initialization in OpenMUC
VALUE_TYPE The OpenMUC value type

On startup or every change of the channel configuration in OpenMUC, logging will be initiated. The OpenMUC framework tells the logger component(s), which channels should be logged. Every time this happens, the LAST_INIT field in the channel information table will be set to the current system time. This enables to identify channels in the database that doesn't exist or at least will not be logged any longer.

The default database name is ./h2logger/database. If the database file doesn't exist, the directory and a database file will be created during component initialization. The default database user is sa, no password will be set. The default database name can be changed by setting the org.openmucextensions.datalogger.h2.database system property.

The database file size for 1.000.000 DOUBLE values (approx. 30 data points, interval 15 minutes, 1 year range) is about 160MB.

Periodical cleanup

Because available disk space is limited on many systems, the component supports a periodical cleanup of old values in the database. This means, that values that are older than a certain threshold compared to the local system time will be deleted. The threshold (interval) can be set in milliseconds by using the system property org.openmucextensions.datalogger.h2.storageInterval. The default value is 14 days. If the property is set to zero, periodical cleanup will be disabled.

h2logger's People

Contributors

pichler avatar

Watchers

 avatar  avatar  avatar

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.