Go to file
Daniel Campbell 220c66dc9a
persist Add Data button (#11292)
* persist Add Data button

* swap position

* Update tip text

* remove unused import
2019-01-18 10:53:41 -08:00
.circleci chore(ci): Restore nightly schedule 2019-01-16 14:26:08 -05:00
.github fix(.github): cleanup the pull request template 2018-12-21 13:37:05 -05:00
authorizer fix(authorizer): allow default source orgID to be in the sources list 2019-01-18 13:14:43 -05:00
bolt feat(influxdb): add authorization for user actions 2019-01-17 16:05:24 -05:00
chronograf build(Makefile): fix glob expansion if find command 2019-01-16 13:35:20 -07:00
cmd Show organization names in task api actions (#11223) 2019-01-18 09:10:14 -07: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 chore(Makefile): add target to check generated files are accurate 2018-12-18 12:54:17 -07:00
flux chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
fs Add the organization ID to the protoboard being instantiated as a dashboard 2019-01-17 13:55:40 -08:00
gather fix(scraper): remove enriched type label 2019-01-17 10:22:22 -06:00
http fix(http): display platform error from task client 2019-01-18 10:25:06 -08:00
inmem feat(inmem): dashboards pagination 2019-01-17 12:35:00 +01:00
internal chore(Makefile): remove yq dependency to generate ts client 2018-12-18 11:19:56 -07: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 chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
mock feat(http): add renew session 2019-01-16 11:07:35 -05:00
models chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
nats Ensure error don't end in punctuation: ST1005 2018-11-30 10:54:24 +00:00
pkg chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
prometheus chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
query fix(influxdb): change resource to resource type 2019-01-15 12:57:57 -05:00
rand chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
scripts refactor: modify tooling to take advantage of go run 2018-10-15 11:01:27 -05: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 Merge branch 'master' into flux-staging 2019-01-15 08:35:59 -07:00
task Show organization names in task api actions (#11223) 2019-01-18 09:10:14 -07:00
telegraf/plugins chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
testing feat(influxdb): add authorization for user actions 2019-01-17 16:05:24 -05:00
toml chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
tools/tmpl refactor: modify tooling to take advantage of go run 2018-10-15 11:01:27 -05:00
tsdb Fix bucket delete for all buckets 2019-01-18 17:28:58 +00:00
ui persist Add Data button (#11292) 2019-01-18 10:53:41 -08:00
uuid chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -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 fix(ui): Fix UI generation issues 2019-01-15 20:45:38 -05:00
.goreleaser.yml chore(image):Set image tag to version 2019-01-16 12:23:22 -05:00
LICENSE Initial commit 2018-05-09 09:17:31 -07:00
Makefile chore: add go.mod and go.sum to list of Go sources 2019-01-16 15:33:14 -07: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 fix(influxdb): change resource to resource type 2019-01-15 12:57:57 -05:00
authz.go feat(influxdb): add authorizer 2019-01-18 10:01:50 -05:00
authz_test.go fix(influxdb): change resource to resource type 2019-01-15 12:57:57 -05:00
bucket.go fix(influxdb): rename organizationID to orgID in json struct tags 2019-01-14 18:12:46 -08:00
dashboard.go fix(platform): dashboard filter must implement paging filter 2019-01-17 12:35:00 +01: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 feat(influxdb): authorize org service operations 2019-01-16 14:41:57 -05: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 chore: update to Flux v0.16.1 2019-01-17 12:55:06 -07:00
go.sum chore: update to Flux v0.16.1 2019-01-17 12:55:06 -07: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 fix(influxdb): change resource to resource type 2019-01-15 12:57:57 -05:00
macro.go chore(testing): test macro by org 2019-01-15 20:39:41 +01:00
macro_test.go feat(macro): addition of org ID to macros 2019-01-15 20:39:41 +01: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 filter buckets by FindOptions 2019-01-16 13:08:56 +01: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 feat(http): add renew session 2019-01-16 11:07:35 -05:00
source.go feat(influxdb): default source find options 2019-01-18 14:05:36 +01:00
status.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
task.go Show organization names in task api actions (#11223) 2019-01-18 09:10:14 -07:00
task_test.go feat(tasks): update task options from api 2019-01-11 11:55:46 -06:00
telegraf.go Add additional info links to plugin forms 2019-01-17 14:07:53 -08: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): change resource to resource type 2019-01-15 12:57:57 -05:00
user_resource_mapping_test.go fix(influxdb): change resource to resource type 2019-01-15 12:57:57 -05: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