Code Monkey home page Code Monkey logo

chronix.go's Introduction

Build Status Go Report Card code-coverage go-doc Apache License 2

The Chronix Go Client Library

This repository contains the Go client library for Chronix. It allows writing time series data into Chronix and reading it back. While the write implementation allows storing structured time series data, the read implementation is still rudimentary and returns only an opaque byte slice (usually containing JSON, but this depends on the fl query parameter).

For full details on usage, see the Go package documentation.

Example Usage

This example stores several test time series in Chronix and reads them back.

Importing

import "github.com/ChronixDB/chronix.go/chronix"

Creating a Chronix Client

// Parse the Solr/Chronix URL.
u, err := url.Parse("http://<solr-url>/solr/chronix")
if err != nil {
	// Handle error.
}

// Create a Solr client.
solr := chronix.NewSolrClient(u, nil)

// Construct a Chronix client based on the Solr client.
c := chronix.New(solr)

Writing Series Data

// Construct a test time series with one data point.
series := []chronix.TimeSeries{
	{
		Metric: "testmetric",
		Attributes: map[string]string{
			"host": "testhost",
		},
		Points: []chronix.Point{
			{
				Timestamp: 1470784794,
				Value: 42.23,
			},
		},
	},
}

// Store the test series and commit within one second.
err := c.Store(series, false, time.Second)
if err != nil {
  // Handle error.
}

Querying Series Data

// Define the Chronix query parameters.
q := "metric:(testmetric) AND start:1470784794000 AND end:1470784794000"
fq := "join=host_s,metric"
fl := "dataAsJson"

// Execute the query.
resp, err := c.Query(q, fq, fl)
if err != nil {
  // Handle error.
}

chronix.go's People

Contributors

juliusv avatar klapproth avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chronix.go's Issues

Go as c-shared library for Python

Hi,

Currently I'm using ChronixDB for a project. We need to query data from ChronixDB from our python code. I see 3 options

  1. Write our own python client.
  2. Call go or java executable and deserialise the response.
  3. Compile Go project as c-shared module to access from python.
    - Reference: https://dustymabe.com/2016/09/13/sharing-a-go-library-to-python-using-cffi/

Questions

  1. I don't have much experience on the 'go' part for point 3) and would be great to hear your thoughts on what is feasible.
  2. Any other thoughts or recommendation to achieve this with minimal effort?

Thanks,
Alex

When running example, I get 400 Bad Request

When running the example here verbatim, I get Error storing time series: bad HTTP response code: 400 Bad Request.

Note that I replaced the url with my local chronix solr url.

Any idea why this would happen and how to debug?

Add missing type field

In Chronix a time series has a field called type, that defines the data type of the stored points, e.g. metric for double values.

Add attributes holding statistics about the stored data.

We should add attributes with statistics about the stored time series in the chunk, e.g min, max, avg, count, timespan of the chunk (e.g. 2h) etc.

  1. Make the use of statistics configurable
  2. Make it available for all targets (solr, elasticsearch)

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.