Go to file
Alex P aabf82c965 Uh oh 2019-01-14 17:06:11 -08:00
.circleci chore(ci): Fix nightly build bug 2019-01-14 17:30:27 -05:00
.github Wipe out workspace in preparation for v2 merge 2019-01-11 10:38:50 -08:00
bolt feat(platform): add organization id to dashboard 2019-01-14 11:28:28 -05:00
chronograf chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
cmd chore(platform): specific not found error for telegraf configs 2019-01-14 17:08:44 +01:00
context chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
docker WIP fix: Docker image 'influx' gets 'influx' binary 2019-01-14 09:25:05 -08:00
etc Wipe out workspace in preparation for v2 merge 2019-01-11 10:38:50 -08:00
flux Wipe out workspace in preparation for v2 merge 2019-01-11 10:38:50 -08:00
fs chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
gather add(gather): add writer interface 2019-01-11 13:09:18 -05:00
http fix(ui/dataLoaders): Add check for existing configs for update 2019-01-14 11:02:14 -08:00
inmem feat(platform): add organization id to dashboard 2019-01-14 11:28:28 -05:00
internal Wipe out workspace in preparation for v2 merge 2019-01-11 10:38:50 -08:00
kit chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
kv chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
logger Wipe out workspace in preparation for v2 merge 2019-01-11 10:38:50 -08:00
mock chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
models Wipe out workspace in preparation for v2 merge 2019-01-11 10:38:50 -08:00
nats Ensure error don't end in punctuation: ST1005 2018-11-30 10:54:24 +00:00
pkg Wipe out workspace in preparation for v2 merge 2019-01-11 10:38:50 -08:00
prometheus Wipe out workspace in preparation for v2 merge 2019-01-11 10:38:50 -08:00
query Merge pull request #10954 from influxdata/feature/update_task_options 2019-01-11 14:58:10 -06:00
rand chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
scripts Wipe out workspace in preparation for v2 merge 2019-01-11 10:38:50 -08:00
snowflake chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
source chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
storage chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
task Merge pull request #11015 from influxdata/feat/task-validation 2019-01-14 08:16:27 -07:00
telegraf/plugins chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
testing feat(platform): add organization id to dashboard 2019-01-14 11:28:28 -05:00
toml Wipe out workspace in preparation for v2 merge 2019-01-11 10:38:50 -08:00
tools/tmpl refactor: modify tooling to take advantage of go run 2018-10-15 11:01:27 -05:00
tsdb Wipe out workspace in preparation for v2 merge 2019-01-11 10:38:50 -08:00
ui Uh oh 2019-01-14 17:06:11 -08:00
uuid Wipe out workspace in preparation for v2 merge 2019-01-11 10:38:50 -08:00
vault chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
write chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
zap chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
.gitignore Wipe out workspace in preparation for v2 merge 2019-01-11 10:38:50 -08:00
.goreleaser.yml WIP fix: Docker image 'influx' gets 'influx' binary 2019-01-14 09:25:05 -08:00
LICENSE Wipe out workspace in preparation for v2 merge 2019-01-11 10:38:50 -08:00
Makefile Make client generation optional via ENV variable 2019-01-03 11:33:23 -08:00
README.md Update README.md 2019-01-12 17:48:58 -05:00
api-compat.Jenkinsfile ci: rename api-compatibility Jenkinsfile 2019-01-10 16:03:08 -08:00
appveyor.yml ci: stop whitelisting appveyor branches 2019-01-14 13:32:12 -08:00
auth.go feat(http): allow user id to be specified explicitly on authorization 2019-01-14 10:20:20 -05:00
authz.go fix(influxdb): add org id to permissions 2019-01-11 12:23:28 -05:00
authz_test.go fix(influxdb): add org id to permissions 2019-01-11 12:23:28 -05:00
bucket.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
dashboard.go feat(platform): add organization id to dashboard 2019-01-14 11:28:28 -05:00
dbrp_mapping.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
dbrp_mapping_internal_test.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
dbrp_mapping_test.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
error.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
errors.go Wipe out workspace in preparation for v2 merge 2019-01-11 10:38:50 -08:00
errors.md feat(errors): add errors lib 2018-09-07 21:45:47 -05:00
errors_test.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
example_test.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
go.mod WIP fix: Docker image 'influx' gets 'influx' binary 2019-01-14 09:25:05 -08:00
go.sum WIP fix: Docker image 'influx' gets 'influx' binary 2019-01-14 09:25:05 -08:00
id.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
id_test.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
keyvalue_log.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
label.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
label_test.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
lookup.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
macro.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
macro_test.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
measurement.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
onboarding.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
operation_log.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
organization.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
paging.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
proto.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
query.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
scraper.go add(gather): add writer interface 2019-01-11 13:09:18 -05:00
secret.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
session.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
source.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
status.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
task.go feat(tasks): update task options from api 2019-01-11 11:55:46 -06:00
task_test.go feat(tasks): update task options from api 2019-01-11 11:55:46 -06:00
telegraf.go Merge pull request #11045 from influxdata/find_telegrafs_bug 2019-01-14 12:27:07 -05:00
telegraf_test.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
token.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
tools.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
usage.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
user.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
user_resource_mapping.go fix(influxdb): add org id to permissions 2019-01-11 12:23:28 -05:00
user_resource_mapping_test.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
view.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
view_test.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
write.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00

README.md

InfluxDB CircleCI

This is the for InfluxDB 2.0 OSS, which includes parts that used to be known as Chronograf and Kapacitor.

If you are looking for the InfluxDB 1.x Go Client, we've created a new repo for that.

Installation

This project requires Go 1.11 and Go module support.

Set GO111MODULE=on or build the project outside of your GOPATH for it to succeed.

