Go to file
pierwill 0566346d30 docs: Update FUZZ.md 2020-10-26 10:43:21 -07:00
.circleci chore: added sign section to goreleaser (#19739) 2020-10-14 09:06:37 -07:00
.github chore(storage): remove storage-team from CODEOWNERS (#19574) 2020-09-21 09:32:05 -07:00
authorization chore: Fix invalid string casts from integers 2020-09-16 11:55:20 -07:00
authorizer chore: remove hardcoded constants for ids 2020-09-10 12:35:25 -07:00
bolt chore: update circleci config to use golang:1.15 images (#19624) 2020-09-23 14:07:13 -07:00
checks chore(task): clean up old maxPermission code (#19432) 2020-08-26 10:26:32 -06:00
chronograf chore: update circleci config to use golang:1.15 images (#19624) 2020-09-23 14:07:13 -07:00
cmd fix(build): building arm 6 (#19756) 2020-10-21 16:29:48 -07:00
context refactor: rewrite imports to include the /v2 suffix for version 2 2020-04-03 12:39:20 -05:00
dbrp fix: Speed up tests by disabling bolt fsync 2020-08-03 09:20:51 -07:00
docker fix: switch port to 8086 2020-09-03 14:40:29 -07:00
docs build: remove npm replace with yarn (#14176) 2019-06-21 16:19:42 -07:00
e2e fix: update chromedriver version (#19618) 2020-09-22 16:49:56 -06:00
endpoints chore: improve code doc 2020-07-30 02:37:51 +02:00
etc fix: switch port to 8086 2020-09-03 14:40:29 -07:00
flux refactor: rewrite imports to include the /v2 suffix for version 2 2020-04-03 12:39:20 -05:00
gather fix: Ensure orgID and bucketID are passed to WritePoints API 2020-10-08 15:43:37 -07:00
http chore(docs): update PostDBRP docs to reflect mutual exclusive requirement of org vs orgID (#19802) 2020-10-22 17:02:32 +01:00
influxql refactor: Replace ctx.Done() with ctx.Err() (#19546) 2020-09-16 12:20:09 -04:00
inmem feat(kv): add support for WithCursorLimit to ForwardCursor (#17524) 2020-08-26 12:10:00 +01:00
internal fix: typos (#19734) 2020-10-13 09:50:32 -07:00
jsonweb feat: Add initial OSS-Fuzz testing integration 2020-07-07 11:46:35 -07:00
kit fix(launcher): Switch to AuthorizationService from authorization package 2020-10-21 07:44:15 -07:00
kv fix(kv): Reorganize bcrypt password hashing outside transactions 2020-10-12 08:06:32 -07:00
label Merge remote-tracking branch 'origin/master' into sgc/tsm1 2020-09-02 11:11:28 -07:00
logger refactor: rewrite imports to include the /v2 suffix for version 2 2020-04-03 12:39:20 -05:00
mock fix: add ability to define bucket to write to with a BucketFilter (#19658) 2020-10-05 15:05:49 -06:00
models fix: Ensure precision is passed to points parsing 2020-08-31 17:39:52 -07:00
nats chore: Remove several instances of WithLogger (#15996) 2019-12-04 15:10:23 -08:00
notification chore: Format of url.Error message has changed 2020-09-16 11:55:20 -07:00
pkg fix: Type-convert fs.Bavail for portability (#19816) 2020-10-26 05:32:04 -04:00
pkger fix: use valid flux in pkger test templates (#19465) 2020-10-19 15:45:11 -06:00
predicate chore: move v2/v1/tsdb → v2/tsdb 2020-08-26 10:46:47 -07:00
prometheus chore: update staticcheck and fix newly identified lint checks (#18737) 2020-06-26 18:54:09 -05:00
query build(flux): update Flux to v0.90.0 2020-10-19 11:30:28 -06:00
rand refactor: rewrite imports to include the /v2 suffix for version 2 2020-04-03 12:39:20 -05:00
resource refactor: rewrite imports to include the /v2 suffix for version 2 2020-04-03 12:39:20 -05:00
scripts chore(packaging): build rpm and deb packages (#19567) 2020-09-16 12:36:44 -07:00
secret refactor: migrator and introduce Store.(Create|Delete)Bucket (#18570) 2020-07-01 12:08:20 +01:00
session fix(tenant): add support for offset to list urms (#18944) 2020-07-14 19:40:04 +01:00
snowflake refactor: rewrite imports to include the /v2 suffix for version 2 2020-04-03 12:39:20 -05:00
source refactor: rewrite imports to include the /v2 suffix for version 2 2020-04-03 12:39:20 -05:00
storage feat: aggregate array cursors 2020-10-23 15:13:28 -07:00
task chore: clean todo (#19745) 2020-10-14 14:22:12 -06:00
telegraf/plugins fix: switch port to 8086 2020-09-03 14:40:29 -07:00
telemetry refactor: Replace ctx.Done() with ctx.Err() (#19546) 2020-09-16 12:20:09 -04:00
tenant chore: clean old feature flags (#19692) 2020-10-06 13:43:32 -06:00
testing fix(kv): Reorganize bcrypt password hashing outside transactions 2020-10-12 08:06:32 -07:00
toml fix: Unit test 2020-09-04 15:56:57 -07:00
tools/tmpl refactor: modify tooling to take advantage of go run 2018-10-15 11:01:27 -05:00
tsdb fix: typos (#19734) 2020-10-13 09:50:32 -07:00
ui fix(timeMachine): change derivative to 1s (#19776) 2020-10-19 11:03:26 -07:00
uuid chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
v1 feat(upgrade): upgrade databases 2020-10-08 09:39:30 -07:00
vault fix: switch port to 8086 2020-09-03 14:40:29 -07:00
write chore(write): refactor batcher to reuse code 2020-10-11 13:25:57 +02:00
zap refactor: rewrite imports to include the /v2 suffix for version 2 2020-04-03 12:39:20 -05:00
.editorconfig chore(editorconfig): revert editorconfig changes, too much work 2020-06-25 18:16:57 +01:00
.gitignore chore: remove arm6 from build and add private.key to gitignore (#19748) 2020-10-14 14:02:44 -07:00
.goreleaser-nightly.yml ci(release): correctly build static binaries for the nightly release (#19022) 2020-07-23 11:46:58 -07:00
.goreleaser.yml fix(build): building arm 6 (#19756) 2020-10-21 16:29:48 -07:00
CHANGELOG.md chore: CHANGELOG updates for v2.0.0-rc.2 (#19795) 2020-10-21 15:33:03 -07:00
CONTRIBUTING.md fix: switch port to 8086 2020-09-03 14:40:29 -07:00
DEVELOPMENT.md fix: switch port to 8086 2020-09-03 14:40:29 -07:00
Dockerfile fix: switch port to 8086 2020-09-03 14:40:29 -07:00
FUZZ.md docs: Update FUZZ.md 2020-10-26 10:43:21 -07:00
LICENSE Initial commit 2018-05-09 09:17:31 -07:00
Makefile chore(packaging): build rpm and deb packages (#19567) 2020-09-16 12:36:44 -07:00
README.md chore(readme): update readme for next release (#19605) 2020-09-29 14:08:18 -07:00
SECURITY.md chore: Update table of supported security updates 2020-09-28 15:19:25 -07:00
api-compat.Jenkinsfile chore(Jenkins): Update Golang build container to 1.12 2019-04-12 15:51:21 -04:00
appveyor.yml fix(tasks): Add a log message for run transition clairity (#14321) 2019-07-12 10:10:11 -06:00
auth.go refactor!: replace authorizer.Allowed method with PermissionSet (#17959) 2020-05-13 12:27:46 +01:00
authz.go fix(auth): use init to read envvar once (#19314) 2020-08-12 16:51:31 -04:00
authz_test.go refactor: rewrite imports to include the /v2 suffix for version 2 2020-04-03 12:39:20 -05:00
backup.go feat(storage): implement backup and restore (#16504) 2020-01-21 14:22:45 -08:00
bucket.go fix: add ability to define bucket to write to with a BucketFilter (#19658) 2020-10-05 15:05:49 -06:00
build.go feat(influxdb): Add global BuildInfo 2019-03-14 09:23:53 -07:00
check.go Merge branch 'master' into chore/merge-master 2020-05-12 11:18:25 -07:00
crud_log.go chore(inmem): nuke the duplicative inmem store 2019-12-30 11:04:45 -08:00
dashboard.go feat: add legendOrientationThreshold (#19584) 2020-09-21 11:02:51 -07:00
dashboard_test.go feat: add legendOrientationThreshold (#19584) 2020-09-21 11:02:51 -07:00
dbrp_mapping.go feat: dbrp service 2020-05-15 12:05:38 +02: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 refactor: rewrite imports to include the /v2 suffix for version 2 2020-04-03 12:39:20 -05:00
delete.go revert(storage): Revert changes from 1501351 2020-08-24 10:08:46 -07:00
document.go fix(http): refactor document service and fix auth 2020-03-09 20:32:31 +01:00
duration.go refactor(tasks): use go Time for Task CreatedAt, UpdatedAt, LatestCompleted, Offset (#15672) 2019-11-12 17:13:56 -08:00
env feat: add support for pkg-config (#17036) 2020-02-28 11:08:21 -06:00
error.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
errors.go feat: Add ENotImplemented error code 2020-09-24 11:11:46 -07:00
errors.md feat(errors): add errors lib 2018-09-07 21:45:47 -05:00
errors_test.go refactor: rewrite imports to include the /v2 suffix for version 2 2020-04-03 12:39:20 -05:00
flags.yml fix(launcher): Switch to AuthorizationService from authorization package 2020-10-21 07:44:15 -07:00
go.mod build(flux): update Flux to v0.90.0 2020-10-19 11:30:28 -06:00
go.sum build(flux): update Flux to v0.90.0 2020-10-19 11:30:28 -06:00
id.go refactor: add new label package (#18078) 2020-05-21 11:30:19 -07:00
id_test.go refactor: rewrite imports to include the /v2 suffix for version 2 2020-04-03 12:39:20 -05:00
keyvalue_log.go feat(kv): implemented key/value store with end-to-end integration tests 2019-02-19 17:47:19 -06:00
label.go fix(labels): prevent adding duplicate labels to resources in kv (#17340) 2020-04-16 09:02:50 -07:00
label_test.go refactor: rewrite imports to include the /v2 suffix for version 2 2020-04-03 12:39:20 -05:00
lookup.go fix(influxdb): change resource to resource type 2019-01-15 12:57:57 -05:00
measurement.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
notification.go refactor!(notifications): drop URM and Org services from NotificationRuleService interface definition (#18131) 2020-05-20 15:10:09 +01:00
notification_endpoint.go feat(http): add notification endpoint service 2019-12-10 12:40:17 -08:00
onboarding.go fix(build): building arm 6 (#19756) 2020-10-21 16:29:48 -07:00
operation_log.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
organization.go fix: org filtering for both kv and tenant need to match behaviors. (#17758) 2020-04-16 12:22:21 -06:00
paging.go feat(paging): add support for after id parameter in find options (#19219) 2020-08-25 14:59:59 +01:00
passwords.go chore: refactor password service to provide userID instead of name 2019-11-20 09:16:31 -08:00
query.go refactor(http): remove the spec and update lang usage (#17148) 2020-03-09 13:30:43 -05:00
scraper.go chore(tenant): point tests to new tenant service (#19477) 2020-09-02 11:50:26 -06:00
secret.go feat(http): add notification endpoint service 2019-12-10 12:40:17 -08:00
secret_test.go feat(notification/endpoint): add endpoint struct 2019-08-15 21:56:17 -04:00
semaphore.go refactor: simpify Semaphore interface 2019-10-23 19:49:48 +01:00
session.go refactor!: replace authorizer.Allowed method with PermissionSet (#17959) 2020-05-13 12:27:46 +01:00
source.go fix: encode IDs as JSON map keys properly 2019-04-26 20:41:20 -07:00
status.go feat(kv): add new update 2019-03-28 11:46:41 -04:00
tag.go feat(pkger): add application functionality for the notification rules resource 2019-12-20 12:48:46 -08:00
tag_test.go refactor: rewrite imports to include the /v2 suffix for version 2 2020-04-03 12:39:20 -05:00
task.go feat: upgrade Flux to v0.83.2 (#19569) 2020-09-16 17:59:15 -07:00
task_errors.go fix(task): update task max page size error message to include an accurate limit 2020-08-06 11:09:40 -07:00
task_test.go feat(task): Parse Task Options using Flux AST Helpers (#19326) 2020-08-20 11:57:23 -04:00
telegraf.go feat(influx): add telegraf resource support to influx CLI 2020-07-20 15:37:43 -07:00
telegraf_test.go fix: switch port to 8086 2020-09-03 14:40:29 -07:00
tenant.go test: add tests for tenant service 2020-03-19 11:34:15 +01:00
token.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
tools.go chore(tools): remove goreleaser from the tools.go file (#18775) 2020-06-29 11:07:53 -05:00
usage.go chore: rename imports from platform to influxdb 2019-01-09 20:51:47 -08:00
user.go feat(task): Add new permission lookup pattern for executor (#18920) 2020-07-13 14:47:58 -06:00
user_resource_mapping.go feat(task): Add new permission lookup pattern for executor (#18920) 2020-07-13 14:47:58 -06:00
user_resource_mapping_test.go chore: update staticcheck and fix newly identified lint checks (#18737) 2020-06-26 18:54:09 -05:00
variable.go fix: add variable name validation for flux identifier 2020-08-21 10:28:18 -07:00
variable_test.go refactor: rewrite imports to include the /v2 suffix for version 2 2020-04-03 12:39:20 -05:00
write.go fix: add ability to define bucket to write to with a BucketFilter (#19658) 2020-10-05 15:05:49 -06:00
xcc.sh fix(release): create static builds for linux amd64 (#18805) 2020-07-01 12:45:54 -05:00

README.md

InfluxDB CircleCI

Slack Status

InfluxDB is an open source time series platform. This includes APIs for storing and querying data, processing it in the background for ETL or monitoring and alerting purposes, user dashboards, and visualizing and exploring the data and more. The master branch on this repo now represents the latest InfluxDB, which now includes functionality for Kapacitor (background processing) and Chronograf (the UI) all in a single binary.

The list of InfluxDB Client Libraries that are compatible with the latest version can be found in our documentation.

If you are looking for the 1.x line of releases, there are branches for each minor version as well as a master-1.x branch that will contain the code for the next 1.x release. The master-1.x working branch is here. The InfluxDB 1.x Go Client can be found here.

Installing from Source

We have nightly and versioned Docker images, Debian packages, RPM packages, and tarballs of InfluxDB available at the InfluxData downloads page. We also provide the influx command line interface (CLI) client as a separate binary available at the same location.

Building From Source

This project requires Go 1.13 and Go module support.

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

The project also requires a recent stable version of Rust. We recommend using rustup to install Rust.

If you are getting an error loading module requirements error with bzr executable file not found in $PATH” on make, then you need to ensure you have bazaar, protobuf, and yarn installed.

  • OSX: brew install bazaar protobuf yarn
  • Linux (Arch): pacman -S bzr protobuf yarn
  • Linux (Ubuntu): apt install bzr protobuf-compiler libprotobuf-dev yarnpkg

NB: For RedHat, there are some extra steps:

  1. You must enable the EPEL
  2. You must add the yarn repository

For information about modules, please refer to the wiki.

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

$ make
...
env GO111MODULE=on go build -tags 'assets ' -o bin/$(uname -s | tr '[:upper:]' '[:lower:]')/influx ./cmd/influx
env GO111MODULE=on go build -tags 'assets ' -o bin/$(uname -s | tr '[:upper:]' '[:lower:]')/influxd ./cmd/influxd

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

Start the service. Logs to stdout by default:

$ bin/$(uname -s | tr '[:upper:]' '[:lower:]')/influxd

Building with the go command

The Makefile provides a wrapper around configuring the utilities for building influxdb. For those wanting to use the go command directly, one of two things can be done.

First, the env script is located in the root of the repository. This script can be used to execute go commands with the appropriate environment configuration.

$ ./env go build ./cmd/influxd

Another method is to configure the pkg-config utility. Follow the instructions here to install and configure pkg-config and then the normal go commands will work.

The first step is to install the pkg-config command.

# On Debian/Ubuntu
$ sudo apt-get install -y clang pkg-config
# On Mac OS X with Homebrew
$ brew install pkg-config

Install the pkg-config wrapper utility of the same name to a different path that is earlier in the PATH.

# Install the pkg-config wrapper utility
$ go build -o ~/go/bin/ github.com/influxdata/pkg-config
# Ensure the GOBIN directory is on your PATH
$ export PATH=$HOME/go/bin:${PATH}
$ which -a pkg-config
/home/user/go/bin/pkg-config
/usr/bin/pkg-config

Then all go build commands should work.

$ go build ./cmd/influxd
$ go test ./...

Getting Started

For a complete getting started guide, please see our full online documentation site.

To write and query data or use the API in any way, you'll need to first create a user, credentials, organization and bucket. Everything in InfluxDB is organized under a concept of an organization. The API is designed to be multi-tenant. Buckets represent where you store time series data. They're synonymous with what was previously in InfluxDB 1.x a database and retention policy.

The simplest way to get set up is to point your browser to http://localhost:8086 and go through the prompts.

You can also get set up from the CLI using the command influx setup:

$ bin/$(uname -s | tr '[:upper:]' '[:lower:]')/influx setup
Welcome to InfluxDB 2.0!
Please type your primary username: marty

Please type your password: 

Please type your password again: 

Please type your primary organization name.: InfluxData

Please type your primary bucket name.: telegraf

Please type your retention period in hours.
Or press ENTER for infinite.: 72


You have entered:
  Username:          marty
  Organization:      InfluxData
  Bucket:            telegraf
  Retention Period:  72 hrs
Confirm? (y/n): y

UserID                  Username        Organization    Bucket
033a3f2c5ccaa000        marty           InfluxData      Telegraf
Your token has been stored in /Users/marty/.influxdbv2/credentials

You can run this command non-interactively using the -f, --force flag if you are automating the setup. Some added flags can help:

$ bin/$(uname -s | tr '[:upper:]' '[:lower:]')/influx setup \
--username marty \
--password F1uxKapacit0r85 \
--org InfluxData \
--bucket telegraf \
--retention 168 \
--token where-were-going-we-dont-need-roads \
--force

Once setup is complete, a configuration profile is created to allow you to interact with your local InfluxDB without passing in credentials each time. You can list and manage those profiles using the influx config command.

$ bin/$(uname -s | tr '[:upper:]' '[:lower:]')/influx config
Active	Name	URL			            Org
*	    default	http://localhost:9999	InfluxData

Writing Data

Write to measurement m, with tag v=2, in bucket telegraf, which belongs to organization InfluxData:

$ bin/$(uname -s | tr '[:upper:]' '[:lower:]')/influx write --bucket telegraf --precision s "m v=2 $(date +%s)"

Since you have a default profile set up, you can omit the Organization and Token from the command.

Write the same point using curl:

curl --header "Authorization: Token $(bin/$(uname -s | tr '[:upper:]' '[:lower:]')/influx auth list --json | jq -r '.[0].token')" \
--data-raw "m v=2 $(date +%s)" \
"http://localhost:8086/api/v2/write?org=InfluxData&bucket=telegraf&precision=s"

Read that back with a simple Flux query:

$ bin/$(uname -s | tr '[:upper:]' '[:lower:]')/influx query 'from(bucket:"telegraf") |> range(start:-1h)'
Result: _result
Table: keys: [_start, _stop, _field, _measurement]
                   _start:time                      _stop:time           _field:string     _measurement:string                      _time:time                  _value:float
------------------------------  ------------------------------  ----------------------  ----------------------  ------------------------------  ----------------------------
2019-12-30T22:19:39.043918000Z  2019-12-30T23:19:39.043918000Z                       v                       m  2019-12-30T23:17:02.000000000Z                             2

Use the -r, --raw option to return the raw flux response from the query. This is useful for moving data from one instance to another as the influx write command can accept the Flux response using the --format csv option.

Introducing Flux

Flux is an MIT-licensed data scripting language (previously named IFQL) used for querying time series data from InfluxDB. The source for Flux is available on GitHub. Learn more about Flux from CTO Paul Dix's presentation.

Contributing to the Project

InfluxDB is an MIT licensed open source project and we love our community. The fastest way to get something fixed is to open a PR. Check out our contributing guide if you're interested in helping out. Also, join us on our Community Slack Workspace if you have questions or comments for our engineering teams.

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

End-to-End Tests

CI also runs end-to-end tests. These test the integration between the influx server the ui. You can run them locally in two steps:

  • Start the server in "testing mode" by running make run-e2e.
  • Run the tests with make e2e.