Skip to content

Commit

Permalink
new name/api
Browse files Browse the repository at this point in the history
  • Loading branch information
asmuth committed Sep 19, 2017
1 parent e1291c2 commit 8ef9fdf
Show file tree
Hide file tree
Showing 72 changed files with 1,668 additions and 239 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Expand Up @@ -44,3 +44,10 @@ confdefs.h
src/fnordmetric/metric-collectd
src/fnordmetric/metric-queryd
*.dSYM
CMakeFiles
CMakeCache.txt
cmake_install.cmake
/example-*
/*.tgz
/*.pdf
zdbtool
24 changes: 24 additions & 0 deletions CMakeLists.txt
@@ -0,0 +1,24 @@
cmake_minimum_required(VERSION 3.1)
project(libpaint)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

find_package(Threads)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)

add_library(zdb STATIC
src/zdb/zdb.h
src/zdb/zdb.cc)

add_executable(zdbtool
src/zdb/util/exception.h
src/zdb/util/exception.cc
src/zdb/util/flagparser.h
src/zdb/util/flagparser.cc
src/zdb/util/stringutil.h
src/zdb/util/stringutil.cc
src/zdb/zdbtool.cc
src/zdb/zdbtool_init.cc)

91 changes: 27 additions & 64 deletions README.md
@@ -1,92 +1,55 @@
metrictools
===========
libzdb
======

[![Build Status](https://travis-ci.org/paulasmuth/metrictools.png?branch=unstable)](http://travis-ci.org/paulasmuth/metrictools)
[![Build Status](https://travis-ci.org/paulasmuth/libzdb.png?branch=master)](http://travis-ci.org/paulasmuth/libzdb)

metrictools is a collection of lightweight tools that allow you to record
measurements and build beautiful real-time dashboards within minutes. All using
your favorite backend database (currently supported are SQLite, MySQL, Postgres
and EventQL). **If you're new to metrictools it's highly recommended that you start
with the [Getting Started](https://metrictools.org/documentation/getting-started) page.**.
libzdb is an embedded columnar database.

Here's a quick rundown of the key features for people who don't like reading
documentation.:
* Data is organized into tables and rows. Tables have a strict schema
* Columnar storage allows for very efficient compression and I/O
* Implemented as a lightweight C/C++ library
* Agnostic to data model; supports relational, key-value, timeseries/log-structured, etc.
* Allows reading/scanning data without copying it (zero-copy)

- Add your own custom metrics and labels
- Insert data, run queries and create charts using a standalone command line interface
- Pull ("scrape") measurements via HTTP, shell scripts or SNMP or push via HTTP or UDP/statsd
- Include charts and tables in any HTML page using the HTTP API
- All metrics are explicitly configured and have a number of rich settings (like units of measurement)
- Data is stored in a pluggable storage backend (SQLite, MySQL, Postgres, EventQL)
- Optional background daemon that runs data collection and exposes a HTTP API
- Plugins can contain metric configuration, exporters and dashboards (check out
the linux plugin)
- Implemented as a collection of lightweight composable commands in spirit of the original daemontools project
- Written in self-contained modern C++; quick to set up and does not require a lot of resources
- The metrictools project was started over 7 years ago and is still actively maintained
[Documentation](http://libzdb.org/) | [Download](http://libzdb.org/download/)

More Information:
[Documentation](http://metrictools.org/),
[Download](https://metrictools.org/download/),
[Getting Started](https://metrictools.org/documentation/getting-started)
## Building

To build and install libzdb from a distribution tarball or git checkout, run
these commands:

## Build

Before we can start we need to install some build dependencies. Currently
you need a modern c++ compiler, libz and autotools.

# Ubuntu
$ apt-get install clang make automake autoconf libtool zlib1g-dev

# OSX
$ brew install automake autoconf

To build metrictools from a distribution tarball:

$ ./configure
$ cmake .
$ make
$ sudo make install

To build metrictools from a git checkout:

$ git clone git@github.com:paulasmuth/metrictools.git
$ cd metrictools
$ ./autogen.sh
$ ./configure
$ make V=1
$ sudo make install

To run the test suite:

$ make check

$ make test

## Documentation

You can find the full documentation at https://metrictools.org/

You can find the full documentation and screenshots of example programs at
https://libzdb.org/

## Contributing

To contribute, please fork this repository, make your changes and run the
tests, commit them to your github repository and send a pull request.
Need help, head on over to our [Google Groups](htt//groups.google.com/group/metrictools)
Need help, head on over to our [Google Groups](htt//groups.google.com/group/libzdb)
page to discuss any ideas that you might have.


## License

Copyright (c) 2011-2017 Paul Asmuth, Laura Schlimmer et al.
Copyright (c) 2011-2017 Paul Asmuth, Laura Schlimmer

metrictools is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
The libzdb library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option) any
later version.

metrictools is distributed in the hope that it will be useful,but WITHOUT ANY
libzdb is distributed in the hope that it will be useful,but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU General Public License along with
metrictools. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU Lesser General Public License along
with libzdb. If not, see <http://www.gnu.org/licenses/>.
82 changes: 0 additions & 82 deletions core/metrictools/util/return_code.h

This file was deleted.

36 changes: 36 additions & 0 deletions src/zdb/table.h
@@ -0,0 +1,36 @@
/**
* This file is part of the "FnordMetric" project
* Copyright (c) 2016 Paul Asmuth <paul@asmuth.com>
*
* FnordMetric is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License v3.0. You should have received a
* copy of the GNU General Public License along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <stdlib.h>
#include <stdint.h>
#include <string>

namespace zdb {

struct ColumnConfig {

};

class TableSchema {
public:

ReturnCode addColumn(const std::string& name, const ColumnConfig& config);
ReturnCode removeColumn(const std::string& name);
bool fetchColumnID(const std::string& name, uint32_t* id);
bool fetchColumnConfig(const std::string& name, const ColumnConfig** config);

protected:

};

using TableMap = std::map<std::string, TableSchema>;

} // namespace zdb

Expand Up @@ -8,7 +8,7 @@
* copy of the GNU General Public License along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include "metrictools/util/autoref.h"
#include "autoref.h"

RefCounted::RefCounted() : refcount_(0) {}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions core/metrictools/util/buffer.cc → src/zdb/util/buffer.cc
Expand Up @@ -7,9 +7,9 @@
* copy of the GNU General Public License along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include <metrictools/util/buffer.h>
#include <metrictools/util/exception.h>
#include <string.h>
#include "buffer.h"
#include "exception.h"

Buffer::Buffer() : data_(nullptr), size_(0), alloc_(0), mark_(0) {}

Expand Down
File renamed without changes.
Expand Up @@ -8,8 +8,8 @@
* copy of the GNU General Public License along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include "metrictools/util/bufferutil.h"
#include "metrictools/util/inspect.h"
#include "libpaint/util/bufferutil.h"
#include "libpaint/util/inspect.h"

void BufferUtil::stripTrailingBytes(Buffer* buf, unsigned char byte) {
auto begin = (const unsigned char*) buf->data();
Expand Down
Expand Up @@ -13,7 +13,7 @@

#include <stdlib.h>
#include <stdint.h>
#include "metrictools/util/buffer.h"
#include "libpaint/util/buffer.h"

class BufferUtil {
public:
Expand Down
Expand Up @@ -8,7 +8,7 @@
* copy of the GNU General Public License along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include <metrictools/util/daemonize.h>
#include <libpaint/util/daemonize.h>

namespace fnordmetric {

Expand Down
Expand Up @@ -10,7 +10,7 @@
*/
#include <stdlib.h>
#include <unistd.h>
#include <metrictools/util/return_code.h>
#include <libpaint/util/return_code.h>