If you are getting an error loading module requirements error with bzr executable file not found in $PATH” on make, brew install bazaar (on macOS) before continuing. This error will also be returned if you have not installed npm. On macOS, brew install npm will install npm.

For information about modules, please refer to the wiki.

Basic Usage

A successful make run results in two binaries, with platform-dependent paths:

$ make
...
env GO111MODULE=on go build -tags 'assets ' -o bin/darwin/influx ./cmd/influx
env GO111MODULE=on go build -tags 'assets ' -o bin/darwin/influxd ./cmd/influxd

influxd is the InfluxDB service. influx is the CLI management tool.

Start the service. Logs to stdout by default:

$ bin/darwin/influxd

To write and read fancy timeseries data, you'll need to first create a user, credentials, organization and bucket. Use the subcommands influx user, influx auth, influx org and influx bucket, or do it all in one breath with influx setup:

$ bin/darwin/influx setup
Welcome to InfluxDB 2.0!
Please type your primary username: user

Please type your password: s3^R#tpA$s

Please type your password again: s3^R#tpA$s

Please type your primary organization name.: my-org

Please type your primary bucket name.: my-bucket

Please type your retention period in hours (exp 168 for 1 week).
Or press ENTER for infinite.: 72


You have entered:
  Username:          user
  Organization:      my-org
  Bucket:            my-bucket
  Retention Period:  72 hrs
Confirm? (y/n): y

UserID                  Username        Organization    Bucket
033a3f2c5ccaa000        user            my-org          my-bucket
Your token has been stored in /Users/you/.influxdbv2/credentials

~/.influxdbv2/credentials contains your auth token. Most influx commands read the token from this file path by default.

You may need the organization ID and bucket ID later:

$ influx org find
ID                      Name
033a3f2c708aa000        my-org
$ influx bucket find
ID                      Name            Retention       Organization    OrganizationID
033a3f2c710aa000        my-bucket       72h0m0s         my-org          033a3f2c708aa000

Write to measurement m, with tag v=2, in bucket my-bucket, which belongs to organization my-org:

$ bin/darwin/influx write --org my-org --bucket my-bucket --precision s "m v=2 $(date +%s)"

Write the same point using curl:

curl --header "Authorization: Token $(cat ~/.influxdbv2/credentials)" --data-raw "m v=2 $(date +%s)" "http://localhost:9999/api/v2/write?org=033a3f2c708aa000&bucket=033a3f2c710aa000&precision=s"

Read that back with a simple Flux query (currently, the query subcommand does not have a --org flag):

$ bin/darwin/influx query --org-id 033a3f2c708aa000 'from(bucket:"my-bucket") |> range(start:-1h)'
Result: _result
Table: keys: [_start, _stop, _field, _measurement]
                   _start:time                      _stop:time           _field:string     _measurement:string                      _time:time                  _value:float
------------------------------  ------------------------------  ----------------------  ----------------------  ------------------------------  ----------------------------
2019-01-10T19:24:06.806244000Z  2019-01-10T20:24:06.806244000Z                       v                       m  2019-01-10T20:04:09.000000000Z                             2

Use the fancy REPL:

$ bin/darwin/influx repl --org my-org
> from(bucket:"my-bucket") |> range(start:-1h)
Result: _result
Table: keys: [_start, _stop, _field, _measurement]
                   _start:time                      _stop:time           _field:string     _measurement:string                      _time:time                  _value:float
------------------------------  ------------------------------  ----------------------  ----------------------  ------------------------------  ----------------------------
2019-01-10T19:36:23.361220000Z  2019-01-10T20:36:23.361220000Z                       v                       m  2019-01-10T20:04:09.000000000Z                             2
>

Introducing Flux

We recently announced Flux, the MIT-licensed data scripting language (and rename for IFQL). The source for Flux is available on GitHub. Learn more about Flux from CTO Paul Dix's presentation.

CI and Static Analysis

CI

All pull requests will run through CI, which is currently hosted by Circle. Community contributors should be able to see the outcome of this process by looking at the checks on their PR. Please fix any issues to ensure a prompt review from members of the team.

The InfluxDB project is used internally in a number of proprietary InfluxData products, and as such, PRs and changes need to be tested internally. This can take some time, and is not really visible to community contributors.

Static Analysis

This project uses the following static analysis tools. Failure during the running of any of these tools results in a failed build. Generally, code must be adjusted to satisfy these tools, though there are exceptions.

  • go vet checks for Go code that should be considered incorrect.
  • go fmt checks that Go code is correctly formatted.
  • go mod tidy ensures that the source code and go.mod agree.
  • staticcheck checks for things like: unused code, code that can be simplified, code that is incorrect and code that will have performance issues.

staticcheck

If your PR fails staticcheck it is easy to dig into why it failed, and also to fix the problem. First, take a look at the error message in Circle under the staticcheck build section, e.g.,

tsdb/tsm1/encoding.gen.go:1445:24: func BooleanValues.assertOrdered is unused (U1000)
tsdb/tsm1/encoding.go:172:7: receiver name should not be an underscore, omit the name if it is unused (ST1006)

Next, go and take a look here for some clarification on the error code that you have received, e.g., U1000. The docs will tell you what's wrong, and often what you need to do to fix the issue.

Generated Code

Sometimes generated code will contain unused code or occasionally that will fail a different check. staticcheck allows for entire files to be ignored, though it's not ideal. A linter directive, in the form of a comment, must be placed within the generated file. This is problematic because it will be erased if the file is re-generated. Until a better solution comes about, below is the list of generated files that need an ignores comment. If you re-generate a file and find that staticcheck has failed, please see this list below for what you need to put back:

File Comment
query/promql/promql.go //lint:file-ignore SA6001 Ignore all unused code, it's generated