Git Product home page Git Product logo

truestreet's Introduction

TrueStreet

A read/write storage endpoint to allow Prometheus to use Google Cloud Spanner as a timeseries data store. Truestreet leverages Google Cloud Spanner database to store timeseries data, resulting in a fast and scalable monitoring system.

Building

Truestreet has migrated from go-dep to go modules to manage versioning and its dependencies.

To build a truestreet binary from source, first checkout the source code and then issue go build command inside the truestreet directory.

git clone https://github.com/google/truestreet.git
cd truestreet
go build
go test

A minimal docker image is produced by following command.

docker build -t truestreet .

Google Cloud Spanner setup

If you have not already, set up the Google Cloud SDK to use the command line interface. Make sure to configure the CLI to be on the correct GCP project.

Create an instance with the command

gcloud spanner instances create truestreet --config=regional-us-central1 --description="TrueStreet Instance" --nodes=1

Any of the arguments can be changed to your needs, just make sure to reflect the name of the instance in TrueStreet's command line arguments. Additionally, it is recommended to consider how heavy the load will be on Spanner, Kubernetes can provide automatic scaling of TrueStreet pods, but setting up the appropriate number of Spanner nodes is not determined by TrueStreet.

TrueStreet command line arguments

port       Port for serving TrueStreet (Default 1760)
project    Name of GCP project
instance   Name of Cloud Spanner instance
db         Name of database inside Cloud Spanner instance
new        Create new database if one does not already exist (Default true)
workers    Number of concurrent routines to write samples (Default 10)
help       Prints help text

For example, creating a database called 'truestreet-db' on the Spanner Instance 'truestreet' would require the flags

--project myProject --instance truestreet --db truestreet-db

By default, TrueStreet wil listen on port 1760. Using the provided project, instance and db name, TrueStreet will first attempt to connect to an existing database on the provided instance. If one is not found and the 'new' flag is set to true, it will create a database to run on the instance.

Prometheus Configuration

Add the following lines to your prometheus.yml to configure remote read and write. Additional configuration options are available and can be inspected here Two suggestions are that, for remote writes, the max samples per second can be increased from its default of 100 samples. If samples are being written en masse from Prometheus to TrueStreet, it's more efficient to batch them here as well, as there are fewer separate requests. TrueStreet batches them to Spanner anyway. A second suggestion is that, to see TrueStreet reading at work, Prometheus can be forced to read only from TrueStreet. This is helpful for testing if the connection is working, and also for retrieving data from other Prometheus instances that may also be writing to the same Spanner database.

remote_write:
    - url: http://<adapter-address>:1760/write
      queue_config:
        max_samples_per_send: 250

remote_read:
    - url: http://<adapter-address>:1760/read
      read_recent: true # Optional to test if read is working

TrueStreet also provides Prometheus metrics. These new metrics can be scraped by adding another target for Prometheus.

scrape_configs:
  - job_name: truestreet
    static_configs:
      - targets: ['localhost:1760']

truestreet's People

Contributors

codeactivist avatar dependabot[bot] avatar joeleu avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

truestreet's Issues

Invalid Argument while querying

Hi Team,

I am using truestreet along with cloudspanner for prometheus.

When I am trying to query node_load1{instance=~"instance_name"}, I am getting the following error.

500 Internal Server Error: spanner: code = "InvalidArgument", desc = "Syntax error: Unexpected \\\"^\\\" [at 7:57]\\n (name=@name0 AND REGEXP_CONTAINS(value, ^(@value0)$))\\n ^"

If I do not use tilde (~) and query just node_load1{instance="instance_name"}, I am getting the results fine.

I was able to use tilde (~) when prometheus was running in a single machine i.e when data was just in the disk

So I cannot query multiple instances in a single query. Can you guys please check this?

Bazel Version

Hi,

Do we need a specific Bazel version and Ubuntu version?

I tried with latest bazel version 3.2.0 and "Ubuntu eoan"and followed the steps mentioned in README.

When I am running- bazel run //:gazelle, It throws the following error

ERROR: Skipping '//:gazelle': error loading package '': Unable to find package for @io_bazel_rules_docker//container:container.bzl: The repository '@io_bazel_rules_docker' could not be resolved.

WARNING: Target pattern parsing failed.

ERROR: error loading package '': Unable to find package for @io_bazel_rules_docker//container:container.bzl: The repository '@io_bazel_rules_docker' could not be resolved.

INFO: Elapsed time: 7.468s
INFO: 0 processes.

FAILED: Build did NOT complete successfully (1 packages loaded)

FAILED: Build did NOT complete successfully (1 packages loaded)

Fetching @rules_cc; Cloning 7e650b11fe6d49f70f2ca7a1c4cb8bcc4a1fe239 of https://github.com/bazelbuild/rules_cc

Can anyone help me here if I am missing out on something here?

Getting some error logs in truestreet

2022/04/29 07:48:52 Failed to prepare session, error: spanner: code = "NotFound", desc = "Session not found: projects/dev-294310/instances/devprom/databases/promdb/sessions/wedbkjwbigwe73bkb38bsdb"
2022/05/02 08:29:48 rowsToTimeseries failed: spanner: code = "Canceled", desc = "context canceled"
2022/05/02 08:29:48 dataClient read error : spanner: code = "Canceled", desc = "context canceled"

I am getting this kind of errors in truestreet

getting following error while connecting spanner

2022/04/25 05:47:51 applyMutations error for samples : spanner: code = "NotFound", desc = "Table not found: samples"
2022/04/25 05:48:11 timeSeriesExists error : spanner: code = "InvalidArgument", desc = "Table not found: index [at 1:27]\nSELECT DISTINCT tsid FROM index WHERE tsid IN UNNEST(@array)\n ^"

Getting permission denied error

2022/05/05 17:04:28 failed to set up Cloud Spanner clients : rpc error: code = PermissionDenied desc = Caller is missing IAM permission spanner.databases.list on resource projects/

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.