namespace fnordmetric {

Expand Down
46 changes: 23 additions & 23 deletions core/metrictools/util/exception.cc → src/zdb/util/exception.cc
Expand Up @@ -11,8 +11,8 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <metrictools/util/exception.h>
#include <metrictools/util/outputstream.h>
#include "exception.h"
#include "outputstream.h"

Exception::Exception() :
type_name_(nullptr),
Expand Down Expand Up @@ -94,27 +94,27 @@ void Exception::appendMessage(const char* message, ...) {
va_end(args);
}

void Exception::debugPrint(OutputStream* os /* = nullptr */) const {
const char* type_name =
type_name_ == nullptr ? "Exception" : type_name_;

std::unique_ptr<OutputStream> os_local;
if (os == nullptr) {
os_local = OutputStream::getStderr();
os = os_local.get();
}

os->write(
StringUtil::format(
"$0: $1\n"
" in $2\n"
" in $3:$4\n",
type_name,
message_,
func_,
file_,
line_));
}
//void Exception::debugPrint(OutputStream* os /* = nullptr */) const {
// const char* type_name =
// type_name_ == nullptr ? "Exception" : type_name_;
//
// std::unique_ptr<OutputStream> os_local;
// if (os == nullptr) {
// os_local = OutputStream::getStderr();
// os = os_local.get();
// }
//
// os->write(
// StringUtil::format(
// "$0: $1\n"
// " in $2\n"
// " in $3:$4\n",
// type_name,
// message_,
// func_,
// file_,
// line_));
//}

const char* Exception::what() const noexcept {
return message_;
Expand Down
File renamed without changes.

0 comments on commit 8ef9fdf

Please sign in to comment.