├── .codelingoignore ├── community └── ALUMNI.md ├── conf ├── schemas_test_files │ ├── empty.schemas │ ├── bad_pattern.schemas │ ├── bad_retention.schemas │ ├── no_pattern.schemas │ ├── simple.schemas │ ├── reorder_buffer.schemas │ ├── reorder_buffer_allow_update.schemas │ └── multiple.schemas └── init.go ├── vendor ├── go.opencensus.io │ └── AUTHORS ├── gopkg.in │ ├── macaron.v1 │ │ └── fixtures │ │ │ └── symlink │ ├── jcmturner │ │ ├── gokrb5.v7 │ │ │ ├── iana │ │ │ │ ├── constants.go │ │ │ │ ├── addrtype │ │ │ │ │ └── constants.go │ │ │ │ └── asnAppTag │ │ │ │ │ └── constants.go │ │ │ ├── crypto │ │ │ │ └── rfc4757 │ │ │ │ │ └── msgtype.go │ │ │ ├── types │ │ │ │ └── TypedData.go │ │ │ └── gssapi │ │ │ │ └── contextFlags.go │ │ └── rpc.v1 │ │ │ ├── mstypes │ │ │ ├── common.go │ │ │ └── user_session_key.go │ │ │ └── ndr │ │ │ └── error.go │ ├── yaml.v2 │ │ └── NOTICE │ └── alexcesaro │ │ └── statsd.v1 │ │ └── doc.go ├── google.golang.org │ ├── grpc │ │ └── AUTHORS │ ├── appengine │ │ ├── internal │ │ │ ├── main.go │ │ │ └── identity.go │ │ ├── socket │ │ │ └── doc.go │ │ ├── timeout.go │ │ └── appengine_vm.go │ └── api │ │ ├── AUTHORS │ │ └── gensupport │ │ ├── not_go18.go │ │ ├── go18.go │ │ └── doc.go ├── github.com │ ├── prometheus │ │ ├── procfs │ │ │ ├── fixtures │ │ │ │ ├── 26231 │ │ │ │ │ ├── exe │ │ │ │ │ ├── ns │ │ │ │ │ │ ├── mnt │ │ │ │ │ │ └── net │ │ │ │ │ └── fd │ │ │ │ │ │ ├── 0 │ │ │ │ │ │ ├── 1 │ │ │ │ │ │ ├── 2 │ │ │ │ │ │ ├── 3 │ │ │ │ │ │ └── 10 │ │ │ │ ├── 26232 │ │ │ │ │ └── fd │ │ │ │ │ │ ├── 0 │ │ │ │ │ │ ├── 1 │ │ │ │ │ │ ├── 2 │ │ │ │ │ │ ├── 3 │ │ │ │ │ │ └── 4 │ │ │ │ └── self │ │ │ └── NOTICE │ │ ├── client_model │ │ │ └── NOTICE │ │ └── common │ │ │ └── NOTICE │ ├── miekg │ │ └── dns │ │ │ ├── AUTHORS │ │ │ ├── CONTRIBUTORS │ │ │ ├── COPYRIGHT │ │ │ └── udp_other.go │ ├── docker │ │ ├── docker │ │ │ ├── project │ │ │ │ └── CONTRIBUTORS.md │ │ │ ├── hack │ │ │ │ ├── make │ │ │ │ │ └── .build-deb │ │ │ │ │ │ ├── docker-engine.udev │ │ │ │ │ │ ├── docker-engine.docker.init │ │ │ │ │ │ ├── docker-engine.docker.upstart │ │ │ │ │ │ └── docker-engine.docker.default │ │ │ │ └── generate-authors.sh │ │ │ ├── docs │ │ │ │ └── static_files │ │ │ │ │ └── contributors.png │ │ │ ├── client │ │ │ │ ├── client_windows.go │ │ │ │ ├── client_unix.go │ │ │ │ ├── interface_stable.go │ │ │ │ ├── secret_remove.go │ │ │ │ ├── service_remove.go │ │ │ │ ├── network_remove.go │ │ │ │ ├── plugin_set.go │ │ │ │ ├── swarm_join.go │ │ │ │ ├── container_unpause.go │ │ │ │ ├── container_pause.go │ │ │ │ ├── swarm_leave.go │ │ │ │ ├── swarm_unlock.go │ │ │ │ ├── container_rename.go │ │ │ │ ├── checkpoint_create.go │ │ │ │ ├── plugin_push.go │ │ │ │ ├── node_remove.go │ │ │ │ ├── plugin_remove.go │ │ │ │ ├── container_kill.go │ │ │ │ ├── plugin_disable.go │ │ │ │ ├── plugin_enable.go │ │ │ │ ├── network_disconnect.go │ │ │ │ ├── node_update.go │ │ │ │ ├── swarm_inspect.go │ │ │ │ ├── plugin_list.go │ │ │ │ ├── container_export.go │ │ │ │ ├── swarm_init.go │ │ │ │ ├── image_save.go │ │ │ │ ├── version.go │ │ │ │ ├── volume_remove.go │ │ │ │ ├── secret_update.go │ │ │ │ ├── network_connect.go │ │ │ │ ├── swarm_get_unlock_key.go │ │ │ │ ├── checkpoint_delete.go │ │ │ │ ├── image_history.go │ │ │ │ ├── volume_create.go │ │ │ │ ├── interface_experimental.go │ │ │ │ ├── info.go │ │ │ │ └── disk_usage.go │ │ │ ├── pkg │ │ │ │ └── tlsconfig │ │ │ │ │ └── tlsconfig_clone.go │ │ │ └── api │ │ │ │ └── types │ │ │ │ ├── time │ │ │ │ └── duration_convert.go │ │ │ │ ├── error_response.go │ │ │ │ ├── id_response.go │ │ │ │ ├── service_update_response.go │ │ │ │ ├── blkiodev │ │ │ │ └── blkio.go │ │ │ │ ├── plugin_interface_type.go │ │ │ │ ├── container │ │ │ │ ├── container_update.go │ │ │ │ └── container_wait.go │ │ │ │ ├── port.go │ │ │ │ ├── plugin_env.go │ │ │ │ └── plugin_device.go │ │ └── go-connections │ │ │ └── tlsconfig │ │ │ ├── certpool_other.go │ │ │ ├── certpool_go17.go │ │ │ ├── config_legacy_client_ciphers.go │ │ │ └── config_client_ciphers.go │ ├── mattn │ │ └── go-isatty │ │ │ ├── doc.go │ │ │ ├── isatty_others.go │ │ │ ├── isatty_tcgets.go │ │ │ ├── isatty_bsd.go │ │ │ ├── isatty_plan9.go │ │ │ └── isatty_solaris.go │ ├── matttproud │ │ └── golang_protobuf_extensions │ │ │ └── NOTICE │ ├── gocql │ │ └── gocql │ │ │ ├── debug_on.go │ │ │ ├── debug_off.go │ │ │ ├── internal │ │ │ └── murmur │ │ │ │ ├── murmur_appengine.go │ │ │ │ └── murmur_unsafe.go │ │ │ ├── cqltypes.go │ │ │ ├── doc.go │ │ │ └── fuzz.go │ ├── spf13 │ │ └── cobra │ │ │ ├── command_notwin.go │ │ │ └── command_win.go │ ├── philhofer │ │ └── fwd │ │ │ ├── writer_appengine.go │ │ │ └── writer_unsafe.go │ ├── rcrowley │ │ └── go-metrics │ │ │ ├── runtime_no_cgo.go │ │ │ ├── runtime_cgo.go │ │ │ ├── runtime_no_gccpufraction.go │ │ │ ├── runtime_gccpufraction.go │ │ │ └── metrics.go │ ├── sirupsen │ │ └── logrus │ │ │ ├── terminal_notwindows.go │ │ │ ├── terminal_check_js.go │ │ │ ├── terminal_check_appengine.go │ │ │ ├── terminal_check_notappengine.go │ │ │ ├── terminal_windows.go │ │ │ ├── terminal_check_windows.go │ │ │ └── doc.go │ ├── hashicorp │ │ ├── go-sockaddr │ │ │ ├── doc.go │ │ │ └── route_info_default.go │ │ ├── hcl │ │ │ ├── hcl │ │ │ │ └── parser │ │ │ │ │ └── error.go │ │ │ ├── hcl.go │ │ │ └── lex.go │ │ ├── memberlist │ │ │ ├── logging.go │ │ │ ├── conflict_delegate.go │ │ │ ├── merge_delegate.go │ │ │ └── alive_delegate.go │ │ └── go-multierror │ │ │ ├── format.go │ │ │ └── flatten.go │ ├── gosuri │ │ └── uilive │ │ │ ├── doc.go │ │ │ ├── writer_posix.go │ │ │ └── terminal_size_windows.go │ ├── Microsoft │ │ └── go-winio │ │ │ └── syscall.go │ ├── golang │ │ ├── protobuf │ │ │ ├── AUTHORS │ │ │ └── CONTRIBUTORS │ │ └── snappy │ │ │ ├── decode_amd64.go │ │ │ └── AUTHORS │ ├── armon │ │ └── go-metrics │ │ │ ├── const_unix.go │ │ │ └── const_windows.go │ ├── gogo │ │ └── protobuf │ │ │ ├── GOLANG_CONTRIBUTORS │ │ │ └── AUTHORS │ ├── Dieterbe │ │ └── profiletrigger │ │ │ └── procfs │ │ │ ├── NOTICE │ │ │ └── AUTHORS.md │ ├── cespare │ │ └── xxhash │ │ │ ├── xxhash_amd64.go │ │ │ └── xxhash_safe.go │ ├── kisielk │ │ └── og-rek │ │ │ └── fuzz.go │ ├── smartystreets │ │ ├── goconvey │ │ │ └── convey │ │ │ │ └── reporting │ │ │ │ ├── doc.go │ │ │ │ └── console.go │ │ └── assertions │ │ │ └── internal │ │ │ └── go-render │ │ │ └── render │ │ │ └── render_time.go │ ├── klauspost │ │ └── compress │ │ │ ├── zstd │ │ │ └── internal │ │ │ │ └── xxhash │ │ │ │ ├── xxhash_amd64.go │ │ │ │ └── xxhash_safe.go │ │ │ └── snappy │ │ │ ├── decode_amd64.go │ │ │ └── AUTHORS │ ├── tinylib │ │ └── msgp │ │ │ └── msgp │ │ │ ├── advise_other.go │ │ │ ├── purego.go │ │ │ └── advise_linux.go │ ├── xdg │ │ └── stringprep │ │ │ ├── error.go │ │ │ └── doc.go │ ├── fsnotify │ │ └── fsnotify │ │ │ ├── open_mode_bsd.go │ │ │ └── open_mode_darwin.go │ ├── google │ │ └── go-cmp │ │ │ └── cmp │ │ │ ├── internal │ │ │ ├── flags │ │ │ │ ├── toolchain_legacy.go │ │ │ │ ├── toolchain_recent.go │ │ │ │ └── flags.go │ │ │ └── diff │ │ │ │ └── debug_disable.go │ │ │ └── export_panic.go │ ├── raintank │ │ ├── met │ │ │ ├── statsd │ │ │ │ ├── count.go │ │ │ │ ├── init.go │ │ │ │ ├── meter.go │ │ │ │ └── timer.go │ │ │ └── dogstatsd │ │ │ │ ├── count.go │ │ │ │ ├── meter.go │ │ │ │ └── timer.go │ │ └── worldping-api │ │ │ └── LICENSE.md │ ├── Shopify │ │ └── sarama │ │ │ ├── tools │ │ │ └── tls │ │ │ │ └── config.go │ │ │ ├── list_groups_request.go │ │ │ ├── api_versions_request.go │ │ │ ├── response_header.go │ │ │ ├── zstd.go │ │ │ ├── config_resource_type.go │ │ │ └── heartbeat_response.go │ ├── uber │ │ └── jaeger-client-go │ │ │ └── thrift-gen │ │ │ ├── baggage │ │ │ └── constants.go │ │ │ ├── jaeger │ │ │ └── constants.go │ │ │ ├── sampling │ │ │ └── constants.go │ │ │ └── agent │ │ │ ├── constants.go │ │ │ └── ttypes.go │ ├── jtolds │ │ └── gls │ │ │ ├── gen_sym.go │ │ │ └── stack_tags_main.go │ ├── inconshreveable │ │ └── mousetrap │ │ │ ├── trap_others.go │ │ │ └── LICENSE │ ├── metrics20 │ │ └── go-metrics20 │ │ │ └── carbon20 │ │ │ ├── validationlevelm20_string.go │ │ │ └── validationlevellegacy_string.go │ ├── pelletier │ │ └── go-toml │ │ │ └── fuzz.go │ ├── sergi │ │ └── go-diff │ │ │ └── diffmatchpatch │ │ │ └── mathutil.go │ ├── googleapis │ │ └── gax-go │ │ │ └── header.go │ └── dgryski │ │ └── go-jump │ │ └── jump.go ├── golang.org │ └── x │ │ ├── net │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── http2 │ │ │ ├── not_go19.go │ │ │ ├── go16.go │ │ │ ├── go19.go │ │ │ └── not_go16.go │ │ ├── proxy │ │ │ └── direct.go │ │ └── trace │ │ │ ├── trace_go17.go │ │ │ └── trace_go16.go │ │ ├── sync │ │ ├── AUTHORS │ │ └── CONTRIBUTORS │ │ ├── sys │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── unix │ │ │ ├── endian_big.go │ │ │ ├── endian_little.go │ │ │ ├── constants.go │ │ │ ├── syscall_linux_amd64_gc.go │ │ │ ├── aliases.go │ │ │ ├── pagesize_unix.go │ │ │ ├── fcntl_linux_32bit.go │ │ │ ├── asm_solaris_amd64.s │ │ │ ├── gccgo_linux_amd64.go │ │ │ ├── syscall_linux_gc.go │ │ │ ├── race0.go │ │ │ ├── syscall_solaris_amd64.go │ │ │ ├── syscall_linux_gc_386.go │ │ │ ├── syscall_unix_gc.go │ │ │ ├── dirent.go │ │ │ └── syscall_linux_gccgo_arm.go │ │ └── windows │ │ │ ├── mksyscall.go │ │ │ ├── aliases.go │ │ │ ├── asm_windows_arm.s │ │ │ ├── asm_windows_386.s │ │ │ ├── asm_windows_amd64.s │ │ │ ├── race0.go │ │ │ ├── types_windows_386.go │ │ │ ├── types_windows_amd64.go │ │ │ ├── types_windows_arm.go │ │ │ ├── str.go │ │ │ └── env_windows.go │ │ ├── text │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── language │ │ │ ├── go1_2.go │ │ │ ├── common.go │ │ │ └── gen_common.go │ │ └── secure │ │ │ └── bidirule │ │ │ ├── bidirule10.0.0.go │ │ │ └── bidirule9.0.0.go │ │ ├── time │ │ ├── AUTHORS │ │ └── CONTRIBUTORS │ │ ├── crypto │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ └── ssh │ │ │ └── terminal │ │ │ ├── util_linux.go │ │ │ └── util_bsd.go │ │ └── oauth2 │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── internal │ │ ├── doc.go │ │ └── client_appengine.go │ │ └── google │ │ ├── appengineflex_hook.go │ │ └── appengine_hook.go └── cloud.google.com │ └── go │ └── AUTHORS ├── api ├── response │ ├── init_test.go │ └── csv.go ├── models │ ├── request_gen_test.go │ ├── init_test.go │ └── pointslicepool.go ├── middleware │ ├── cluster.go │ └── capturebody.go ├── init.go └── seriescycle │ └── seriescycle.go ├── docker ├── docker-dev-custom-cfg-kafka │ ├── gw │ │ └── auth.ini │ ├── grafana-datasources │ │ ├── monitoring.yaml │ │ ├── graphite.yaml │ │ └── metrictank.yaml │ └── caddy │ │ └── Caddyfile ├── docker-cluster │ ├── graphite-storage-schemas.conf │ └── grafana-datasources │ │ ├── monitoring.yaml │ │ ├── graphite.yaml │ │ └── metrictank.yaml ├── docker-cluster-query │ ├── graphite-storage-schemas.conf │ └── grafana-datasources │ │ ├── monitoring.yaml │ │ ├── graphite.yaml │ │ └── metrictank.yaml ├── docker-dev │ └── grafana-datasources │ │ ├── monitoring.yaml │ │ ├── graphite.yaml │ │ └── metrictank.yaml ├── cfg │ ├── grafana-dashboards-main │ │ └── config.yaml │ ├── grafana-dashboards-main-extra │ │ └── config.yaml │ └── grafana-dashboards-main-extra-dockprom │ │ └── config.yaml ├── docker-chaos │ └── grafana-datasources │ │ ├── graphite.yaml │ │ ├── monitoring.yaml │ │ └── metrictank.yaml ├── docker-dev-debug │ └── grafana-datasources │ │ ├── graphite.yaml │ │ └── metrictank.yaml ├── docker-standard │ └── grafana-datasources │ │ ├── graphite.yaml │ │ └── metrictank.yaml ├── docker-dev-bigtable │ └── grafana-datasources │ │ ├── graphite.yaml │ │ └── metrictank.yaml └── docker-dev-scylla │ └── grafana-datasources │ ├── graphite.yaml │ └── metrictank.yaml ├── docs ├── assets │ ├── dashboard-top.png │ ├── dashboard-bottom.png │ ├── metrictank-logo.png │ ├── dashboard-screenshot.png │ └── metrictank-highlevel.png ├── roadmap.md ├── overview.md └── kafka.md ├── schema ├── archive_gen_test.go ├── point.go ├── reslice.go ├── LICENSE ├── control.go └── metric_serialization_json_test.go ├── benchmarks ├── cluster-queries │ ├── run-alerting.sh │ ├── alerting-input │ ├── run.sh │ └── run-exploration.sh ├── simulate-lock-congestion │ ├── README.md │ └── gnuplot.sh └── ingest-backfill-speed.sh ├── scripts ├── config │ ├── sysvinit │ │ └── default │ │ │ └── metrictank │ ├── systemd │ │ └── metrictank.service │ ├── schema-store-cassandra.toml │ └── schema-store-scylladb.toml ├── Gemfile ├── qa │ ├── vendor.sh │ ├── misspell.sh │ ├── ineffassign.sh │ ├── gofmt.sh │ └── vet-high-confidence.sh ├── k8s │ └── Dockerfile ├── depends.sh ├── qa-subjective │ ├── vet.sh │ ├── errcheck.sh │ ├── golint.sh │ └── cyclo.sh ├── k8s_dlv │ └── Dockerfile ├── version-tag.sh ├── README.md ├── push │ ├── gcr.sh │ └── dockerhub.sh └── dev │ └── tools-to-doc.sh ├── consolidation ├── consolidation_gen_test.go └── LICENSE.TXT ├── codelingo.yaml ├── mdata ├── chunk │ ├── tsz │ │ ├── iter.go │ │ └── finish.go │ └── format.go ├── errors │ └── errors.go ├── cache │ ├── accnt │ │ └── sort_uint32.go │ └── ccache_chunk.go ├── helper.go └── result.go ├── stacktest ├── README.md └── tests │ ├── end2end_carbon │ └── notes │ ├── end2end_carbon_bigtable │ └── notes │ ├── chaos_cluster │ └── notes │ └── predictable-tag-query-render-workload │ └── README.md ├── expr ├── init_test.go ├── tagquery │ └── utils.go ├── func_mock_test.go ├── func_group.go └── pool.go ├── MAINTAINERS.md ├── devdocs └── tracing.md ├── cluster ├── traceable.go ├── if.go └── partitioner │ └── partitioner.go ├── cmd ├── mt-store-cat │ └── time.go └── mt-fakemetrics │ ├── cmd │ ├── version.go │ └── getbuilder.go │ └── out │ └── saramahelper.go ├── util ├── compression.go ├── helper.go └── util_test.go ├── test ├── tracer.go └── path.go ├── stats └── out_devnull.go ├── .github └── ISSUE_TEMPLATE │ └── bug_report.md ├── batch └── LICENSE.TXT ├── input └── plugin.go └── idx └── memory └── stats.go /.codelingoignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | -------------------------------------------------------------------------------- /community/ALUMNI.md: -------------------------------------------------------------------------------- 1 | # Alumni 2 | -------------------------------------------------------------------------------- /conf/schemas_test_files/empty.schemas: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/go.opencensus.io/AUTHORS: -------------------------------------------------------------------------------- 1 | Google Inc. 2 | -------------------------------------------------------------------------------- /vendor/gopkg.in/macaron.v1/fixtures/symlink: -------------------------------------------------------------------------------- 1 | basic -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/AUTHORS: -------------------------------------------------------------------------------- 1 | Google Inc. 2 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/fixtures/self: -------------------------------------------------------------------------------- 1 | 26231 -------------------------------------------------------------------------------- /api/response/init_test.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | var size int 4 | -------------------------------------------------------------------------------- /vendor/github.com/miekg/dns/AUTHORS: -------------------------------------------------------------------------------- 1 | Miek Gieben 2 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/fixtures/26231/exe: -------------------------------------------------------------------------------- 1 | /usr/bin/vim -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/project/CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | ../CONTRIBUTING.md -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/fixtures/26231/ns/mnt: -------------------------------------------------------------------------------- 1 | mnt:[4026531840] -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/fixtures/26231/ns/net: -------------------------------------------------------------------------------- 1 | net:[4026531993] -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/fixtures/26231/fd/0: -------------------------------------------------------------------------------- 1 | ../../symlinktargets/abc -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/fixtures/26231/fd/1: -------------------------------------------------------------------------------- 1 | ../../symlinktargets/def -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/fixtures/26231/fd/10: -------------------------------------------------------------------------------- 1 | ../../symlinktargets/xyz -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/fixtures/26231/fd/2: -------------------------------------------------------------------------------- 1 | ../../symlinktargets/ghi -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/fixtures/26231/fd/3: -------------------------------------------------------------------------------- 1 | ../../symlinktargets/uvw -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/fixtures/26232/fd/0: -------------------------------------------------------------------------------- 1 | ../../symlinktargets/abc -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/fixtures/26232/fd/1: -------------------------------------------------------------------------------- 1 | ../../symlinktargets/def -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/fixtures/26232/fd/2: -------------------------------------------------------------------------------- 1 | ../../symlinktargets/ghi -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/fixtures/26232/fd/3: -------------------------------------------------------------------------------- 1 | ../../symlinktargets/uvw -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/fixtures/26232/fd/4: -------------------------------------------------------------------------------- 1 | ../../symlinktargets/xyz -------------------------------------------------------------------------------- /docker/docker-dev-custom-cfg-kafka/gw/auth.ini: -------------------------------------------------------------------------------- 1 | [deadbeef] 2 | orgId = 1 3 | isAdmin = false 4 | -------------------------------------------------------------------------------- /conf/schemas_test_files/bad_pattern.schemas: -------------------------------------------------------------------------------- 1 | [default] 2 | pattern = **** 3 | retentions = 1s:8d:10min:2 -------------------------------------------------------------------------------- /conf/schemas_test_files/bad_retention.schemas: -------------------------------------------------------------------------------- 1 | [default] 2 | pattern = .* 3 | retentions = 1s::10min:2 -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/hack/make/.build-deb/docker-engine.udev: -------------------------------------------------------------------------------- 1 | ../../../contrib/udev/80-docker.rules -------------------------------------------------------------------------------- /docs/assets/dashboard-top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grafana/metrictank/HEAD/docs/assets/dashboard-top.png -------------------------------------------------------------------------------- /schema/archive_gen_test.go: -------------------------------------------------------------------------------- 1 | package schema 2 | 3 | // Code generated by github.com/tinylib/msgp DO NOT EDIT. 4 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/doc.go: -------------------------------------------------------------------------------- 1 | // Package isatty implements interface to isatty 2 | package isatty 3 | -------------------------------------------------------------------------------- /api/models/request_gen_test.go: -------------------------------------------------------------------------------- 1 | package models 2 | 3 | // Code generated by github.com/tinylib/msgp DO NOT EDIT. 4 | -------------------------------------------------------------------------------- /docs/assets/dashboard-bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grafana/metrictank/HEAD/docs/assets/dashboard-bottom.png -------------------------------------------------------------------------------- /docs/assets/metrictank-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grafana/metrictank/HEAD/docs/assets/metrictank-logo.png -------------------------------------------------------------------------------- /docs/roadmap.md: -------------------------------------------------------------------------------- 1 | # Roadmap 2 | 3 | See [the roadmap issue](https://github.com/grafana/metrictank/issues/1319) 4 | 5 | -------------------------------------------------------------------------------- /vendor/github.com/matttproud/golang_protobuf_extensions/NOTICE: -------------------------------------------------------------------------------- 1 | Copyright 2012 Matt T. Proud (matt.proud@gmail.com) 2 | -------------------------------------------------------------------------------- /benchmarks/cluster-queries/run-alerting.sh: -------------------------------------------------------------------------------- 1 | cat alerting-input | vegeta attack -rate 20 -duration 30s > alerting-out 2 | -------------------------------------------------------------------------------- /conf/schemas_test_files/no_pattern.schemas: -------------------------------------------------------------------------------- 1 | [default] 2 | retentions = 1s:8d:10min:2,1m:35d:2h:2,10m:120d:6h:2,1h:2y:6h:2 -------------------------------------------------------------------------------- /scripts/config/sysvinit/default/metrictank: -------------------------------------------------------------------------------- 1 | user="root" 2 | group="root" 3 | chroot="/" 4 | chdir="/" 5 | nice="" 6 | 7 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/hack/make/.build-deb/docker-engine.docker.init: -------------------------------------------------------------------------------- 1 | ../../../contrib/init/sysvinit-debian/docker -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/hack/make/.build-deb/docker-engine.docker.upstart: -------------------------------------------------------------------------------- 1 | ../../../contrib/init/upstart/docker.conf -------------------------------------------------------------------------------- /vendor/github.com/gocql/gocql/debug_on.go: -------------------------------------------------------------------------------- 1 | // +build gocql_debug 2 | 3 | package gocql 4 | 5 | const gocqlDebug = true 6 | -------------------------------------------------------------------------------- /docs/assets/dashboard-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grafana/metrictank/HEAD/docs/assets/dashboard-screenshot.png -------------------------------------------------------------------------------- /docs/assets/metrictank-highlevel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grafana/metrictank/HEAD/docs/assets/metrictank-highlevel.png -------------------------------------------------------------------------------- /schema/point.go: -------------------------------------------------------------------------------- 1 | package schema 2 | 3 | //go:generate msgp 4 | type Point struct { 5 | Val float64 6 | Ts uint32 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/gocql/gocql/debug_off.go: -------------------------------------------------------------------------------- 1 | // +build !gocql_debug 2 | 3 | package gocql 4 | 5 | const gocqlDebug = false 6 | -------------------------------------------------------------------------------- /conf/schemas_test_files/simple.schemas: -------------------------------------------------------------------------------- 1 | [default] 2 | pattern = .* 3 | retentions = 1s:8d:10min:2,1m:35d:2h:2,10m:120d:6h:2,1h:2y:6h:2 -------------------------------------------------------------------------------- /consolidation/consolidation_gen_test.go: -------------------------------------------------------------------------------- 1 | package consolidation 2 | 3 | // Code generated by github.com/tinylib/msgp DO NOT EDIT. 4 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/hack/make/.build-deb/docker-engine.docker.default: -------------------------------------------------------------------------------- 1 | ../../../contrib/init/sysvinit-debian/docker.default -------------------------------------------------------------------------------- /codelingo.yaml: -------------------------------------------------------------------------------- 1 | tenets: 2 | - import: codelingo/go 3 | - import: codelingo/effective-go 4 | - import: codelingo/code-review-comments 5 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cobra/command_notwin.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package cobra 4 | 5 | var preExecHookFn func(*Command) 6 | -------------------------------------------------------------------------------- /mdata/chunk/tsz/iter.go: -------------------------------------------------------------------------------- 1 | package tsz 2 | 3 | type Iter interface { 4 | Next() bool 5 | Values() (uint32, float64) 6 | Err() error 7 | } 8 | -------------------------------------------------------------------------------- /scripts/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem "fpm", "~> 1.4" 4 | gem "package_cloud", "~> 0.2" 5 | gem "ffi", ">= 1.9.24" 6 | -------------------------------------------------------------------------------- /stacktest/README.md: -------------------------------------------------------------------------------- 1 | here are various go tests that spin up metrictank via a docker stack and assert correct function 2 | 3 | see tests directory 4 | -------------------------------------------------------------------------------- /vendor/github.com/philhofer/fwd/writer_appengine.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | package fwd 4 | 5 | func unsafestr(s string) []byte { return []byte(s) } 6 | -------------------------------------------------------------------------------- /conf/schemas_test_files/reorder_buffer.schemas: -------------------------------------------------------------------------------- 1 | [default] 2 | pattern = .* 3 | retentions = 1s:8d:10min:2,1m:35d:2h:2,10m:120d:6h:2,1h:2y:6h:2 4 | reorderBuffer = 20 -------------------------------------------------------------------------------- /vendor/github.com/rcrowley/go-metrics/runtime_no_cgo.go: -------------------------------------------------------------------------------- 1 | // +build !cgo appengine 2 | 3 | package metrics 4 | 5 | func numCgoCall() int64 { 6 | return 0 7 | } 8 | -------------------------------------------------------------------------------- /expr/init_test.go: -------------------------------------------------------------------------------- 1 | package expr 2 | 3 | import "github.com/grafana/metrictank/pointslicepool" 4 | 5 | func init() { 6 | pointSlicePool = pointslicepool.New(100) 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/terminal_notwindows.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package logrus 4 | 5 | import "io" 6 | 7 | func initTerminal(w io.Writer) { 8 | } 9 | -------------------------------------------------------------------------------- /MAINTAINERS.md: -------------------------------------------------------------------------------- 1 | This project does not have any active maintainers. Questions about unarchiving 2 | the repository or making changes should be sent to 3 | query@grafana.com. 4 | 5 | -------------------------------------------------------------------------------- /api/models/init_test.go: -------------------------------------------------------------------------------- 1 | package models 2 | 3 | import "github.com/grafana/metrictank/pointslicepool" 4 | 5 | func init() { 6 | pointSlicePool = pointslicepool.New(100) 7 | } 8 | -------------------------------------------------------------------------------- /devdocs/tracing.md: -------------------------------------------------------------------------------- 1 | guidelines: 2 | 3 | * set `error` tag true, if there was a system error 4 | * set `error` log entries, for system or user error 5 | * name spans after `type.method` 6 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/docs/static_files/contributors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grafana/metrictank/HEAD/vendor/github.com/docker/docker/docs/static_files/contributors.png -------------------------------------------------------------------------------- /docker/docker-cluster/graphite-storage-schemas.conf: -------------------------------------------------------------------------------- 1 | # https://graphite.readthedocs.io/en/latest/config-carbon.html#storage-schemas-conf 2 | [default] 3 | pattern = .* 4 | retentions = 1s:1d 5 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-sockaddr/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package sockaddr is a Go implementation of the UNIX socket family data types and 3 | related helper functions. 4 | */ 5 | package sockaddr 6 | -------------------------------------------------------------------------------- /vendor/gopkg.in/jcmturner/gokrb5.v7/iana/constants.go: -------------------------------------------------------------------------------- 1 | // Package iana provides Kerberos 5 assigned numbers. 2 | package iana 3 | 4 | // PVNO is the Protocol Version Number. 5 | const PVNO = 5 6 | -------------------------------------------------------------------------------- /docker/docker-cluster-query/graphite-storage-schemas.conf: -------------------------------------------------------------------------------- 1 | # https://graphite.readthedocs.io/en/latest/config-carbon.html#storage-schemas-conf 2 | [default] 3 | pattern = .* 4 | retentions = 1s:1d 5 | -------------------------------------------------------------------------------- /vendor/github.com/gosuri/uilive/doc.go: -------------------------------------------------------------------------------- 1 | // Package uilive provides a writer that live updates the terminal. It provides a buffered io.Writer that is flushed at a timed interval. 2 | package uilive 3 | -------------------------------------------------------------------------------- /conf/schemas_test_files/reorder_buffer_allow_update.schemas: -------------------------------------------------------------------------------- 1 | [default] 2 | pattern = .* 3 | retentions = 1s:8d:10min:2,1m:35d:2h:2,10m:120d:6h:2,1h:2y:6h:2 4 | reorderBuffer = 20 5 | reorderBufferAllowUpdate = true -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/terminal_check_js.go: -------------------------------------------------------------------------------- 1 | // +build js 2 | 3 | package logrus 4 | 5 | import ( 6 | "io" 7 | ) 8 | 9 | func checkIfTerminal(w io.Writer) bool { 10 | return false 11 | } 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sync/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/time/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /cluster/traceable.go: -------------------------------------------------------------------------------- 1 | package cluster 2 | 3 | import opentracing "github.com/opentracing/opentracing-go" 4 | 5 | type Traceable interface { 6 | Trace(span opentracing.Span) 7 | TraceDebug(span opentracing.Span) 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/Microsoft/go-winio/syscall.go: -------------------------------------------------------------------------------- 1 | package winio 2 | 3 | //go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zsyscall_windows.go file.go pipe.go sd.go fileinfo.go privilege.go backup.go 4 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/client_windows.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | // DefaultDockerHost defines os specific default if DOCKER_HOST is unset 4 | const DefaultDockerHost = "npipe:////./pipe/docker_engine" 5 | -------------------------------------------------------------------------------- /vendor/github.com/miekg/dns/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Alex A. Skinner 2 | Andrew Tunnell-Jones 3 | Ask Bjørn Hansen 4 | Dave Cheney 5 | Dusty Wilson 6 | Marek Majkowski 7 | Peter van Dijk 8 | Omri Bahumi 9 | Alex Sergeyev 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at https://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at https://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/oauth2/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/oauth2/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sync/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/time/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/terminal_check_appengine.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | package logrus 4 | 5 | import ( 6 | "io" 7 | ) 8 | 9 | func checkIfTerminal(w io.Writer) bool { 10 | return true 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/rcrowley/go-metrics/runtime_cgo.go: -------------------------------------------------------------------------------- 1 | // +build cgo 2 | // +build !appengine 3 | 4 | package metrics 5 | 6 | import "runtime" 7 | 8 | func numCgoCall() int64 { 9 | return runtime.NumCgoCall() 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/rcrowley/go-metrics/runtime_no_gccpufraction.go: -------------------------------------------------------------------------------- 1 | // +build !go1.5 2 | 3 | package metrics 4 | 5 | import "runtime" 6 | 7 | func gcCPUFraction(memStats *runtime.MemStats) float64 { 8 | return 0 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/client_model/NOTICE: -------------------------------------------------------------------------------- 1 | Data model artifacts for Prometheus. 2 | Copyright 2012-2015 The Prometheus Authors 3 | 4 | This product includes software developed at 5 | SoundCloud Ltd. (http://soundcloud.com/). 6 | -------------------------------------------------------------------------------- /scripts/qa/vendor.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # checks whether vendor directory is healthy 5 | 6 | export GO111MODULE=off 7 | go get -u github.com/golang/dep/cmd/dep 8 | 9 | dep version 10 | dep status 11 | dep check 12 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/common/NOTICE: -------------------------------------------------------------------------------- 1 | Common libraries shared by Prometheus Go components. 2 | Copyright 2015 The Prometheus Authors 3 | 4 | This product includes software developed at 5 | SoundCloud Ltd. (http://soundcloud.com/). 6 | -------------------------------------------------------------------------------- /scripts/k8s/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM grafana/metrictank 2 | RUN apk add --no-cache curl jq ca-certificates python py-pip 3 | RUN pip install kazoo 4 | COPY entrypoint.sh /entrypoint.sh 5 | COPY getOffset.py /getOffset.py 6 | ENTRYPOINT ["/entrypoint.sh"] 7 | -------------------------------------------------------------------------------- /vendor/github.com/rcrowley/go-metrics/runtime_gccpufraction.go: -------------------------------------------------------------------------------- 1 | // +build go1.5 2 | 3 | package metrics 4 | 5 | import "runtime" 6 | 7 | func gcCPUFraction(memStats *runtime.MemStats) float64 { 8 | return memStats.GCCPUFraction 9 | } 10 | -------------------------------------------------------------------------------- /mdata/errors/errors.go: -------------------------------------------------------------------------------- 1 | package errors 2 | 3 | import ( 4 | "errors" 5 | ) 6 | 7 | var ( 8 | ErrMetricTooOld = errors.New("metric too old") 9 | ErrMetricNewValueForTimestamp = errors.New("new value for existing timestamp") 10 | ) 11 | -------------------------------------------------------------------------------- /scripts/depends.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -x 3 | set -e 4 | # Find the directory we exist within 5 | DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 6 | cd ${DIR} 7 | 8 | which bundle &>/dev/null || sudo gem install bundler 9 | bundle install 10 | -------------------------------------------------------------------------------- /vendor/github.com/armon/go-metrics/const_unix.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package metrics 4 | 5 | import ( 6 | "syscall" 7 | ) 8 | 9 | const ( 10 | // DefaultSignal is used with DefaultInmemSignal 11 | DefaultSignal = syscall.SIGUSR1 12 | ) 13 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/client_unix.go: -------------------------------------------------------------------------------- 1 | // +build linux freebsd solaris openbsd darwin 2 | 3 | package client 4 | 5 | // DefaultDockerHost defines os specific default if DOCKER_HOST is unset 6 | const DefaultDockerHost = "unix:///var/run/docker.sock" 7 | -------------------------------------------------------------------------------- /docker/docker-dev/grafana-datasources/monitoring.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | datasources: 3 | - name: Prometheus 4 | type: prometheus 5 | access: proxy 6 | orgId: 1 7 | url: http://prometheus:9090 8 | isDefault: false 9 | version: 1 10 | editable: true 11 | -------------------------------------------------------------------------------- /docker/cfg/grafana-dashboards-main/config.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | providers: 4 | - name: 'main' 5 | orgId: 1 6 | folder: '' 7 | type: file 8 | disableDeletion: true 9 | updateIntervalSeconds: 3 10 | options: 11 | path: /var/lib/grafana/dashboards/main 12 | -------------------------------------------------------------------------------- /vendor/github.com/gogo/protobuf/GOLANG_CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | The contributors to the Go protobuf repository: 2 | 3 | # This source code was written by the Go contributors. 4 | # The master list of contributors is in the main Go distribution, 5 | # visible at http://tip.golang.org/CONTRIBUTORS. -------------------------------------------------------------------------------- /scripts/qa-subjective/vet.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # runs all of the "go vet" checks 4 | 5 | # find the dir we exist within... 6 | DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 7 | # and cd into root project dir 8 | cd ${DIR}/../.. 9 | 10 | GO111MODULE=off go vet ./... 11 | -------------------------------------------------------------------------------- /mdata/cache/accnt/sort_uint32.go: -------------------------------------------------------------------------------- 1 | package accnt 2 | 3 | type Uint32Asc []uint32 4 | 5 | func (su Uint32Asc) Len() int { return len(su) } 6 | func (su Uint32Asc) Swap(i, j int) { su[i], su[j] = su[j], su[i] } 7 | func (su Uint32Asc) Less(i, j int) bool { return su[i] < su[j] } 8 | -------------------------------------------------------------------------------- /stacktest/tests/end2end_carbon/notes: -------------------------------------------------------------------------------- 1 | on my laptop: 2 | replay: 20s startup + 30s wait + 10s test + 5s shutdown = 1m05 3 | me: 20s startup + 8s test + 5 shutdown = 33s 4 | 5 | circle: 6 | me: startup 59/66s + 8/7s test + 50s = 121/122s 7 | replay: startup 43s + 40s test + 3s shutdown = 86s 8 | -------------------------------------------------------------------------------- /cmd/mt-store-cat/time.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "time" 6 | ) 7 | 8 | func printTimeUnix(ts uint32) string { 9 | return fmt.Sprintf("%d", ts) 10 | } 11 | 12 | func printTimeFormatted(ts uint32) string { 13 | return time.Unix(int64(ts), 0).Format(tsFormat) 14 | } 15 | -------------------------------------------------------------------------------- /stacktest/tests/end2end_carbon_bigtable/notes: -------------------------------------------------------------------------------- 1 | on my laptop: 2 | replay: 20s startup + 30s wait + 10s test + 5s shutdown = 1m05 3 | me: 20s startup + 8s test + 5 shutdown = 33s 4 | 5 | circle: 6 | me: startup 59/66s + 8/7s test + 50s = 121/122s 7 | replay: startup 43s + 40s test + 3s shutdown = 86s 8 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/NOTICE: -------------------------------------------------------------------------------- 1 | procfs provides functions to retrieve system, kernel and process 2 | metrics from the pseudo-filesystem proc. 3 | 4 | Copyright 2014-2015 The Prometheus Authors 5 | 6 | This product includes software developed at 7 | SoundCloud Ltd. (http://soundcloud.com/). 8 | -------------------------------------------------------------------------------- /conf/schemas_test_files/multiple.schemas: -------------------------------------------------------------------------------- 1 | [raw] 2 | pattern = fakemetrics.raw 3 | retentions = 1s:6h:2min:2 4 | 5 | [default] 6 | pattern = .* 7 | retentions = 1s:8d:10min:2,1m:35d:2h:2,10m:120d:6h:2,1h:2y:6h:2 8 | 9 | [wpUsageMetrics] 10 | pattern = ^wp-usage 11 | retentions = 1h:35d:6h:2,2h:2y:6h:2 -------------------------------------------------------------------------------- /docker/docker-dev/grafana-datasources/graphite.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | datasources: 3 | - name: graphite 4 | type: graphite 5 | access: proxy 6 | orgId: 1 7 | url: http://graphite 8 | isDefault: false 9 | jsonData: 10 | graphiteVersion: "1.1" 11 | version: 1 12 | editable: true 13 | -------------------------------------------------------------------------------- /vendor/github.com/armon/go-metrics/const_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package metrics 4 | 5 | import ( 6 | "syscall" 7 | ) 8 | 9 | const ( 10 | // DefaultSignal is used with DefaultInmemSignal 11 | // Windows has no SIGUSR1, use SIGBREAK 12 | DefaultSignal = syscall.Signal(21) 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/oauth2/internal/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package internal contains support packages for oauth2 package. 6 | package internal 7 | -------------------------------------------------------------------------------- /benchmarks/cluster-queries/alerting-input: -------------------------------------------------------------------------------- 1 | GET http://localhost:6061/render?target=some.id.of.a.metric.1*;id=*;some=tag&from=-30s 2 | GET http://localhost:6061/render?target=some.id.of.a.metric.22*;id=*;some=tag&from=-60s 3 | GET http://localhost:6061/render?target=some.id.of.a.metric.33*;id=*;some=tag&from=-1h 4 | -------------------------------------------------------------------------------- /docker/docker-chaos/grafana-datasources/graphite.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | datasources: 3 | - name: graphite 4 | type: graphite 5 | access: proxy 6 | orgId: 1 7 | url: http://graphite 8 | isDefault: false 9 | jsonData: 10 | graphiteVersion: "1.1" 11 | version: 1 12 | editable: true 13 | -------------------------------------------------------------------------------- /docker/docker-dev-debug/grafana-datasources/graphite.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | datasources: 3 | - name: graphite 4 | type: graphite 5 | access: proxy 6 | orgId: 1 7 | url: http://graphite 8 | isDefault: false 9 | jsonData: 10 | graphiteVersion: "1.1" 11 | version: 1 12 | editable: true 13 | -------------------------------------------------------------------------------- /docker/docker-standard/grafana-datasources/graphite.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | datasources: 3 | - name: graphite 4 | type: graphite 5 | access: proxy 6 | orgId: 1 7 | url: http://graphite 8 | isDefault: false 9 | jsonData: 10 | graphiteVersion: "1.1" 11 | version: 1 12 | editable: true 13 | -------------------------------------------------------------------------------- /docker/docker-chaos/grafana-datasources/monitoring.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | datasources: 3 | - name: monitoring 4 | type: graphite 5 | access: proxy 6 | orgId: 1 7 | url: http://graphitemon 8 | isDefault: false 9 | jsonData: 10 | graphiteVersion: "1.1" 11 | version: 1 12 | editable: true 13 | -------------------------------------------------------------------------------- /docker/docker-dev-bigtable/grafana-datasources/graphite.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | datasources: 3 | - name: graphite 4 | type: graphite 5 | access: proxy 6 | orgId: 1 7 | url: http://graphite 8 | isDefault: false 9 | jsonData: 10 | graphiteVersion: "1.1" 11 | version: 1 12 | editable: true 13 | -------------------------------------------------------------------------------- /docker/docker-dev-scylla/grafana-datasources/graphite.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | datasources: 3 | - name: graphite 4 | type: graphite 5 | access: proxy 6 | orgId: 1 7 | url: http://graphite 8 | isDefault: false 9 | jsonData: 10 | graphiteVersion: "1.1" 11 | version: 1 12 | editable: true 13 | -------------------------------------------------------------------------------- /vendor/github.com/Dieterbe/profiletrigger/procfs/NOTICE: -------------------------------------------------------------------------------- 1 | procfs provides functions to retrieve system, kernel and process 2 | metrics from the pseudo-filesystem proc. 3 | 4 | Copyright 2014-2015 The Prometheus Authors 5 | 6 | This product includes software developed at 7 | SoundCloud Ltd. (http://soundcloud.com/). 8 | -------------------------------------------------------------------------------- /vendor/gopkg.in/jcmturner/rpc.v1/mstypes/common.go: -------------------------------------------------------------------------------- 1 | package mstypes 2 | 3 | // LPWSTR implements https://msdn.microsoft.com/en-us/library/cc230355.aspx 4 | type LPWSTR struct { 5 | Value string `ndr:"pointer,conformant,varying"` 6 | } 7 | 8 | func (s *LPWSTR) String() string { 9 | return s.Value 10 | } 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/endian_big.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | // 5 | // +build ppc64 s390x mips mips64 6 | 7 | package unix 8 | 9 | const isBigEndian = true 10 | -------------------------------------------------------------------------------- /vendor/github.com/cespare/xxhash/xxhash_amd64.go: -------------------------------------------------------------------------------- 1 | // +build !appengine 2 | // +build gc 3 | // +build !purego 4 | 5 | package xxhash 6 | 7 | // Sum64 computes the 64-bit xxHash digest of b. 8 | // 9 | //go:noescape 10 | func Sum64(b []byte) uint64 11 | 12 | //go:noescape 13 | func writeBlocks(*Digest, []byte) int 14 | -------------------------------------------------------------------------------- /vendor/github.com/kisielk/og-rek/fuzz.go: -------------------------------------------------------------------------------- 1 | // +build gofuzz 2 | 3 | package ogórek 4 | 5 | import ( 6 | "bytes" 7 | ) 8 | 9 | func Fuzz(data []byte) int { 10 | buf := bytes.NewBuffer(data) 11 | dec := NewDecoder(buf) 12 | _, err := dec.Decode() 13 | if err != nil { 14 | return 0 15 | } 16 | return 1 17 | } 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/language/go1_2.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.2 6 | 7 | package language 8 | 9 | import "sort" 10 | 11 | var sortStable = sort.Stable 12 | -------------------------------------------------------------------------------- /vendor/github.com/smartystreets/goconvey/convey/reporting/doc.go: -------------------------------------------------------------------------------- 1 | // Package reporting contains internal functionality related 2 | // to console reporting and output. Although this package has 3 | // exported names is not intended for public consumption. See the 4 | // examples package for how to use this project. 5 | package reporting 6 | -------------------------------------------------------------------------------- /vendor/github.com/gocql/gocql/internal/murmur/murmur_appengine.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | package murmur 4 | 5 | import "encoding/binary" 6 | 7 | func getBlock(data []byte, n int) (int64, int64) { 8 | k1 := binary.LittleEndian.Int64(data[n*16:]) 9 | k2 := binary.LittleEndian.Int64(data[(n*16)+8:]) 10 | return k1, k2 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/gocql/gocql/internal/murmur/murmur_unsafe.go: -------------------------------------------------------------------------------- 1 | // +build !appengine 2 | 3 | package murmur 4 | 5 | import ( 6 | "unsafe" 7 | ) 8 | 9 | func getBlock(data []byte, n int) (int64, int64) { 10 | block := (*[2]int64)(unsafe.Pointer(&data[n*16])) 11 | 12 | k1 := block[0] 13 | k2 := block[1] 14 | return k1, k2 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.go: -------------------------------------------------------------------------------- 1 | // +build !appengine 2 | // +build gc 3 | // +build !purego 4 | 5 | package xxhash 6 | 7 | // Sum64 computes the 64-bit xxHash digest of b. 8 | // 9 | //go:noescape 10 | func Sum64(b []byte) uint64 11 | 12 | //go:noescape 13 | func writeBlocks(*Digest, []byte) int 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/endian_little.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | // 5 | // +build 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le 6 | 7 | package unix 8 | 9 | const isBigEndian = false 10 | -------------------------------------------------------------------------------- /docker/docker-chaos/grafana-datasources/metrictank.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | datasources: 3 | - name: metrictank 4 | type: graphite 5 | access: proxy 6 | orgId: 1 7 | url: http://metrictank0:6060 8 | isDefault: true 9 | jsonData: 10 | graphiteVersion: "1.1" 11 | graphiteType: "metrictank" 12 | version: 1 13 | editable: true 14 | -------------------------------------------------------------------------------- /docker/docker-dev/grafana-datasources/metrictank.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | datasources: 3 | - name: metrictank 4 | type: graphite 5 | access: proxy 6 | orgId: 1 7 | url: http://metrictank:6060 8 | isDefault: true 9 | jsonData: 10 | graphiteVersion: "1.1" 11 | graphiteType: "metrictank" 12 | version: 1 13 | editable: true 14 | -------------------------------------------------------------------------------- /util/compression.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import ( 4 | "compress/gzip" 5 | "io" 6 | "io/ioutil" 7 | ) 8 | 9 | func DecompressGzip(r io.Reader) (string, error) { 10 | reader, err := gzip.NewReader(r) 11 | if err != nil { 12 | return "", err 13 | } 14 | 15 | unzipped, err := ioutil.ReadAll(reader) 16 | return string(unzipped), err 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/interface_stable.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | // APIClient is an interface that clients that talk with a docker server must implement. 4 | type APIClient interface { 5 | CommonAPIClient 6 | apiClientExperimental 7 | } 8 | 9 | // Ensure that Client always implements APIClient. 10 | var _ APIClient = &Client{} 11 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/secret_remove.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import "golang.org/x/net/context" 4 | 5 | // SecretRemove removes a Secret. 6 | func (cli *Client) SecretRemove(ctx context.Context, id string) error { 7 | resp, err := cli.delete(ctx, "/secrets/"+id, nil, nil) 8 | ensureReaderClosed(resp) 9 | return err 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/gocql/gocql/cqltypes.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The gocql Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package gocql 6 | 7 | type Duration struct { 8 | Months int32 9 | Days int32 10 | Nanoseconds int64 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/smartystreets/goconvey/convey/reporting/console.go: -------------------------------------------------------------------------------- 1 | package reporting 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | ) 7 | 8 | type console struct{} 9 | 10 | func (self *console) Write(p []byte) (n int, err error) { 11 | return fmt.Print(string(p)) 12 | } 13 | 14 | func NewConsole() io.Writer { 15 | return new(console) 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/tinylib/msgp/msgp/advise_other.go: -------------------------------------------------------------------------------- 1 | // +build !linux appengine 2 | 3 | package msgp 4 | 5 | import ( 6 | "os" 7 | ) 8 | 9 | // TODO: darwin, BSD support 10 | 11 | func adviseRead(mem []byte) {} 12 | 13 | func adviseWrite(mem []byte) {} 14 | 15 | func fallocate(f *os.File, sz int64) error { 16 | return f.Truncate(sz) 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/tinylib/msgp/msgp/purego.go: -------------------------------------------------------------------------------- 1 | // +build purego appengine 2 | 3 | package msgp 4 | 5 | // let's just assume appengine 6 | // uses 64-bit hardware... 7 | const smallint = false 8 | 9 | func UnsafeString(b []byte) string { 10 | return string(b) 11 | } 12 | 13 | func UnsafeBytes(s string) []byte { 14 | return []byte(s) 15 | } 16 | -------------------------------------------------------------------------------- /docker/docker-dev-bigtable/grafana-datasources/metrictank.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | datasources: 3 | - name: metrictank 4 | type: graphite 5 | access: proxy 6 | orgId: 1 7 | url: http://metrictank:6060 8 | isDefault: true 9 | jsonData: 10 | graphiteVersion: "1.1" 11 | graphiteType: "metrictank" 12 | version: 1 13 | editable: true 14 | -------------------------------------------------------------------------------- /docker/docker-dev-debug/grafana-datasources/metrictank.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | datasources: 3 | - name: metrictank 4 | type: graphite 5 | access: proxy 6 | orgId: 1 7 | url: http://metrictank:6060 8 | isDefault: true 9 | jsonData: 10 | graphiteVersion: "1.1" 11 | graphiteType: "metrictank" 12 | version: 1 13 | editable: true 14 | -------------------------------------------------------------------------------- /docker/docker-dev-scylla/grafana-datasources/metrictank.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | datasources: 3 | - name: metrictank 4 | type: graphite 5 | access: proxy 6 | orgId: 1 7 | url: http://metrictank:6060 8 | isDefault: true 9 | jsonData: 10 | graphiteVersion: "1.1" 11 | graphiteType: "metrictank" 12 | version: 1 13 | editable: true 14 | -------------------------------------------------------------------------------- /docker/docker-standard/grafana-datasources/metrictank.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | datasources: 3 | - name: metrictank 4 | type: graphite 5 | access: proxy 6 | orgId: 1 7 | url: http://metrictank:6060 8 | isDefault: true 9 | jsonData: 10 | graphiteVersion: "1.1" 11 | graphiteType: "metrictank" 12 | version: 1 13 | editable: true 14 | -------------------------------------------------------------------------------- /benchmarks/simulate-lock-congestion/README.md: -------------------------------------------------------------------------------- 1 | 2 | runs mt-simulate-lock-congestion benchmarks, 3 | with parameters that mimic problematic situations which we've seen in our production enrivonment, 4 | while varying the newseries percentage, and with and without the index write queue enabled. 5 | 6 | parses the measurements output of each run and generates gnuplot charts 7 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/pkg/tlsconfig/tlsconfig_clone.go: -------------------------------------------------------------------------------- 1 | // +build go1.8 2 | 3 | package tlsconfig 4 | 5 | import "crypto/tls" 6 | 7 | // Clone returns a clone of tls.Config. This function is provided for 8 | // compatibility for go1.7 that doesn't include this method in stdlib. 9 | func Clone(c *tls.Config) *tls.Config { 10 | return c.Clone() 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-sockaddr/route_info_default.go: -------------------------------------------------------------------------------- 1 | // +build android nacl plan9 2 | 3 | package sockaddr 4 | 5 | import "errors" 6 | 7 | // getDefaultIfName is the default interface function for unsupported platforms. 8 | func getDefaultIfName() (string, error) { 9 | return "", errors.New("No default interface found (unsupported platform)") 10 | } 11 | -------------------------------------------------------------------------------- /scripts/qa-subjective/errcheck.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # finds unchecked errors 4 | 5 | # find the dir we exist within... 6 | DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 7 | # and cd into root project dir 8 | echo $DIR 9 | cd ${DIR}/../.. 10 | go install github.com/kisielk/errcheck@latest 11 | export GO111MODULE=off 12 | errcheck -ignoregenerated ./... 13 | -------------------------------------------------------------------------------- /stacktest/tests/chaos_cluster/notes: -------------------------------------------------------------------------------- 1 | observed problems: 2 | 1) testisolate output shows that mt4 returns all series, but some of them have up to 4 NaN oldest points 3 | 2) querying http 6061 manually shows sometimes not all series returned (though that was from=-1s) 4 | curl -v http://localhost:6061/render\?target\=some.id.of.a.metric.\*\&from\=-2s | jsonpp | r target 5 | 6 | -------------------------------------------------------------------------------- /vendor/github.com/gosuri/uilive/writer_posix.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package uilive 4 | 5 | import ( 6 | "fmt" 7 | "strings" 8 | ) 9 | 10 | // clear the line and move the cursor up 11 | var clear = fmt.Sprintf("%c[%dA%c[2K", ESC, 1, ESC) 12 | 13 | func (w *Writer) clearLines() { 14 | _, _ = fmt.Fprint(w.Out, strings.Repeat(clear, w.lineCount)) 15 | } 16 | -------------------------------------------------------------------------------- /api/middleware/cluster.go: -------------------------------------------------------------------------------- 1 | package middleware 2 | 3 | import ( 4 | "net/http" 5 | 6 | "github.com/grafana/metrictank/cluster" 7 | macaron "gopkg.in/macaron.v1" 8 | ) 9 | 10 | func NodeReady() macaron.Handler { 11 | return func(c *Context) { 12 | if !cluster.Manager.IsReady() { 13 | c.Error(http.StatusServiceUnavailable, "node not ready") 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /benchmarks/cluster-queries/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # alerting use case: frequent reads of the same, recent data 4 | ./run-alerting.sh & 5 | # exploration case: infrequent, random data, longer timeframe 6 | ./run-exploration.sh 7 | 8 | sleep 3 9 | echo "alerting:" 10 | cat alerting-out | vegeta report 11 | echo "exploration:" 12 | cat exploration-out | vegeta report 13 | -------------------------------------------------------------------------------- /scripts/qa-subjective/golint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # finds all kinds of lint 4 | 5 | # find the dir we exist within... 6 | DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 7 | # and cd into root project dir 8 | echo $DIR 9 | cd ${DIR}/../.. 10 | go install golang.org/x/lint/golint@latest 11 | export GO111MODULE=off 12 | golint $(go list ./... | grep -v vendor) 13 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/service_remove.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import "golang.org/x/net/context" 4 | 5 | // ServiceRemove kills and removes a service. 6 | func (cli *Client) ServiceRemove(ctx context.Context, serviceID string) error { 7 | resp, err := cli.delete(ctx, "/services/"+serviceID, nil, nil) 8 | ensureReaderClosed(resp) 9 | return err 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/docker/go-connections/tlsconfig/certpool_other.go: -------------------------------------------------------------------------------- 1 | // +build !go1.7 2 | 3 | package tlsconfig 4 | 5 | import ( 6 | "crypto/x509" 7 | 8 | ) 9 | 10 | // SystemCertPool returns an new empty cert pool, 11 | // accessing system cert pool is supported in go 1.7 12 | func SystemCertPool() (*x509.CertPool, error) { 13 | return x509.NewCertPool(), nil 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/xdg/stringprep/error.go: -------------------------------------------------------------------------------- 1 | package stringprep 2 | 3 | import "fmt" 4 | 5 | // Error describes problems encountered during stringprep, including what rune 6 | // was problematic. 7 | type Error struct { 8 | Msg string 9 | Rune rune 10 | } 11 | 12 | func (e Error) Error() string { 13 | return fmt.Sprintf("%s (rune: '\\u%04x')", e.Msg, e.Rune) 14 | } 15 | -------------------------------------------------------------------------------- /mdata/helper.go: -------------------------------------------------------------------------------- 1 | package mdata 2 | 3 | import ( 4 | "fmt" 5 | "time" 6 | ) 7 | 8 | func TS(ts interface{}) string { 9 | switch t := ts.(type) { 10 | case int64: 11 | return time.Unix(t, 0).Format("02 15:04:05") 12 | case uint32: 13 | return time.Unix(int64(t), 0).Format("02 15:04:05") 14 | default: 15 | return fmt.Sprintf("unexpected type %T\n", ts) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /util/helper.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import ( 4 | "fmt" 5 | "time" 6 | ) 7 | 8 | func TS(ts interface{}) string { 9 | switch t := ts.(type) { 10 | case int64: 11 | return time.Unix(t, 0).Format("02 15:04:05") 12 | case uint32: 13 | return time.Unix(int64(t), 0).Format("02 15:04:05") 14 | default: 15 | return fmt.Sprintf("unexpected type %T\n", ts) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/ssh/terminal/util_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package terminal 6 | 7 | import "golang.org/x/sys/unix" 8 | 9 | const ioctlReadTermios = unix.TCGETS 10 | const ioctlWriteTermios = unix.TCSETS 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/constants.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | const ( 10 | R_OK = 0x4 11 | W_OK = 0x2 12 | X_OK = 0x1 13 | ) 14 | -------------------------------------------------------------------------------- /scripts/qa/misspell.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # checks for misspelled words 4 | 5 | # find the dir we exist within... 6 | DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 7 | # and cd into root project dir 8 | cd ${DIR}/../.. 9 | go install github.com/client9/misspell/cmd/misspell@latest 10 | misspell -error $(find . -type f | grep -v vendor | grep -v '.git' | grep -v Gopkg.lock) 11 | -------------------------------------------------------------------------------- /test/tracer.go: -------------------------------------------------------------------------------- 1 | package test 2 | 3 | import ( 4 | "context" 5 | 6 | opentracing "github.com/opentracing/opentracing-go" 7 | ) 8 | 9 | // NewContext returns a context holding a tracing span 10 | func NewContext() context.Context { 11 | tracer := opentracing.NoopTracer{} 12 | span := tracer.StartSpan("test") 13 | return opentracing.ContextWithSpan(context.Background(), span) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/hcl/parser/error.go: -------------------------------------------------------------------------------- 1 | package parser 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/hcl/hcl/token" 7 | ) 8 | 9 | // PosError is a parse error that contains a position. 10 | type PosError struct { 11 | Pos token.Pos 12 | Err error 13 | } 14 | 15 | func (e *PosError) Error() string { 16 | return fmt.Sprintf("At %s: %s", e.Pos, e.Err) 17 | } 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/mksyscall.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package windows 6 | 7 | //go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zsyscall_windows.go eventlog.go service.go syscall_windows.go security_windows.go 8 | -------------------------------------------------------------------------------- /vendor/google.golang.org/appengine/internal/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. All rights reserved. 2 | // Use of this source code is governed by the Apache 2.0 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build appengine 6 | 7 | package internal 8 | 9 | import ( 10 | "appengine_internal" 11 | ) 12 | 13 | func Main() { 14 | appengine_internal.Main() 15 | } 16 | -------------------------------------------------------------------------------- /api/init.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import ( 4 | "github.com/grafana/metrictank/api/models" 5 | "github.com/grafana/metrictank/expr" 6 | "github.com/grafana/metrictank/pointslicepool" 7 | ) 8 | 9 | var pointSlicePool *pointslicepool.PointSlicePool 10 | 11 | func init() { 12 | pointSlicePool = pointslicepool.New(0) 13 | expr.Pool(pointSlicePool) 14 | models.Pool(pointSlicePool) 15 | } 16 | -------------------------------------------------------------------------------- /benchmarks/ingest-backfill-speed.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # for use with environments that have kafka offset=auto such as docker-cluster and docker-dev-custom-cfg-kafka 3 | # first fill up kafka then restart the mt's with docker compose to observe backfill speed 4 | mt-fakemetrics backfill --kafka-mdm-addr localhost:9092 --kafka-mdm-v2=true --offset $((2*366*24))h --period 1800s --speedup 360000 --mpo 500 5 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/aliases.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows 6 | // +build go1.9 7 | 8 | package windows 9 | 10 | import "syscall" 11 | 12 | type Errno = syscall.Errno 13 | type SysProcAttr = syscall.SysProcAttr 14 | -------------------------------------------------------------------------------- /stacktest/tests/predictable-tag-query-render-workload/README.md: -------------------------------------------------------------------------------- 1 | This tool exerts a consistent workload of tagqueries on a graphite endpoint. 2 | 3 | It expects queries for fakemetrics id's like `123456.*` to result in 123456, 1234560 through 1234569 4 | which you can achieve with an ingest workload such as: 5 | 6 | ``` 7 | fakemetrics feed --period 60s --mpo 1800000 --add-tags --num-unique-tags 3 8 | ``` 9 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/network_remove.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import "golang.org/x/net/context" 4 | 5 | // NetworkRemove removes an existent network from the docker host. 6 | func (cli *Client) NetworkRemove(ctx context.Context, networkID string) error { 7 | resp, err := cli.delete(ctx, "/networks/"+networkID, nil, nil) 8 | ensureReaderClosed(resp) 9 | return err 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/open_mode_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build freebsd openbsd netbsd dragonfly 6 | 7 | package fsnotify 8 | 9 | import "golang.org/x/sys/unix" 10 | 11 | const openMode = unix.O_NONBLOCK | unix.O_RDONLY 12 | -------------------------------------------------------------------------------- /scripts/qa-subjective/cyclo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # finds highly complex (cyclomatic complexity) functions 4 | 5 | # find the dir we exist within... 6 | DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 7 | # and cd into root project dir 8 | cd ${DIR}/../.. 9 | go install github.com/fzipp/gocyclo/cmd/gocyclo@latest 10 | gocyclo -over 15 $(find . -name '*.go' | grep -v vendor | grep -v _gen.go) 11 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/api/types/time/duration_convert.go: -------------------------------------------------------------------------------- 1 | package time 2 | 3 | import ( 4 | "strconv" 5 | "time" 6 | ) 7 | 8 | // DurationToSecondsString converts the specified duration to the number 9 | // seconds it represents, formatted as a string. 10 | func DurationToSecondsString(duration time.Duration) string { 11 | return strconv.FormatFloat(duration.Seconds(), 'f', 0, 64) 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/plugin_set.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "golang.org/x/net/context" 5 | ) 6 | 7 | // PluginSet modifies settings for an existing plugin 8 | func (cli *Client) PluginSet(ctx context.Context, name string, args []string) error { 9 | resp, err := cli.post(ctx, "/plugins/"+name+"/set", nil, args, nil) 10 | ensureReaderClosed(resp) 11 | return err 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_legacy.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019, The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE.md file. 4 | 5 | // +build !go1.10 6 | 7 | package flags 8 | 9 | // AtLeastGo110 reports whether the Go toolchain is at least Go 1.10. 10 | const AtLeastGo110 = false 11 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_recent.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019, The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE.md file. 4 | 5 | // +build go1.10 6 | 7 | package flags 8 | 9 | // AtLeastGo110 reports whether the Go toolchain is at least Go 1.10. 10 | const AtLeastGo110 = true 11 | -------------------------------------------------------------------------------- /vendor/github.com/raintank/met/statsd/count.go: -------------------------------------------------------------------------------- 1 | package statsd 2 | 3 | import "github.com/raintank/met" 4 | 5 | type Count struct { 6 | key string 7 | backend Backend 8 | } 9 | 10 | func (b Backend) NewCount(key string) met.Count { 11 | c := Count{key, b} 12 | c.Inc(0) 13 | return c 14 | } 15 | 16 | func (c Count) Inc(val int64) { 17 | c.backend.client.Count(c.key, int(val), 1) 18 | } 19 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,linux 6 | // +build !gccgo 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | //go:noescape 13 | func gettimeofday(tv *Timeval) (err syscall.Errno) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/asm_windows_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | #include "textflag.h" 6 | 7 | TEXT ·getprocaddress(SB),NOSPLIT,$0 8 | B syscall·getprocaddress(SB) 9 | 10 | TEXT ·loadlibrary(SB),NOSPLIT,$0 11 | B syscall·loadlibrary(SB) 12 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/open_mode_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin 6 | 7 | package fsnotify 8 | 9 | import "golang.org/x/sys/unix" 10 | 11 | // note: this constant is not defined on BSD 12 | const openMode = unix.O_EVTONLY 13 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-cmp/cmp/internal/flags/flags.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019, The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE.md file. 4 | 5 | package flags 6 | 7 | // Deterministic controls whether the output of Diff should be deterministic. 8 | // This is only used for testing. 9 | var Deterministic bool 10 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_safe.go: -------------------------------------------------------------------------------- 1 | package xxhash 2 | 3 | // Sum64String computes the 64-bit xxHash digest of s. 4 | func Sum64String(s string) uint64 { 5 | return Sum64([]byte(s)) 6 | } 7 | 8 | // WriteString adds more data to d. It always returns len(s), nil. 9 | func (d *Digest) WriteString(s string) (n int, err error) { 10 | return d.Write([]byte(s)) 11 | } 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/oauth2/google/appengineflex_hook.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build appenginevm 6 | 7 | package google 8 | 9 | func init() { 10 | appengineFlex = true // Flex doesn't support appengine.AccessToken; depend on metadata server. 11 | } 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/oauth2/internal/client_appengine.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build appengine 6 | 7 | package internal 8 | 9 | import "google.golang.org/appengine/urlfetch" 10 | 11 | func init() { 12 | appengineClientHook = urlfetch.Client 13 | } 14 | -------------------------------------------------------------------------------- /vendor/google.golang.org/api/AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of authors for copyright purposes. 2 | # This file is distinct from the CONTRIBUTORS files. 3 | # See the latter for an explanation. 4 | 5 | # Names should be added to this file as 6 | # Name or Organization 7 | # The email address is not required for organizations. 8 | 9 | # Please keep the list sorted. 10 | Google Inc. 11 | -------------------------------------------------------------------------------- /vendor/google.golang.org/api/gensupport/not_go18.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !go1.8 6 | 7 | package gensupport 8 | 9 | import ( 10 | "io" 11 | "net/http" 12 | ) 13 | 14 | func SetGetBody(req *http.Request, f func() (io.ReadCloser, error)) {} 15 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/swarm_join.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "github.com/docker/docker/api/types/swarm" 5 | "golang.org/x/net/context" 6 | ) 7 | 8 | // SwarmJoin joins the Swarm. 9 | func (cli *Client) SwarmJoin(ctx context.Context, req swarm.JoinRequest) error { 10 | resp, err := cli.post(ctx, "/swarm/join", nil, req, nil) 11 | ensureReaderClosed(resp) 12 | return err 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/raintank/met/dogstatsd/count.go: -------------------------------------------------------------------------------- 1 | package dogstatsd 2 | 3 | import "github.com/raintank/met" 4 | 5 | type Count struct { 6 | key string 7 | backend Backend 8 | } 9 | 10 | func (b Backend) NewCount(key string) met.Count { 11 | c := Count{key, b} 12 | c.Inc(0) 13 | return c 14 | } 15 | 16 | func (c Count) Inc(val int64) { 17 | c.backend.client.Count(c.key, val, []string{}, 1) 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go: -------------------------------------------------------------------------------- 1 | // +build !appengine,!js,!windows 2 | 3 | package logrus 4 | 5 | import ( 6 | "io" 7 | "os" 8 | 9 | "golang.org/x/crypto/ssh/terminal" 10 | ) 11 | 12 | func checkIfTerminal(w io.Writer) bool { 13 | switch v := w.(type) { 14 | case *os.File: 15 | return terminal.IsTerminal(int(v.Fd())) 16 | default: 17 | return false 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /vendor/gopkg.in/jcmturner/rpc.v1/mstypes/user_session_key.go: -------------------------------------------------------------------------------- 1 | package mstypes 2 | 3 | // CypherBlock implements https://msdn.microsoft.com/en-us/library/cc237040.aspx 4 | type CypherBlock struct { 5 | Data [8]byte // size = 8 6 | } 7 | 8 | // UserSessionKey implements https://msdn.microsoft.com/en-us/library/cc237080.aspx 9 | type UserSessionKey struct { 10 | CypherBlock [2]CypherBlock // size = 2 11 | } 12 | -------------------------------------------------------------------------------- /cluster/if.go: -------------------------------------------------------------------------------- 1 | package cluster 2 | 3 | import ( 4 | "context" 5 | "io" 6 | ) 7 | 8 | type Node interface { 9 | IsLocal() bool 10 | IsReady() bool 11 | GetPartitions() []int32 12 | GetPriority() int 13 | HasData() bool 14 | Post(context.Context, string, string, Traceable) ([]byte, error) 15 | PostRaw(ctx context.Context, name, path string, body Traceable) (io.ReadCloser, error) 16 | GetName() string 17 | } 18 | -------------------------------------------------------------------------------- /stats/out_devnull.go: -------------------------------------------------------------------------------- 1 | package stats 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/grafana/metrictank/clock" 7 | ) 8 | 9 | func NewDevnull() { 10 | go func() { 11 | ticker := clock.AlignedTickLossy(time.Second) 12 | buf := make([]byte, 0) 13 | for now := range ticker { 14 | for _, metric := range registry.list() { 15 | metric.WriteGraphiteLine(buf[:], nil, now) 16 | } 17 | } 18 | }() 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/philhofer/fwd/writer_unsafe.go: -------------------------------------------------------------------------------- 1 | // +build !appengine 2 | 3 | package fwd 4 | 5 | import ( 6 | "reflect" 7 | "unsafe" 8 | ) 9 | 10 | // unsafe cast string as []byte 11 | func unsafestr(b string) []byte { 12 | l := len(b) 13 | return *(*[]byte)(unsafe.Pointer(&reflect.SliceHeader{ 14 | Len: l, 15 | Cap: l, 16 | Data: (*reflect.StringHeader)(unsafe.Pointer(&b)).Data, 17 | })) 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/container_unpause.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import "golang.org/x/net/context" 4 | 5 | // ContainerUnpause resumes the process execution within a container 6 | func (cli *Client) ContainerUnpause(ctx context.Context, containerID string) error { 7 | resp, err := cli.post(ctx, "/containers/"+containerID+"/unpause", nil, nil, nil) 8 | ensureReaderClosed(resp) 9 | return err 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/gocql/gocql/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2015 The gocql Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package gocql implements a fast and robust Cassandra driver for the 6 | // Go programming language. 7 | package gocql // import "github.com/gocql/gocql" 8 | 9 | // TODO(tux21b): write more docs. 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.10 6 | 7 | package bidirule 8 | 9 | func (t *Transformer) isFinal() bool { 10 | return t.state == ruleLTRFinal || t.state == ruleRTLFinal || t.state == ruleInitial 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/terminal_windows.go: -------------------------------------------------------------------------------- 1 | // +build !appengine,!js,windows 2 | 3 | package logrus 4 | 5 | import ( 6 | "io" 7 | "os" 8 | "syscall" 9 | 10 | sequences "github.com/konsorten/go-windows-terminal-sequences" 11 | ) 12 | 13 | func initTerminal(w io.Writer) { 14 | switch v := w.(type) { 15 | case *os.File: 16 | sequences.EnableVirtualTerminalProcessing(syscall.Handle(v.Fd()), true) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/http2/not_go19.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !go1.9 6 | 7 | package http2 8 | 9 | import ( 10 | "net/http" 11 | ) 12 | 13 | func configureServer19(s *http.Server, conf *Server) error { 14 | // not supported prior to go1.9 15 | return nil 16 | } 17 | -------------------------------------------------------------------------------- /api/models/pointslicepool.go: -------------------------------------------------------------------------------- 1 | package models 2 | 3 | import ( 4 | "github.com/grafana/metrictank/pointslicepool" 5 | ) 6 | 7 | var pointSlicePool *pointslicepool.PointSlicePool 8 | 9 | func init() { 10 | pointSlicePool = pointslicepool.New(0) 11 | } 12 | 13 | // Pool tells the models package library which pool to use for temporary []schema.Point 14 | func Pool(p *pointslicepool.PointSlicePool) { 15 | pointSlicePool = p 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/api/types/error_response.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | // This file was generated by the swagger tool. 4 | // Editing this file might prove futile when you re-run the swagger generate command 5 | 6 | // ErrorResponse Represents an error. 7 | // swagger:model ErrorResponse 8 | type ErrorResponse struct { 9 | 10 | // The error message. 11 | // Required: true 12 | Message string `json:"message"` 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/container_pause.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import "golang.org/x/net/context" 4 | 5 | // ContainerPause pauses the main process of a given container without terminating it. 6 | func (cli *Client) ContainerPause(ctx context.Context, containerID string) error { 7 | resp, err := cli.post(ctx, "/containers/"+containerID+"/pause", nil, nil, nil) 8 | ensureReaderClosed(resp) 9 | return err 10 | } 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/ssh/terminal/util_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd netbsd openbsd 6 | 7 | package terminal 8 | 9 | import "golang.org/x/sys/unix" 10 | 11 | const ioctlReadTermios = unix.TIOCGETA 12 | const ioctlWriteTermios = unix.TIOCSETA 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/http2/go16.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.6 6 | 7 | package http2 8 | 9 | import ( 10 | "net/http" 11 | "time" 12 | ) 13 | 14 | func transportExpectContinueTimeout(t1 *http.Transport) time.Duration { 15 | return t1.ExpectContinueTimeout 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/Dieterbe/profiletrigger/procfs/AUTHORS.md: -------------------------------------------------------------------------------- 1 | The Prometheus project was started by Matt T. Proud (emeritus) and 2 | Julius Volz in 2012. 3 | 4 | Maintainers of this repository: 5 | 6 | * Tobias Schmidt 7 | 8 | The following individuals have contributed code to this repository 9 | (listed in alphabetical order): 10 | 11 | * Ji-Hoon, Seol 12 | * Tobias Schmidt 13 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/terminal_check_windows.go: -------------------------------------------------------------------------------- 1 | // +build !appengine,!js,windows 2 | 3 | package logrus 4 | 5 | import ( 6 | "io" 7 | "os" 8 | "syscall" 9 | ) 10 | 11 | func checkIfTerminal(w io.Writer) bool { 12 | switch v := w.(type) { 13 | case *os.File: 14 | var mode uint32 15 | err := syscall.GetConsoleMode(syscall.Handle(v.Fd()), &mode) 16 | return err == nil 17 | default: 18 | return false 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /mdata/chunk/tsz/finish.go: -------------------------------------------------------------------------------- 1 | package tsz 2 | 3 | // see end-of-stream marker information in devdocs/chunk-format.md 4 | 5 | // finishV1 writes a v1 end-of-stream record to the bitstream 6 | func finishV1(w *bstream) { 7 | w.writeBits(0x0f, 4) 8 | w.writeBits(0xffffffff, 32) 9 | w.writeBit(zero) 10 | } 11 | 12 | // finishV2 writes a a v1 end-of-stream record to the bitstream 13 | func finishV2(w *bstream) { 14 | w.writeBits(0x1f, 5) 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/golang/snappy/decode_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Snappy-Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !appengine 6 | // +build gc 7 | // +build !noasm 8 | 9 | package snappy 10 | 11 | // decode has the same semantics as in decode_other.go. 12 | // 13 | //go:noescape 14 | func decode(dst, src []byte) int 15 | -------------------------------------------------------------------------------- /vendor/github.com/raintank/met/statsd/init.go: -------------------------------------------------------------------------------- 1 | package statsd 2 | 3 | import "gopkg.in/alexcesaro/statsd.v1" 4 | 5 | type Backend struct { 6 | client *statsd.Client 7 | } 8 | 9 | // note: library does not auto add ending dot to prefix. 10 | func New(enabled bool, addr, prefix string) (Backend, error) { 11 | client, err := statsd.New(addr, statsd.WithPrefix(prefix), statsd.Mute(!enabled)) 12 | b := Backend{client} 13 | return b, err 14 | } 15 | -------------------------------------------------------------------------------- /benchmarks/cluster-queries/run-exploration.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | function gen_input() { 5 | # we have 500 series and want to select 10 out of them 6 | for i in {1..300}; 7 | do 8 | patt="$(($RANDOM % 5))$(($RANDOM % 10))*" 9 | echo "GET http://localhost:6061/render?target=some.id.of.a.metric.$patt;some=tag&from=-2y" 10 | done 11 | } 12 | 13 | input=$(gen_input) 14 | echo "$input" | vegeta attack -rate 1 -duration 30s > exploration-out 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/http2/go19.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.9 6 | 7 | package http2 8 | 9 | import ( 10 | "net/http" 11 | ) 12 | 13 | func configureServer19(s *http.Server, conf *Server) error { 14 | s.RegisterOnShutdown(conf.state.startGracefulShutdown) 15 | return nil 16 | } 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/oauth2/google/appengine_hook.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build appengine appenginevm 6 | 7 | package google 8 | 9 | import "google.golang.org/appengine" 10 | 11 | func init() { 12 | appengineTokenFunc = appengine.AccessToken 13 | appengineAppIDFunc = appengine.AppID 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/api/types/id_response.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | // This file was generated by the swagger tool. 4 | // Editing this file might prove futile when you re-run the swagger generate command 5 | 6 | // IDResponse Response to an API call that returns just an Id 7 | // swagger:model IdResponse 8 | type IDResponse struct { 9 | 10 | // The id of the newly created object. 11 | // Required: true 12 | ID string `json:"Id"` 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/api/types/service_update_response.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | // This file was generated by the swagger tool. 4 | // Editing this file might prove futile when you re-run the swagger generate command 5 | 6 | // ServiceUpdateResponse service update response 7 | // swagger:model ServiceUpdateResponse 8 | type ServiceUpdateResponse struct { 9 | 10 | // Optional warning messages 11 | Warnings []string `json:"Warnings"` 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/snappy/decode_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Snappy-Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !appengine 6 | // +build gc 7 | // +build !noasm 8 | 9 | package snappy 10 | 11 | // decode has the same semantics as in decode_other.go. 12 | // 13 | //go:noescape 14 | func decode(dst, src []byte) int 15 | -------------------------------------------------------------------------------- /scripts/k8s_dlv/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM grafana/metrictank:latest-debug 2 | RUN apk add --no-cache curl jq ca-certificates python py-pip 3 | RUN pip install kazoo 4 | COPY entrypoint_debug.sh /entrypoint_debug.sh 5 | COPY getOffset.py /getOffset.py 6 | ENTRYPOINT ["/entrypoint_debug.sh"] 7 | CMD [ "/usr/bin/dlv", "--listen=:40000", "--headless=true", "--api-version=2", "--log", "--log-output=rpc", "exec", "/usr/bin/metrictank", "--" ,"-config=/etc/metrictank/metrictank.ini" ] 8 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/memberlist/logging.go: -------------------------------------------------------------------------------- 1 | package memberlist 2 | 3 | import ( 4 | "fmt" 5 | "net" 6 | ) 7 | 8 | func LogAddress(addr net.Addr) string { 9 | if addr == nil { 10 | return "from=" 11 | } 12 | 13 | return fmt.Sprintf("from=%s", addr.String()) 14 | } 15 | 16 | func LogConn(conn net.Conn) string { 17 | if conn == nil { 18 | return LogAddress(nil) 19 | } 20 | 21 | return LogAddress(conn.RemoteAddr()) 22 | } 23 | -------------------------------------------------------------------------------- /vendor/gopkg.in/jcmturner/gokrb5.v7/iana/addrtype/constants.go: -------------------------------------------------------------------------------- 1 | // Package addrtype provides Address type assigned numbers. 2 | package addrtype 3 | 4 | // Address type IDs. 5 | const ( 6 | IPv4 int32 = 2 7 | Directional int32 = 3 8 | ChaosNet int32 = 5 9 | XNS int32 = 6 10 | ISO int32 = 7 11 | DECNETPhaseIV int32 = 12 12 | AppleTalkDDP int32 = 16 13 | NetBios int32 = 20 14 | IPv6 int32 = 24 15 | ) 16 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/swarm_leave.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "net/url" 5 | 6 | "golang.org/x/net/context" 7 | ) 8 | 9 | // SwarmLeave leaves the Swarm. 10 | func (cli *Client) SwarmLeave(ctx context.Context, force bool) error { 11 | query := url.Values{} 12 | if force { 13 | query.Set("force", "1") 14 | } 15 | resp, err := cli.post(ctx, "/swarm/leave", query, nil, nil) 16 | ensureReaderClosed(resp) 17 | return err 18 | } 19 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/aliases.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | // +build go1.9 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | type Signal = syscall.Signal 13 | type Errno = syscall.Errno 14 | type SysProcAttr = syscall.SysProcAttr 15 | -------------------------------------------------------------------------------- /scripts/qa/ineffassign.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # this tool detects "ineffectual assignments" 4 | # not very clear but you may find some more info on 5 | # https://github.com/gordonklaus/ineffassign 6 | 7 | # find the dir we exist within... 8 | DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 9 | # and cd into root project dir 10 | cd ${DIR}/../.. 11 | go install 'github.com/gordonklaus/ineffassign@master' 12 | 13 | export GO111MODULE=off 14 | ineffassign ./... 15 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/memberlist/conflict_delegate.go: -------------------------------------------------------------------------------- 1 | package memberlist 2 | 3 | // ConflictDelegate is a used to inform a client that 4 | // a node has attempted to join which would result in a 5 | // name conflict. This happens if two clients are configured 6 | // with the same name but different addresses. 7 | type ConflictDelegate interface { 8 | // NotifyConflict is invoked when a name conflict is detected 9 | NotifyConflict(existing, other *Node) 10 | } 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/pagesize_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // For Unix, get the pagesize from the runtime. 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Getpagesize() int { 14 | return syscall.Getpagesize() 15 | } 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !go1.10 6 | 7 | package bidirule 8 | 9 | func (t *Transformer) isFinal() bool { 10 | if !t.isRTL() { 11 | return true 12 | } 13 | return t.state == ruleLTRFinal || t.state == ruleRTLFinal || t.state == ruleInitial 14 | } 15 | -------------------------------------------------------------------------------- /docker/cfg/grafana-dashboards-main-extra/config.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | providers: 4 | - name: 'main' 5 | orgId: 1 6 | folder: '' 7 | type: file 8 | disableDeletion: true 9 | updateIntervalSeconds: 3 10 | options: 11 | path: /var/lib/grafana/dashboards/main 12 | - name: 'extra' 13 | orgId: 1 14 | folder: '' 15 | type: file 16 | disableDeletion: true 17 | updateIntervalSeconds: 3 18 | options: 19 | path: /var/lib/grafana/dashboards/extra 20 | -------------------------------------------------------------------------------- /util/util_test.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | func TestLCM(t *testing.T) { 8 | cases := []struct { 9 | in []uint32 10 | out uint32 11 | }{ 12 | {[]uint32{10, 60}, 60}, 13 | {[]uint32{20, 30}, 60}, 14 | {[]uint32{40, 60}, 120}, 15 | {[]uint32{1, 3}, 3}, 16 | } 17 | for i, c := range cases { 18 | out := Lcm(c.in) 19 | if out != c.out { 20 | t.Errorf("case %d -> expected %d, got %d", i, c.out, out) 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/asm_windows_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // 6 | // System calls for 386, Windows are implemented in runtime/syscall_windows.goc 7 | // 8 | 9 | TEXT ·getprocaddress(SB), 7, $0-16 10 | JMP syscall·getprocaddress(SB) 11 | 12 | TEXT ·loadlibrary(SB), 7, $0-12 13 | JMP syscall·loadlibrary(SB) 14 | -------------------------------------------------------------------------------- /vendor/github.com/Shopify/sarama/tools/tls/config.go: -------------------------------------------------------------------------------- 1 | package tls 2 | 3 | import "crypto/tls" 4 | 5 | func NewConfig(clientCert, clientKey string) (*tls.Config, error) { 6 | tlsConfig := tls.Config{} 7 | 8 | if clientCert != "" && clientKey != "" { 9 | cert, err := tls.LoadX509KeyPair(clientCert, clientKey) 10 | if err != nil { 11 | return &tlsConfig, err 12 | } 13 | tlsConfig.Certificates = []tls.Certificate{cert} 14 | } 15 | 16 | return &tlsConfig, nil 17 | } 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/asm_windows_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // 6 | // System calls for amd64, Windows are implemented in runtime/syscall_windows.goc 7 | // 8 | 9 | TEXT ·getprocaddress(SB), 7, $0-32 10 | JMP syscall·getprocaddress(SB) 11 | 12 | TEXT ·loadlibrary(SB), 7, $0-24 13 | JMP syscall·loadlibrary(SB) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/language/common.go: -------------------------------------------------------------------------------- 1 | // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. 2 | 3 | package language 4 | 5 | // This file contains code common to the maketables.go and the package code. 6 | 7 | // langAliasType is the type of an alias in langAliasMap. 8 | type langAliasType int8 9 | 10 | const ( 11 | langDeprecated langAliasType = iota 12 | langMacro 13 | langLegacy 14 | 15 | langAliasTypeUnknown langAliasType = -1 16 | ) 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // +build linux,386 linux,arm linux,mips linux,mipsle 2 | 3 | // Copyright 2014 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | package unix 8 | 9 | func init() { 10 | // On 32-bit Linux systems, the fcntl syscall that matches Go's 11 | // Flock_t type is SYS_FCNTL64, not SYS_FCNTL. 12 | fcntl64Syscall = SYS_FCNTL64 13 | } 14 | -------------------------------------------------------------------------------- /vendor/google.golang.org/api/gensupport/go18.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.8 6 | 7 | package gensupport 8 | 9 | import ( 10 | "io" 11 | "net/http" 12 | ) 13 | 14 | // SetGetBody sets the GetBody field of req to f. 15 | func SetGetBody(req *http.Request, f func() (io.ReadCloser, error)) { 16 | req.GetBody = f 17 | } 18 | -------------------------------------------------------------------------------- /docker/docker-cluster/grafana-datasources/monitoring.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | datasources: 3 | - name: monitoring 4 | type: graphite 5 | access: proxy 6 | orgId: 1 7 | url: http://graphitemon 8 | isDefault: false 9 | jsonData: 10 | graphiteVersion: "1.1" 11 | version: 1 12 | editable: true 13 | - name: Prometheus 14 | type: prometheus 15 | access: proxy 16 | orgId: 1 17 | url: http://prometheus:9090 18 | isDefault: false 19 | version: 1 20 | editable: true 21 | -------------------------------------------------------------------------------- /cmd/mt-fakemetrics/cmd/version.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "fmt" 5 | "runtime" 6 | 7 | "github.com/spf13/cobra" 8 | ) 9 | 10 | var Version = "unknown" 11 | 12 | func init() { 13 | rootCmd.AddCommand(versionCmd) 14 | } 15 | 16 | var versionCmd = &cobra.Command{ 17 | Use: "version", 18 | Short: "Print the version number", 19 | Run: func(cmd *cobra.Command, args []string) { 20 | fmt.Printf("mt-fakemetrics %s (built with %s)\n", Version, runtime.Version()) 21 | }, 22 | } 23 | -------------------------------------------------------------------------------- /docker/docker-cluster-query/grafana-datasources/monitoring.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | datasources: 3 | - name: monitoring 4 | type: graphite 5 | access: proxy 6 | orgId: 1 7 | url: http://graphitemon 8 | isDefault: false 9 | jsonData: 10 | graphiteVersion: "1.1" 11 | version: 1 12 | editable: true 13 | - name: Prometheus 14 | type: prometheus 15 | access: proxy 16 | orgId: 1 17 | url: http://prometheus:9090 18 | isDefault: false 19 | version: 1 20 | editable: true 21 | -------------------------------------------------------------------------------- /mdata/cache/ccache_chunk.go: -------------------------------------------------------------------------------- 1 | package cache 2 | 3 | import ( 4 | "github.com/grafana/metrictank/mdata/chunk" 5 | ) 6 | 7 | type CCacheChunk struct { 8 | // the timestamp of this cache chunk 9 | Ts uint32 10 | 11 | // the previous chunk. if the previous chunk isn't cached this is 0 12 | Prev uint32 13 | 14 | // the next chunk. if the next chunk isn't cached this is 0 15 | Next uint32 16 | 17 | // an iterator generator to iterate over the chunk's data 18 | Itgen chunk.IterGen 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/swarm_unlock.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "github.com/docker/docker/api/types/swarm" 5 | "golang.org/x/net/context" 6 | ) 7 | 8 | // SwarmUnlock unlockes locked swarm. 9 | func (cli *Client) SwarmUnlock(ctx context.Context, req swarm.UnlockRequest) error { 10 | serverResp, err := cli.post(ctx, "/swarm/unlock", nil, req, nil) 11 | if err != nil { 12 | return err 13 | } 14 | 15 | ensureReaderClosed(serverResp) 16 | return err 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/uber/jaeger-client-go/thrift-gen/baggage/constants.go: -------------------------------------------------------------------------------- 1 | // Autogenerated by Thrift Compiler (0.9.3) 2 | // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 3 | 4 | package baggage 5 | 6 | import ( 7 | "bytes" 8 | "fmt" 9 | "github.com/uber/jaeger-client-go/thrift" 10 | ) 11 | 12 | // (needed to ensure safety because of naive import list construction.) 13 | var _ = thrift.ZERO 14 | var _ = fmt.Printf 15 | var _ = bytes.Equal 16 | 17 | func init() { 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/uber/jaeger-client-go/thrift-gen/jaeger/constants.go: -------------------------------------------------------------------------------- 1 | // Autogenerated by Thrift Compiler (0.9.3) 2 | // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 3 | 4 | package jaeger 5 | 6 | import ( 7 | "bytes" 8 | "fmt" 9 | "github.com/uber/jaeger-client-go/thrift" 10 | ) 11 | 12 | // (needed to ensure safety because of naive import list construction.) 13 | var _ = thrift.ZERO 14 | var _ = fmt.Printf 15 | var _ = bytes.Equal 16 | 17 | func init() { 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/uber/jaeger-client-go/thrift-gen/sampling/constants.go: -------------------------------------------------------------------------------- 1 | // Autogenerated by Thrift Compiler (0.9.3) 2 | // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 3 | 4 | package sampling 5 | 6 | import ( 7 | "bytes" 8 | "fmt" 9 | "github.com/uber/jaeger-client-go/thrift" 10 | ) 11 | 12 | // (needed to ensure safety because of naive import list construction.) 13 | var _ = thrift.ZERO 14 | var _ = fmt.Printf 15 | var _ = bytes.Equal 16 | 17 | func init() { 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/cespare/xxhash/xxhash_safe.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | // This file contains the safe implementations of otherwise unsafe-using code. 4 | 5 | package xxhash 6 | 7 | // Sum64String computes the 64-bit xxHash digest of s. 8 | func Sum64String(s string) uint64 { 9 | return Sum64([]byte(s)) 10 | } 11 | 12 | // WriteString adds more data to d. It always returns len(s), nil. 13 | func (d *Digest) WriteString(s string) (n int, err error) { 14 | return d.Write([]byte(s)) 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/hack/generate-authors.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | cd "$(dirname "$(readlink -f "$BASH_SOURCE")")/.." 5 | 6 | # see also ".mailmap" for how email addresses and names are deduplicated 7 | 8 | { 9 | cat <<-'EOH' 10 | # This file lists all individuals having contributed content to the repository. 11 | # For how it is generated, see `hack/generate-authors.sh`. 12 | EOH 13 | echo 14 | git log --format='%aN <%aE>' | LC_ALL=C.UTF-8 sort -uf 15 | } > AUTHORS 16 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-cmp/cmp/export_panic.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017, The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE.md file. 4 | 5 | // +build purego 6 | 7 | package cmp 8 | 9 | import "reflect" 10 | 11 | const supportAllowUnexported = false 12 | 13 | func retrieveUnexportedField(reflect.Value, reflect.StructField) reflect.Value { 14 | panic("retrieveUnexportedField is not implemented") 15 | } 16 | -------------------------------------------------------------------------------- /vendor/google.golang.org/appengine/socket/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Google Inc. All rights reserved. 2 | // Use of this source code is governed by the Apache 2.0 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package socket provides outbound network sockets. 6 | // 7 | // This package is only required in the classic App Engine environment. 8 | // Applications running only in App Engine "flexible environment" should 9 | // use the standard library's net package. 10 | package socket 11 | -------------------------------------------------------------------------------- /docker/docker-dev-custom-cfg-kafka/grafana-datasources/monitoring.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | datasources: 3 | - name: monitoring 4 | type: graphite 5 | access: proxy 6 | orgId: 1 7 | url: http://graphitemon 8 | isDefault: false 9 | jsonData: 10 | graphiteVersion: "1.1" 11 | version: 1 12 | editable: true 13 | - name: Prometheus 14 | type: prometheus 15 | access: proxy 16 | orgId: 1 17 | url: http://prometheus:9090 18 | isDefault: false 19 | version: 1 20 | editable: true 21 | -------------------------------------------------------------------------------- /vendor/github.com/jtolds/gls/gen_sym.go: -------------------------------------------------------------------------------- 1 | package gls 2 | 3 | import ( 4 | "sync" 5 | ) 6 | 7 | var ( 8 | keyMtx sync.Mutex 9 | keyCounter uint64 10 | ) 11 | 12 | // ContextKey is a throwaway value you can use as a key to a ContextManager 13 | type ContextKey struct{ id uint64 } 14 | 15 | // GenSym will return a brand new, never-before-used ContextKey 16 | func GenSym() ContextKey { 17 | keyMtx.Lock() 18 | defer keyMtx.Unlock() 19 | keyCounter += 1 20 | return ContextKey{id: keyCounter} 21 | } 22 | -------------------------------------------------------------------------------- /scripts/version-tag.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | version=$(git describe --abbrev=7) 4 | version_raw=$(git describe --abbrev=7 | sed 's/^v//') 5 | gitroot=$(git rev-parse --show-toplevel) 6 | 7 | # only tag as latest if: 8 | # * we're in master branch 9 | # * the version string has no hyphen in it (e.g. our git commit equates to a tag) 10 | # * the working tree is not dirty 11 | tag=master 12 | if grep -q master "$gitroot/.git/HEAD" && [[ $version != *-* && -z $(git status --porcelain) ]]; then 13 | tag=latest 14 | fi 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/proxy/direct.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package proxy 6 | 7 | import ( 8 | "net" 9 | ) 10 | 11 | type direct struct{} 12 | 13 | // Direct is a direct proxy: one that makes network connections directly. 14 | var Direct = direct{} 15 | 16 | func (direct) Dial(network, addr string) (net.Conn, error) { 17 | return net.Dial(network, addr) 18 | } 19 | -------------------------------------------------------------------------------- /vendor/google.golang.org/api/gensupport/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package gensupport is an internal implementation detail used by code 6 | // generated by the google-api-go-generator tool. 7 | // 8 | // This package may be modified at any time without regard for backwards 9 | // compatibility. It should not be used directly by API users. 10 | package gensupport 11 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017, The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE.md file. 4 | 5 | // +build !cmp_debug 6 | 7 | package diff 8 | 9 | var debug debugger 10 | 11 | type debugger struct{} 12 | 13 | func (debugger) Begin(_, _ int, f EqualFunc, _, _ *EditScript) EqualFunc { 14 | return f 15 | } 16 | func (debugger) Update() {} 17 | func (debugger) Finish() {} 18 | -------------------------------------------------------------------------------- /vendor/github.com/raintank/met/statsd/meter.go: -------------------------------------------------------------------------------- 1 | // it's commonly used for non-timer cases where we want these summaries, that's 2 | // what this is for. 3 | package statsd 4 | 5 | import "github.com/raintank/met" 6 | 7 | type Meter struct { 8 | key string 9 | backend Backend 10 | } 11 | 12 | func (b Backend) NewMeter(key string, val int64) met.Meter { 13 | m := Meter{key, b} 14 | m.Value(val) 15 | return m 16 | } 17 | 18 | func (m Meter) Value(val int64) { 19 | m.backend.client.Timing(m.key, int(val), 1) 20 | } 21 | -------------------------------------------------------------------------------- /docker/docker-cluster/grafana-datasources/graphite.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | datasources: 3 | - name: graphite 4 | type: graphite 5 | access: proxy 6 | orgId: 1 7 | url: http://caddy:8081 8 | isDefault: false 9 | jsonData: 10 | graphiteVersion: "1.1" 11 | version: 1 12 | editable: true 13 | - name: graphite2 14 | type: graphite 15 | access: proxy 16 | orgId: 1 17 | url: http://caddy:8082 18 | isDefault: false 19 | jsonData: 20 | graphiteVersion: "1.1" 21 | version: 1 22 | editable: true 23 | -------------------------------------------------------------------------------- /vendor/github.com/docker/go-connections/tlsconfig/certpool_go17.go: -------------------------------------------------------------------------------- 1 | // +build go1.7 2 | 3 | package tlsconfig 4 | 5 | import ( 6 | "crypto/x509" 7 | "runtime" 8 | ) 9 | 10 | // SystemCertPool returns a copy of the system cert pool, 11 | // returns an error if failed to load or empty pool on windows. 12 | func SystemCertPool() (*x509.CertPool, error) { 13 | certpool, err := x509.SystemCertPool() 14 | if err != nil && runtime.GOOS == "windows" { 15 | return x509.NewCertPool(), nil 16 | } 17 | return certpool, err 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/docker/go-connections/tlsconfig/config_legacy_client_ciphers.go: -------------------------------------------------------------------------------- 1 | // +build !go1.5 2 | 3 | // Package tlsconfig provides primitives to retrieve secure-enough TLS configurations for both clients and servers. 4 | // 5 | package tlsconfig 6 | 7 | import ( 8 | "crypto/tls" 9 | ) 10 | 11 | // Client TLS cipher suites (dropping CBC ciphers for client preferred suite set) 12 | var clientCipherSuites = []uint16{ 13 | tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, 14 | tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, 15 | } 16 | -------------------------------------------------------------------------------- /benchmarks/simulate-lock-congestion/gnuplot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | file=$(mktemp) 4 | for type in writeq-true-query writeq-true-metric-update writeq-true-metric-add writeq-false-metric-add writeq-false-query writeq-false-metric-update; do 5 | cat << EOF > $file 6 | set title '$type' 7 | set terminal png 8 | set xlabel 'new-series-pct' 9 | set ylabel 'milliseconds' 10 | set output '$type.png' 11 | plot '$type.txt' using 1:2 with lines title 'mean', '$type.txt' using 1:5 with lines title 'p99' 12 | EOF 13 | gnuplot -p $file 14 | done 15 | -------------------------------------------------------------------------------- /docker/docker-cluster-query/grafana-datasources/graphite.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | datasources: 3 | - name: graphite 4 | type: graphite 5 | access: proxy 6 | orgId: 1 7 | url: http://caddy:8081 8 | isDefault: false 9 | jsonData: 10 | graphiteVersion: "1.1" 11 | version: 1 12 | editable: true 13 | - name: graphite2 14 | type: graphite 15 | access: proxy 16 | orgId: 1 17 | url: http://caddy:8082 18 | isDefault: false 19 | jsonData: 20 | graphiteVersion: "1.1" 21 | version: 1 22 | editable: true 23 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/container_rename.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "net/url" 5 | 6 | "golang.org/x/net/context" 7 | ) 8 | 9 | // ContainerRename changes the name of a given container. 10 | func (cli *Client) ContainerRename(ctx context.Context, containerID, newContainerName string) error { 11 | query := url.Values{} 12 | query.Set("name", newContainerName) 13 | resp, err := cli.post(ctx, "/containers/"+containerID+"/rename", query, nil, nil) 14 | ensureReaderClosed(resp) 15 | return err 16 | } 17 | -------------------------------------------------------------------------------- /docker/docker-dev-custom-cfg-kafka/grafana-datasources/graphite.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | datasources: 3 | - name: graphite 4 | type: graphite 5 | access: proxy 6 | orgId: 1 7 | url: http://caddy:8081 8 | isDefault: false 9 | jsonData: 10 | graphiteVersion: "1.1" 11 | version: 1 12 | editable: true 13 | - name: graphite2 14 | type: graphite 15 | access: proxy 16 | orgId: 1 17 | url: http://caddy:8082 18 | isDefault: false 19 | jsonData: 20 | graphiteVersion: "1.1" 21 | version: 1 22 | editable: true 23 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/checkpoint_create.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "github.com/docker/docker/api/types" 5 | "golang.org/x/net/context" 6 | ) 7 | 8 | // CheckpointCreate creates a checkpoint from the given container with the given name 9 | func (cli *Client) CheckpointCreate(ctx context.Context, container string, options types.CheckpointCreateOptions) error { 10 | resp, err := cli.post(ctx, "/containers/"+container+"/checkpoints", nil, options, nil) 11 | ensureReaderClosed(resp) 12 | return err 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_solaris_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go 11 | // 12 | 13 | TEXT ·sysvicall6(SB),NOSPLIT,$0-88 14 | JMP syscall·sysvicall6(SB) 15 | 16 | TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88 17 | JMP syscall·rawSysvicall6(SB) 18 | -------------------------------------------------------------------------------- /vendor/google.golang.org/appengine/internal/identity.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. All rights reserved. 2 | // Use of this source code is governed by the Apache 2.0 3 | // license that can be found in the LICENSE file. 4 | 5 | package internal 6 | 7 | import netcontext "golang.org/x/net/context" 8 | 9 | // These functions are implementations of the wrapper functions 10 | // in ../appengine/identity.go. See that file for commentary. 11 | 12 | func AppID(c netcontext.Context) string { 13 | return appID(FullyQualifiedAppID(c)) 14 | } 15 | -------------------------------------------------------------------------------- /expr/tagquery/utils.go: -------------------------------------------------------------------------------- 1 | package tagquery 2 | 3 | import ( 4 | "strings" 5 | 6 | "github.com/grafana/metrictank/errors" 7 | ) 8 | 9 | // validateQueryExpressionTagKey validates the key of a tag query expression 10 | func validateQueryExpressionTagKey(key string) error { 11 | if len(key) == 0 { 12 | return errors.NewBadRequestf("Tag query expression key must not be empty") 13 | } 14 | 15 | if strings.ContainsAny(key, ";!^=") { 16 | return errors.NewBadRequestf("Invalid character in tag key %s ", key) 17 | } 18 | return nil 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/plugin_push.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "io" 5 | 6 | "golang.org/x/net/context" 7 | ) 8 | 9 | // PluginPush pushes a plugin to a registry 10 | func (cli *Client) PluginPush(ctx context.Context, name string, registryAuth string) (io.ReadCloser, error) { 11 | headers := map[string][]string{"X-Registry-Auth": {registryAuth}} 12 | resp, err := cli.post(ctx, "/plugins/"+name+"/push", nil, nil, headers) 13 | if err != nil { 14 | return nil, err 15 | } 16 | return resp.body, nil 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_others.go: -------------------------------------------------------------------------------- 1 | // +build appengine js nacl 2 | 3 | package isatty 4 | 5 | // IsTerminal returns true if the file descriptor is terminal which 6 | // is always false on js and appengine classic which is a sandboxed PaaS. 7 | func IsTerminal(fd uintptr) bool { 8 | return false 9 | } 10 | 11 | // IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2 12 | // terminal. This is also always false on this environment. 13 | func IsCygwinTerminal(fd uintptr) bool { 14 | return false 15 | } 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/http2/not_go16.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !go1.6 6 | 7 | package http2 8 | 9 | import ( 10 | "net/http" 11 | "time" 12 | ) 13 | 14 | func configureTransport(t1 *http.Transport) (*Transport, error) { 15 | return nil, errTransportVersion 16 | } 17 | 18 | func transportExpectContinueTimeout(t1 *http.Transport) time.Duration { 19 | return 0 20 | 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/raintank/met/dogstatsd/meter.go: -------------------------------------------------------------------------------- 1 | // it's commonly used for non-timer cases where we want these summaries, that's 2 | // what this is for. 3 | package dogstatsd 4 | 5 | import "github.com/raintank/met" 6 | 7 | type Meter struct { 8 | key string 9 | backend Backend 10 | } 11 | 12 | func (b Backend) NewMeter(key string, val int64) met.Meter { 13 | m := Meter{key, b} 14 | m.Value(val) 15 | return m 16 | } 17 | 18 | func (m Meter) Value(val int64) { 19 | m.backend.client.Histogram(m.key, float64(val), []string{}, 1) 20 | } 21 | -------------------------------------------------------------------------------- /schema/reslice.go: -------------------------------------------------------------------------------- 1 | package schema 2 | 3 | // Reslice reslices a slice into smaller slices of the given max size. 4 | func Reslice(in []*MetricData, size int) [][]*MetricData { 5 | numSubSlices := len(in) / size 6 | if len(in)%size > 0 { 7 | numSubSlices += 1 8 | } 9 | out := make([][]*MetricData, numSubSlices) 10 | for i := 0; i < numSubSlices; i++ { 11 | start := i * size 12 | end := (i + 1) * size 13 | if end > len(in) { 14 | out[i] = in[start:] 15 | } else { 16 | out[i] = in[start:end] 17 | } 18 | } 19 | return out 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/xdg/stringprep/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 by David A. Golden. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | // Package stringprep provides data tables and algorithms for RFC-3454, 8 | // including errata (as of 2018-02). It also provides a profile for 9 | // SASLprep as defined in RFC-4013. 10 | package stringprep 11 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **Additional context** 14 | Add any other context about the problem here. 15 | 16 | **Helpful Information** 17 | Metrictank Version: 18 | Golang Version: 19 | OS: 20 | Please also list any other software versions you think would be useful to debug the problem (i.e. Cassandra, Kafka, etc...): 21 | -------------------------------------------------------------------------------- /cmd/mt-fakemetrics/out/saramahelper.go: -------------------------------------------------------------------------------- 1 | package out 2 | 3 | import ( 4 | "github.com/Shopify/sarama" 5 | log "github.com/sirupsen/logrus" 6 | ) 7 | 8 | func GetCompression(codec string) sarama.CompressionCodec { 9 | switch codec { 10 | case "none": 11 | return sarama.CompressionNone 12 | case "gzip": 13 | return sarama.CompressionGZIP 14 | case "snappy": 15 | return sarama.CompressionSnappy 16 | default: 17 | log.Fatalf("unknown compression codec %q", codec) 18 | return 0 // make go compiler happy, needs a return *roll eyes* 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/node_remove.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/docker/docker/api/types" 7 | 8 | "golang.org/x/net/context" 9 | ) 10 | 11 | // NodeRemove removes a Node. 12 | func (cli *Client) NodeRemove(ctx context.Context, nodeID string, options types.NodeRemoveOptions) error { 13 | query := url.Values{} 14 | if options.Force { 15 | query.Set("force", "1") 16 | } 17 | 18 | resp, err := cli.delete(ctx, "/nodes/"+nodeID, query, nil) 19 | ensureReaderClosed(resp) 20 | return err 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/plugin_remove.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/docker/docker/api/types" 7 | "golang.org/x/net/context" 8 | ) 9 | 10 | // PluginRemove removes a plugin 11 | func (cli *Client) PluginRemove(ctx context.Context, name string, options types.PluginRemoveOptions) error { 12 | query := url.Values{} 13 | if options.Force { 14 | query.Set("force", "1") 15 | } 16 | 17 | resp, err := cli.delete(ctx, "/plugins/"+name, query, nil) 18 | ensureReaderClosed(resp) 19 | return err 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/hcl.go: -------------------------------------------------------------------------------- 1 | // Package hcl decodes HCL into usable Go structures. 2 | // 3 | // hcl input can come in either pure HCL format or JSON format. 4 | // It can be parsed into an AST, and then decoded into a structure, 5 | // or it can be decoded directly from a string into a structure. 6 | // 7 | // If you choose to parse HCL into a raw AST, the benefit is that you 8 | // can write custom visitor implementations to implement custom 9 | // semantic checks. By default, HCL does not perform any semantic 10 | // checks. 11 | package hcl 12 | -------------------------------------------------------------------------------- /vendor/github.com/rcrowley/go-metrics/metrics.go: -------------------------------------------------------------------------------- 1 | // Go port of Coda Hale's Metrics library 2 | // 3 | // 4 | // 5 | // Coda Hale's original work: 6 | package metrics 7 | 8 | // UseNilMetrics is checked by the constructor functions for all of the 9 | // standard metrics. If it is true, the metric returned is a stub. 10 | // 11 | // This global kill-switch helps quantify the observer effect and makes 12 | // for less cluttered pprof profiles. 13 | var UseNilMetrics bool = false 14 | -------------------------------------------------------------------------------- /mdata/chunk/format.go: -------------------------------------------------------------------------------- 1 | package chunk 2 | 3 | // this exists so that we can later add more formats, perhaps for int/uint/float32/bool specific optimisations, or other encoding/decoding/compression algorithms 4 | // and have an easy time distinguishing the binary blobs 5 | 6 | //go:generate stringer -type=Format 7 | 8 | type Format uint8 9 | 10 | // identifier of message format 11 | const ( 12 | FormatStandardGoTsz Format = iota 13 | FormatStandardGoTszWithSpan 14 | FormatGoTszLongWithSpan // like FormatStandardGoTszWithSpan but using tsz.SeriesLong 15 | ) 16 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/container_kill.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "net/url" 5 | 6 | "golang.org/x/net/context" 7 | ) 8 | 9 | // ContainerKill terminates the container process but does not remove the container from the docker host. 10 | func (cli *Client) ContainerKill(ctx context.Context, containerID, signal string) error { 11 | query := url.Values{} 12 | query.Set("signal", signal) 13 | 14 | resp, err := cli.post(ctx, "/containers/"+containerID+"/kill", query, nil, nil) 15 | ensureReaderClosed(resp) 16 | return err 17 | } 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo,linux,amd64 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | //extern gettimeofday 12 | func realGettimeofday(*Timeval, *byte) int32 13 | 14 | func gettimeofday(tv *Timeval) (err syscall.Errno) { 15 | r := realGettimeofday(tv, nil) 16 | if r < 0 { 17 | return syscall.GetErrno() 18 | } 19 | return 0 20 | } 21 | -------------------------------------------------------------------------------- /scripts/config/systemd/metrictank.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Starts and stops a single metrictank instance on this system 3 | Documentation=https://github.com/grafana/metrictank/tree/master/docs 4 | Wants=network-online.target 5 | After=network-online.target 6 | 7 | [Service] 8 | User=root 9 | Group=root 10 | Type=simple 11 | Restart=on-failure 12 | WorkingDirectory=/var/run/metrictank 13 | ExecStart=/usr/bin/metrictank -config=/etc/metrictank/metrictank.ini 14 | LimitNOFILE=102400 15 | TimeoutStopSec=60 16 | 17 | [Install] 18 | WantedBy=multi-user.target 19 | 20 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/plugin_disable.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/docker/docker/api/types" 7 | "golang.org/x/net/context" 8 | ) 9 | 10 | // PluginDisable disables a plugin 11 | func (cli *Client) PluginDisable(ctx context.Context, name string, options types.PluginDisableOptions) error { 12 | query := url.Values{} 13 | if options.Force { 14 | query.Set("force", "1") 15 | } 16 | resp, err := cli.post(ctx, "/plugins/"+name+"/disable", query, nil, nil) 17 | ensureReaderClosed(resp) 18 | return err 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/tinylib/msgp/msgp/advise_linux.go: -------------------------------------------------------------------------------- 1 | // +build linux,!appengine 2 | 3 | package msgp 4 | 5 | import ( 6 | "os" 7 | "syscall" 8 | ) 9 | 10 | func adviseRead(mem []byte) { 11 | syscall.Madvise(mem, syscall.MADV_SEQUENTIAL|syscall.MADV_WILLNEED) 12 | } 13 | 14 | func adviseWrite(mem []byte) { 15 | syscall.Madvise(mem, syscall.MADV_SEQUENTIAL) 16 | } 17 | 18 | func fallocate(f *os.File, sz int64) error { 19 | err := syscall.Fallocate(int(f.Fd()), 0, 0, sz) 20 | if err == syscall.ENOTSUP { 21 | return f.Truncate(sz) 22 | } 23 | return err 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/Shopify/sarama/list_groups_request.go: -------------------------------------------------------------------------------- 1 | package sarama 2 | 3 | type ListGroupsRequest struct { 4 | } 5 | 6 | func (r *ListGroupsRequest) encode(pe packetEncoder) error { 7 | return nil 8 | } 9 | 10 | func (r *ListGroupsRequest) decode(pd packetDecoder, version int16) (err error) { 11 | return nil 12 | } 13 | 14 | func (r *ListGroupsRequest) key() int16 { 15 | return 16 16 | } 17 | 18 | func (r *ListGroupsRequest) version() int16 { 19 | return 0 20 | } 21 | 22 | func (r *ListGroupsRequest) requiredVersion() KafkaVersion { 23 | return V0_9_0_0 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_tcgets.go: -------------------------------------------------------------------------------- 1 | // +build linux aix 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import "golang.org/x/sys/unix" 7 | 8 | // IsTerminal return true if the file descriptor is terminal. 9 | func IsTerminal(fd uintptr) bool { 10 | _, err := unix.IoctlGetTermios(int(fd), unix.TCGETS) 11 | return err == nil 12 | } 13 | 14 | // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2 15 | // terminal. This is also always false on this environment. 16 | func IsCygwinTerminal(fd uintptr) bool { 17 | return false 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/miekg/dns/COPYRIGHT: -------------------------------------------------------------------------------- 1 | Copyright 2009 The Go Authors. All rights reserved. Use of this source code 2 | is governed by a BSD-style license that can be found in the LICENSE file. 3 | Extensions of the original work are copyright (c) 2011 Miek Gieben 4 | 5 | Copyright 2011 Miek Gieben. All rights reserved. Use of this source code is 6 | governed by a BSD-style license that can be found in the LICENSE file. 7 | 8 | Copyright 2014 CloudFlare. All rights reserved. Use of this source code is 9 | governed by a BSD-style license that can be found in the LICENSE file. 10 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/plugin_enable.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "net/url" 5 | "strconv" 6 | 7 | "github.com/docker/docker/api/types" 8 | "golang.org/x/net/context" 9 | ) 10 | 11 | // PluginEnable enables a plugin 12 | func (cli *Client) PluginEnable(ctx context.Context, name string, options types.PluginEnableOptions) error { 13 | query := url.Values{} 14 | query.Set("timeout", strconv.Itoa(options.Timeout)) 15 | 16 | resp, err := cli.post(ctx, "/plugins/"+name+"/enable", query, nil, nil) 17 | ensureReaderClosed(resp) 18 | return err 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/golang/snappy/AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of Snappy-Go authors for copyright purposes. 2 | # This file is distinct from the CONTRIBUTORS files. 3 | # See the latter for an explanation. 4 | 5 | # Names should be added to this file as 6 | # Name or Organization 7 | # The email address is not required for organizations. 8 | 9 | # Please keep the list sorted. 10 | 11 | Damian Gryski 12 | Google Inc. 13 | Jan Mercl <0xjnml@gmail.com> 14 | Rodolfo Carvalho 15 | Sebastien Binet 16 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cobra/command_win.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package cobra 4 | 5 | import ( 6 | "fmt" 7 | "os" 8 | "time" 9 | 10 | "github.com/inconshreveable/mousetrap" 11 | ) 12 | 13 | var preExecHookFn = preExecHook 14 | 15 | func preExecHook(c *Command) { 16 | if MousetrapHelpText != "" && mousetrap.StartedByExplorer() { 17 | c.Print(MousetrapHelpText) 18 | if MousetrapDisplayDuration > 0 { 19 | time.Sleep(MousetrapDisplayDuration) 20 | } else { 21 | c.Println("Press return to continue...") 22 | fmt.Scanln() 23 | } 24 | os.Exit(1) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/network_disconnect.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "github.com/docker/docker/api/types" 5 | "golang.org/x/net/context" 6 | ) 7 | 8 | // NetworkDisconnect disconnects a container from an existent network in the docker host. 9 | func (cli *Client) NetworkDisconnect(ctx context.Context, networkID, containerID string, force bool) error { 10 | nd := types.NetworkDisconnect{Container: containerID, Force: force} 11 | resp, err := cli.post(ctx, "/networks/"+networkID+"/disconnect", nil, nd, nil) 12 | ensureReaderClosed(resp) 13 | return err 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/node_update.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "net/url" 5 | "strconv" 6 | 7 | "github.com/docker/docker/api/types/swarm" 8 | "golang.org/x/net/context" 9 | ) 10 | 11 | // NodeUpdate updates a Node. 12 | func (cli *Client) NodeUpdate(ctx context.Context, nodeID string, version swarm.Version, node swarm.NodeSpec) error { 13 | query := url.Values{} 14 | query.Set("version", strconv.FormatUint(version.Index, 10)) 15 | resp, err := cli.post(ctx, "/nodes/"+nodeID+"/update", query, node, nil) 16 | ensureReaderClosed(resp) 17 | return err 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/snappy/AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of Snappy-Go authors for copyright purposes. 2 | # This file is distinct from the CONTRIBUTORS files. 3 | # See the latter for an explanation. 4 | 5 | # Names should be added to this file as 6 | # Name or Organization 7 | # The email address is not required for organizations. 8 | 9 | # Please keep the list sorted. 10 | 11 | Damian Gryski 12 | Google Inc. 13 | Jan Mercl <0xjnml@gmail.com> 14 | Rodolfo Carvalho 15 | Sebastien Binet 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/language/gen_common.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | package main 8 | 9 | // This file contains code common to the maketables.go and the package code. 10 | 11 | // langAliasType is the type of an alias in langAliasMap. 12 | type langAliasType int8 13 | 14 | const ( 15 | langDeprecated langAliasType = iota 16 | langMacro 17 | langLegacy 18 | 19 | langAliasTypeUnknown langAliasType = -1 20 | ) 21 | -------------------------------------------------------------------------------- /vendor/google.golang.org/appengine/timeout.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Google Inc. All rights reserved. 2 | // Use of this source code is governed by the Apache 2.0 3 | // license that can be found in the LICENSE file. 4 | 5 | package appengine 6 | 7 | import "golang.org/x/net/context" 8 | 9 | // IsTimeoutError reports whether err is a timeout error. 10 | func IsTimeoutError(err error) bool { 11 | if err == context.DeadlineExceeded { 12 | return true 13 | } 14 | if t, ok := err.(interface { 15 | IsTimeout() bool 16 | }); ok { 17 | return t.IsTimeout() 18 | } 19 | return false 20 | } 21 | -------------------------------------------------------------------------------- /vendor/cloud.google.com/go/AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of cloud authors for copyright purposes. 2 | # This file is distinct from the CONTRIBUTORS files. 3 | # See the latter for an explanation. 4 | 5 | # Names should be added to this file as: 6 | # Name or Organization 7 | # The email address is not required for organizations. 8 | 9 | Filippo Valsorda 10 | Google Inc. 11 | Ingo Oeser 12 | Palm Stone Games, Inc. 13 | Paweł Knap 14 | Péter Szilágyi 15 | Tyler Treat 16 | -------------------------------------------------------------------------------- /vendor/github.com/inconshreveable/mousetrap/trap_others.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package mousetrap 4 | 5 | // StartedByExplorer returns true if the program was invoked by the user 6 | // double-clicking on the executable from explorer.exe 7 | // 8 | // It is conservative and returns false if any of the internal calls fail. 9 | // It does not guarantee that the program was run from a terminal. It only can tell you 10 | // whether it was launched from explorer.exe 11 | // 12 | // On non-Windows platforms, it always returns false. 13 | func StartedByExplorer() bool { 14 | return false 15 | } 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,!gccgo 6 | 7 | package unix 8 | 9 | // SyscallNoError may be used instead of Syscall for syscalls that don't fail. 10 | func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) 11 | 12 | // RawSyscallNoError may be used instead of RawSyscall for syscalls that don't 13 | // fail. 14 | func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/race0.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows,!race 6 | 7 | package windows 8 | 9 | import ( 10 | "unsafe" 11 | ) 12 | 13 | const raceenabled = false 14 | 15 | func raceAcquire(addr unsafe.Pointer) { 16 | } 17 | 18 | func raceReleaseMerge(addr unsafe.Pointer) { 19 | } 20 | 21 | func raceReadRange(addr unsafe.Pointer, len int) { 22 | } 23 | 24 | func raceWriteRange(addr unsafe.Pointer, len int) { 25 | } 26 | -------------------------------------------------------------------------------- /vendor/gopkg.in/jcmturner/rpc.v1/ndr/error.go: -------------------------------------------------------------------------------- 1 | package ndr 2 | 3 | import "fmt" 4 | 5 | // Malformed implements the error interface for malformed NDR encoding errors. 6 | type Malformed struct { 7 | EText string 8 | } 9 | 10 | // Error implements the error interface on the Malformed struct. 11 | func (e Malformed) Error() string { 12 | return fmt.Sprintf("malformed NDR stream: %s", e.EText) 13 | } 14 | 15 | // Errorf formats an error message into a malformed NDR error. 16 | func Errorf(format string, a ...interface{}) Malformed { 17 | return Malformed{EText: fmt.Sprintf(format, a...)} 18 | } 19 | -------------------------------------------------------------------------------- /docker/docker-cluster/grafana-datasources/metrictank.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | datasources: 3 | - name: metrictank 4 | type: graphite 5 | access: proxy 6 | orgId: 1 7 | url: http://caddy:6061 8 | isDefault: true 9 | jsonData: 10 | graphiteVersion: "1.1" 11 | graphiteType: "metrictank" 12 | version: 1 13 | editable: true 14 | - name: metrictank2 15 | type: graphite 16 | access: proxy 17 | orgId: 1 18 | url: http://caddy:6062 19 | isDefault: false 20 | jsonData: 21 | graphiteVersion: "1.1" 22 | graphiteType: "metrictank" 23 | version: 1 24 | editable: true 25 | -------------------------------------------------------------------------------- /docs/overview.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | 3 | ![Overview](https://raw.githubusercontent.com/grafana/metrictank/master/docs/assets/metrictank-highlevel.png) 4 | 5 | Note: 6 | * You can use any, or multiple of the input mechanisms 7 | * multi-tenant setups need [tsdb-gw](https://github.com/raintank/tsdb-gw) in between Grafana and Graphite to authenticate requests before proxying requests to Graphite/Metrictank 8 | * tsdb-gw can also be used as a public ingestion point with native metrics2.0 input, for multi-tenant setups. Clients can then use [carbon-relay-ng](https://github.com/graphite-ng/carbon-relay-ng) to send data. 9 | -------------------------------------------------------------------------------- /mdata/result.go: -------------------------------------------------------------------------------- 1 | package mdata 2 | 3 | import ( 4 | "github.com/grafana/metrictank/mdata/chunk/tsz" 5 | "github.com/grafana/metrictank/schema" 6 | ) 7 | 8 | type Result struct { 9 | // points not available in chunked form (from the ReOrderBuffer if enabled), in timestamp asc order. 10 | // these always go after points decoded from the iters. 11 | Points []schema.Point 12 | Iters []tsz.Iter // chunked data from cache and/or from AggMetric (in time ascending order) 13 | Oldest uint32 // timestamp of oldest point we have, to know when and when not we may need to query slower storage 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/gosuri/uilive/terminal_size_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package uilive 4 | 5 | import ( 6 | "os" 7 | "unsafe" 8 | ) 9 | 10 | func getTermSize() (int, int) { 11 | out, err := os.Open("CONOUT$") 12 | if err != nil { 13 | return 0, 0 14 | } 15 | defer out.Close() 16 | 17 | var csbi consoleScreenBufferInfo 18 | ret, _, _ := procGetConsoleScreenBufferInfo.Call(out.Fd(), uintptr(unsafe.Pointer(&csbi))) 19 | if ret == 0 { 20 | return 0, 0 21 | } 22 | 23 | return int(csbi.window.right - csbi.window.left + 1), int(csbi.window.bottom - csbi.window.top + 1) 24 | } 25 | -------------------------------------------------------------------------------- /scripts/README.md: -------------------------------------------------------------------------------- 1 | directory | use 2 | --------------- | ---- 3 | scripts | scripts for users. to build stuff 4 | scripts/build | sync of root build directory for docker (automatically synced) 5 | scripts/config | config files 6 | scripts/dev | for MT developers. tools to sync config files and docs 7 | scripts/push | to push out to packagecloud, docker, etc (used by CI) 8 | scripts/qa | quality assurance tools (can be called by users or by CI) 9 | scripts/util | utility scripts, used by other scripts 10 | scripts/k8s | docker image and needed scripts for running in k8s 11 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_bsd.go: -------------------------------------------------------------------------------- 1 | // +build darwin freebsd openbsd netbsd dragonfly 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import "golang.org/x/sys/unix" 7 | 8 | // IsTerminal return true if the file descriptor is terminal. 9 | func IsTerminal(fd uintptr) bool { 10 | _, err := unix.IoctlGetTermios(int(fd), unix.TIOCGETA) 11 | return err == nil 12 | } 13 | 14 | // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2 15 | // terminal. This is also always false on this environment. 16 | func IsCygwinTerminal(fd uintptr) bool { 17 | return false 18 | } 19 | -------------------------------------------------------------------------------- /docker/docker-cluster-query/grafana-datasources/metrictank.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | datasources: 3 | - name: metrictank 4 | type: graphite 5 | access: proxy 6 | orgId: 1 7 | url: http://caddy:6061 8 | isDefault: true 9 | jsonData: 10 | graphiteVersion: "1.1" 11 | graphiteType: "metrictank" 12 | version: 1 13 | editable: true 14 | - name: metrictank2 15 | type: graphite 16 | access: proxy 17 | orgId: 1 18 | url: http://caddy:6062 19 | isDefault: false 20 | jsonData: 21 | graphiteVersion: "1.1" 22 | graphiteType: "metrictank" 23 | version: 1 24 | editable: true 25 | -------------------------------------------------------------------------------- /vendor/github.com/Shopify/sarama/api_versions_request.go: -------------------------------------------------------------------------------- 1 | package sarama 2 | 3 | //ApiVersionsRequest ... 4 | type ApiVersionsRequest struct { 5 | } 6 | 7 | func (a *ApiVersionsRequest) encode(pe packetEncoder) error { 8 | return nil 9 | } 10 | 11 | func (a *ApiVersionsRequest) decode(pd packetDecoder, version int16) (err error) { 12 | return nil 13 | } 14 | 15 | func (a *ApiVersionsRequest) key() int16 { 16 | return 18 17 | } 18 | 19 | func (a *ApiVersionsRequest) version() int16 { 20 | return 0 21 | } 22 | 23 | func (a *ApiVersionsRequest) requiredVersion() KafkaVersion { 24 | return V0_10_0_0 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/swarm_inspect.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "encoding/json" 5 | 6 | "github.com/docker/docker/api/types/swarm" 7 | "golang.org/x/net/context" 8 | ) 9 | 10 | // SwarmInspect inspects the Swarm. 11 | func (cli *Client) SwarmInspect(ctx context.Context) (swarm.Swarm, error) { 12 | serverResp, err := cli.get(ctx, "/swarm", nil, nil) 13 | if err != nil { 14 | return swarm.Swarm{}, err 15 | } 16 | 17 | var response swarm.Swarm 18 | err = json.NewDecoder(serverResp.body).Decode(&response) 19 | ensureReaderClosed(serverResp) 20 | return response, err 21 | } 22 | -------------------------------------------------------------------------------- /docker/docker-dev-custom-cfg-kafka/grafana-datasources/metrictank.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | datasources: 3 | - name: metrictank 4 | type: graphite 5 | access: proxy 6 | orgId: 1 7 | url: http://caddy:6061 8 | isDefault: true 9 | jsonData: 10 | graphiteVersion: "1.1" 11 | graphiteType: "metrictank" 12 | version: 1 13 | editable: true 14 | - name: metrictank2 15 | type: graphite 16 | access: proxy 17 | orgId: 1 18 | url: http://caddy:6062 19 | isDefault: false 20 | jsonData: 21 | graphiteVersion: "1.1" 22 | graphiteType: "metrictank" 23 | version: 1 24 | editable: true 25 | -------------------------------------------------------------------------------- /schema/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2015-2019 Grafana Labs 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/plugin_list.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "encoding/json" 5 | 6 | "github.com/docker/docker/api/types" 7 | "golang.org/x/net/context" 8 | ) 9 | 10 | // PluginList returns the installed plugins 11 | func (cli *Client) PluginList(ctx context.Context) (types.PluginsListResponse, error) { 12 | var plugins types.PluginsListResponse 13 | resp, err := cli.get(ctx, "/plugins", nil, nil) 14 | if err != nil { 15 | return plugins, err 16 | } 17 | 18 | err = json.NewDecoder(resp.body).Decode(&plugins) 19 | ensureReaderClosed(resp) 20 | return plugins, err 21 | } 22 | -------------------------------------------------------------------------------- /scripts/qa/gofmt.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # this script checks whether all files (except vendorred and generated files) 4 | # are properly formatted and simplified with gofmt. 5 | 6 | # find the dir we exist within... 7 | DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 8 | # and cd into root project dir 9 | cd ${DIR}/../.. 10 | 11 | out=$(gofmt -d -s $(find . -name '*.go' | grep -v vendor | grep -v _gen.go)) 12 | if [ "$out" != "" ]; then 13 | echo "$out" 14 | echo 15 | echo "You might want to run something like 'find . -name '*.go' -not -path './vendor/*' | xargs gofmt -w -s'" 16 | exit 2 17 | fi 18 | exit 0 19 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/api/types/blkiodev/blkio.go: -------------------------------------------------------------------------------- 1 | package blkiodev 2 | 3 | import "fmt" 4 | 5 | // WeightDevice is a structure that holds device:weight pair 6 | type WeightDevice struct { 7 | Path string 8 | Weight uint16 9 | } 10 | 11 | func (w *WeightDevice) String() string { 12 | return fmt.Sprintf("%s:%d", w.Path, w.Weight) 13 | } 14 | 15 | // ThrottleDevice is a structure that holds device:rate_per_second pair 16 | type ThrottleDevice struct { 17 | Path string 18 | Rate uint64 19 | } 20 | 21 | func (t *ThrottleDevice) String() string { 22 | return fmt.Sprintf("%s:%d", t.Path, t.Rate) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/api/types/plugin_interface_type.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | // This file was generated by the swagger tool. 4 | // Editing this file might prove futile when you re-run the swagger generate command 5 | 6 | // PluginInterfaceType plugin interface type 7 | // swagger:model PluginInterfaceType 8 | type PluginInterfaceType struct { 9 | 10 | // capability 11 | // Required: true 12 | Capability string `json:"Capability"` 13 | 14 | // prefix 15 | // Required: true 16 | Prefix string `json:"Prefix"` 17 | 18 | // version 19 | // Required: true 20 | Version string `json:"Version"` 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/container_export.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "io" 5 | "net/url" 6 | 7 | "golang.org/x/net/context" 8 | ) 9 | 10 | // ContainerExport retrieves the raw contents of a container 11 | // and returns them as an io.ReadCloser. It's up to the caller 12 | // to close the stream. 13 | func (cli *Client) ContainerExport(ctx context.Context, containerID string) (io.ReadCloser, error) { 14 | serverResp, err := cli.get(ctx, "/containers/"+containerID+"/export", url.Values{}, nil) 15 | if err != nil { 16 | return nil, err 17 | } 18 | 19 | return serverResp.body, nil 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/swarm_init.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "encoding/json" 5 | 6 | "github.com/docker/docker/api/types/swarm" 7 | "golang.org/x/net/context" 8 | ) 9 | 10 | // SwarmInit initializes the Swarm. 11 | func (cli *Client) SwarmInit(ctx context.Context, req swarm.InitRequest) (string, error) { 12 | serverResp, err := cli.post(ctx, "/swarm/init", nil, req, nil) 13 | if err != nil { 14 | return "", err 15 | } 16 | 17 | var response string 18 | err = json.NewDecoder(serverResp.body).Decode(&response) 19 | ensureReaderClosed(serverResp) 20 | return response, err 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/docker/go-connections/tlsconfig/config_client_ciphers.go: -------------------------------------------------------------------------------- 1 | // +build go1.5 2 | 3 | // Package tlsconfig provides primitives to retrieve secure-enough TLS configurations for both clients and servers. 4 | // 5 | package tlsconfig 6 | 7 | import ( 8 | "crypto/tls" 9 | ) 10 | 11 | // Client TLS cipher suites (dropping CBC ciphers for client preferred suite set) 12 | var clientCipherSuites = []uint16{ 13 | tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, 14 | tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, 15 | tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, 16 | tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/gocql/gocql/fuzz.go: -------------------------------------------------------------------------------- 1 | // +build gofuzz 2 | 3 | package gocql 4 | 5 | import "bytes" 6 | 7 | func Fuzz(data []byte) int { 8 | var bw bytes.Buffer 9 | 10 | r := bytes.NewReader(data) 11 | 12 | head, err := readHeader(r, make([]byte, 9)) 13 | if err != nil { 14 | return 0 15 | } 16 | 17 | framer := newFramer(r, &bw, nil, byte(head.version)) 18 | err = framer.readFrame(&head) 19 | if err != nil { 20 | return 0 21 | } 22 | 23 | frame, err := framer.parseFrame() 24 | if err != nil { 25 | return 0 26 | } 27 | 28 | if frame != nil { 29 | return 1 30 | } 31 | 32 | return 2 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/metrics20/go-metrics20/carbon20/validationlevelm20_string.go: -------------------------------------------------------------------------------- 1 | // generated by stringer -type=ValidationLevelM20; DO NOT EDIT 2 | 3 | package carbon20 4 | 5 | import "fmt" 6 | 7 | const _ValidationLevelM20_name = "StrictM20MediumM20NoneM20" 8 | 9 | var _ValidationLevelM20_index = [...]uint8{0, 9, 18, 25} 10 | 11 | func (i ValidationLevelM20) String() string { 12 | if i < 0 || i >= ValidationLevelM20(len(_ValidationLevelM20_index)-1) { 13 | return fmt.Sprintf("ValidationLevelM20(%d)", i) 14 | } 15 | return _ValidationLevelM20_name[_ValidationLevelM20_index[i]:_ValidationLevelM20_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/types_windows_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package windows 6 | 7 | type WSAData struct { 8 | Version uint16 9 | HighVersion uint16 10 | Description [WSADESCRIPTION_LEN + 1]byte 11 | SystemStatus [WSASYS_STATUS_LEN + 1]byte 12 | MaxSockets uint16 13 | MaxUdpDg uint16 14 | VendorInfo *byte 15 | } 16 | 17 | type Servent struct { 18 | Name *byte 19 | Aliases **byte 20 | Port uint16 21 | Proto *byte 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/types_windows_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package windows 6 | 7 | type WSAData struct { 8 | Version uint16 9 | HighVersion uint16 10 | MaxSockets uint16 11 | MaxUdpDg uint16 12 | VendorInfo *byte 13 | Description [WSADESCRIPTION_LEN + 1]byte 14 | SystemStatus [WSASYS_STATUS_LEN + 1]byte 15 | } 16 | 17 | type Servent struct { 18 | Name *byte 19 | Aliases **byte 20 | Proto *byte 21 | Port uint16 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/types_windows_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package windows 6 | 7 | type WSAData struct { 8 | Version uint16 9 | HighVersion uint16 10 | Description [WSADESCRIPTION_LEN + 1]byte 11 | SystemStatus [WSASYS_STATUS_LEN + 1]byte 12 | MaxSockets uint16 13 | MaxUdpDg uint16 14 | VendorInfo *byte 15 | } 16 | 17 | type Servent struct { 18 | Name *byte 19 | Aliases **byte 20 | Port uint16 21 | Proto *byte 22 | } 23 | -------------------------------------------------------------------------------- /schema/control.go: -------------------------------------------------------------------------------- 1 | package schema 2 | 3 | //go:generate stringer -type=Operation 4 | //go:generate msgp 5 | 6 | type Operation uint8 7 | 8 | const ( 9 | OpRemove Operation = iota // Remove metric definition from index 10 | OpArchive // Archive metric definition 11 | OpRestore // Restore deleted/archived metric definition 12 | ) 13 | 14 | // ControlMsg is a message to perform some operation on the specified definition 15 | type ControlMsg struct { 16 | Defs []MetricDefinition 17 | Op Operation 18 | } 19 | 20 | func (c *ControlMsg) Valid() bool { 21 | return c.Op <= OpRestore 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/image_save.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "io" 5 | "net/url" 6 | 7 | "golang.org/x/net/context" 8 | ) 9 | 10 | // ImageSave retrieves one or more images from the docker host as an io.ReadCloser. 11 | // It's up to the caller to store the images and close the stream. 12 | func (cli *Client) ImageSave(ctx context.Context, imageIDs []string) (io.ReadCloser, error) { 13 | query := url.Values{ 14 | "names": imageIDs, 15 | } 16 | 17 | resp, err := cli.get(ctx, "/images/get", query, nil) 18 | if err != nil { 19 | return nil, err 20 | } 21 | return resp.body, nil 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/version.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "encoding/json" 5 | 6 | "github.com/docker/docker/api/types" 7 | "golang.org/x/net/context" 8 | ) 9 | 10 | // ServerVersion returns information of the docker client and server host. 11 | func (cli *Client) ServerVersion(ctx context.Context) (types.Version, error) { 12 | resp, err := cli.get(ctx, "/version", nil, nil) 13 | if err != nil { 14 | return types.Version{}, err 15 | } 16 | 17 | var server types.Version 18 | err = json.NewDecoder(resp.body).Decode(&server) 19 | ensureReaderClosed(resp) 20 | return server, err 21 | } 22 | -------------------------------------------------------------------------------- /api/middleware/capturebody.go: -------------------------------------------------------------------------------- 1 | package middleware 2 | 3 | import ( 4 | "bytes" 5 | "io/ioutil" 6 | "net/http" 7 | 8 | log "github.com/sirupsen/logrus" 9 | ) 10 | 11 | func CaptureBody(c *Context) { 12 | body, err := ioutil.ReadAll(c.Req.Request.Body) 13 | if err != nil { 14 | log.Errorf("HTTP internal error: failed to read request body for proxying: %s", err.Error()) 15 | c.PlainText(http.StatusInternalServerError, []byte("internal error: failed to read request body for proxying")) 16 | } 17 | c.Req.Request.Body = ioutil.NopCloser(bytes.NewBuffer(body)) 18 | c.Body = ioutil.NopCloser(bytes.NewBuffer(body)) 19 | } 20 | -------------------------------------------------------------------------------- /docs/kafka.md: -------------------------------------------------------------------------------- 1 | # why 2 | 3 | Kafka can be used as an [ingestion option](https://github.com/grafana/metrictank/blob/master/docs/inputs.md) as well as a [clustering transport](https://github.com/grafana/metrictank/blob/master/docs/clustering.md) for metrictank. 4 | 5 | # Kafka version 6 | 7 | Kafka v2.0.0 or newer is recommended. 8 | Older versions should still work 9 | 10 | If you use 0.10.0.0 and want snappy compression, watch out for [kafka-3789](https://issues.apache.org/jira/browse/KAFKA-3789) as you'll need to do a hack [like this](https://github.com/raintank/raintank-docker/commit/e98883b08f343d896a3333801f16c7a603e89422) 11 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/api/types/container/container_update.go: -------------------------------------------------------------------------------- 1 | package container 2 | 3 | // ---------------------------------------------------------------------------- 4 | // DO NOT EDIT THIS FILE 5 | // This file was generated by `swagger generate operation` 6 | // 7 | // See hack/swagger-gen.sh 8 | // ---------------------------------------------------------------------------- 9 | 10 | // ContainerUpdateOKBody container update o k body 11 | // swagger:model ContainerUpdateOKBody 12 | type ContainerUpdateOKBody struct { 13 | 14 | // warnings 15 | // Required: true 16 | Warnings []string `json:"Warnings"` 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/volume_remove.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/docker/docker/api/types/versions" 7 | "golang.org/x/net/context" 8 | ) 9 | 10 | // VolumeRemove removes a volume from the docker host. 11 | func (cli *Client) VolumeRemove(ctx context.Context, volumeID string, force bool) error { 12 | query := url.Values{} 13 | if versions.GreaterThanOrEqualTo(cli.version, "1.25") { 14 | if force { 15 | query.Set("force", "1") 16 | } 17 | } 18 | resp, err := cli.delete(ctx, "/volumes/"+volumeID, query, nil) 19 | ensureReaderClosed(resp) 20 | return err 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_plan9.go: -------------------------------------------------------------------------------- 1 | // +build plan9 2 | 3 | package isatty 4 | 5 | import ( 6 | "syscall" 7 | ) 8 | 9 | // IsTerminal returns true if the given file descriptor is a terminal. 10 | func IsTerminal(fd uintptr) bool { 11 | path, err := syscall.Fd2path(int(fd)) 12 | if err != nil { 13 | return false 14 | } 15 | return path == "/dev/cons" || path == "/mnt/term/dev/cons" 16 | } 17 | 18 | // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2 19 | // terminal. This is also always false on this environment. 20 | func IsCygwinTerminal(fd uintptr) bool { 21 | return false 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/str.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows 6 | 7 | package windows 8 | 9 | func itoa(val int) string { // do it here rather than with fmt to avoid dependency 10 | if val < 0 { 11 | return "-" + itoa(-val) 12 | } 13 | var buf [32]byte // big enough for int64 14 | i := len(buf) - 1 15 | for val >= 10 { 16 | buf[i] = byte(val%10 + '0') 17 | i-- 18 | val /= 10 19 | } 20 | buf[i] = byte(val + '0') 21 | return string(buf[i:]) 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/api/types/container/container_wait.go: -------------------------------------------------------------------------------- 1 | package container 2 | 3 | // ---------------------------------------------------------------------------- 4 | // DO NOT EDIT THIS FILE 5 | // This file was generated by `swagger generate operation` 6 | // 7 | // See hack/swagger-gen.sh 8 | // ---------------------------------------------------------------------------- 9 | 10 | // ContainerWaitOKBody container wait o k body 11 | // swagger:model ContainerWaitOKBody 12 | type ContainerWaitOKBody struct { 13 | 14 | // Exit code of the container 15 | // Required: true 16 | StatusCode int64 `json:"StatusCode"` 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/api/types/port.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | // This file was generated by the swagger tool. 4 | // Editing this file might prove futile when you re-run the swagger generate command 5 | 6 | // Port An open port on a container 7 | // swagger:model Port 8 | type Port struct { 9 | 10 | // IP 11 | IP string `json:"IP,omitempty"` 12 | 13 | // Port on the container 14 | // Required: true 15 | PrivatePort uint16 `json:"PrivatePort"` 16 | 17 | // Port exposed on the host 18 | PublicPort uint16 `json:"PublicPort,omitempty"` 19 | 20 | // type 21 | // Required: true 22 | Type string `json:"Type"` 23 | } 24 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/NOTICE: -------------------------------------------------------------------------------- 1 | Copyright 2011-2016 Canonical Ltd. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /consolidation/LICENSE.TXT: -------------------------------------------------------------------------------- 1 | Copyright 2018 Grafana Labs 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use the files in this directory 5 | except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | -------------------------------------------------------------------------------- /vendor/github.com/Shopify/sarama/response_header.go: -------------------------------------------------------------------------------- 1 | package sarama 2 | 3 | import "fmt" 4 | 5 | const responseLengthSize = 4 6 | const correlationIDSize = 4 7 | 8 | type responseHeader struct { 9 | length int32 10 | correlationID int32 11 | } 12 | 13 | func (r *responseHeader) decode(pd packetDecoder) (err error) { 14 | r.length, err = pd.getInt32() 15 | if err != nil { 16 | return err 17 | } 18 | if r.length <= 4 || r.length > MaxResponseSize { 19 | return PacketDecodingError{fmt.Sprintf("message of length %d too large or too small", r.length)} 20 | } 21 | 22 | r.correlationID, err = pd.getInt32() 23 | return err 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/inconshreveable/mousetrap/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2014 Alan Shreve 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /vendor/github.com/miekg/dns/udp_other.go: -------------------------------------------------------------------------------- 1 | // +build !linux,!plan9 2 | 3 | package dns 4 | 5 | import ( 6 | "net" 7 | "syscall" 8 | ) 9 | 10 | // These do nothing. See udp_linux.go for an example of how to implement this. 11 | 12 | // We tried to adhire to some kind of naming scheme. 13 | 14 | func setUDPSocketOptions4(conn *net.UDPConn) error { return nil } 15 | func setUDPSocketOptions6(conn *net.UDPConn) error { return nil } 16 | func getUDPSocketOptions6Only(conn *net.UDPConn) (bool, error) { return false, nil } 17 | func getUDPSocketName(conn *net.UDPConn) (syscall.Sockaddr, error) { return nil, nil } 18 | -------------------------------------------------------------------------------- /batch/LICENSE.TXT: -------------------------------------------------------------------------------- 1 | Copyright 2018 Grafana Labs, Bloomberg 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use the files in this directory 5 | except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | -------------------------------------------------------------------------------- /docker/docker-dev-custom-cfg-kafka/caddy/Caddyfile: -------------------------------------------------------------------------------- 1 | :6061 { 2 | proxy / metrictank:6060 { 3 | header_upstream x-org-id 1 4 | } 5 | errors stderr 6 | tls off 7 | } 8 | 9 | :6062 { 10 | proxy / metrictank:6060 { 11 | header_upstream x-org-id 2 12 | } 13 | errors stderr 14 | tls off 15 | } 16 | 17 | :8081 { 18 | proxy / graphite { 19 | header_upstream x-org-id 1 20 | } 21 | errors stderr 22 | tls off 23 | } 24 | 25 | :8082 { 26 | proxy / graphite { 27 | header_upstream x-org-id 2 28 | } 29 | errors stderr 30 | tls off 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/api/types/plugin_env.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | // This file was generated by the swagger tool. 4 | // Editing this file might prove futile when you re-run the swagger generate command 5 | 6 | // PluginEnv plugin env 7 | // swagger:model PluginEnv 8 | type PluginEnv struct { 9 | 10 | // description 11 | // Required: true 12 | Description string `json:"Description"` 13 | 14 | // name 15 | // Required: true 16 | Name string `json:"Name"` 17 | 18 | // settable 19 | // Required: true 20 | Settable []string `json:"Settable"` 21 | 22 | // value 23 | // Required: true 24 | Value *string `json:"Value"` 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/pelletier/go-toml/fuzz.go: -------------------------------------------------------------------------------- 1 | // +build gofuzz 2 | 3 | package toml 4 | 5 | func Fuzz(data []byte) int { 6 | tree, err := LoadBytes(data) 7 | if err != nil { 8 | if tree != nil { 9 | panic("tree must be nil if there is an error") 10 | } 11 | return 0 12 | } 13 | 14 | str, err := tree.ToTomlString() 15 | if err != nil { 16 | if str != "" { 17 | panic(`str must be "" if there is an error`) 18 | } 19 | panic(err) 20 | } 21 | 22 | tree, err = Load(str) 23 | if err != nil { 24 | if tree != nil { 25 | panic("tree must be nil if there is an error") 26 | } 27 | return 0 28 | } 29 | 30 | return 1 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/sergi/go-diff/diffmatchpatch/mathutil.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016 The go-diff authors. All rights reserved. 2 | // https://github.com/sergi/go-diff 3 | // See the included LICENSE file for license details. 4 | // 5 | // go-diff is a Go implementation of Google's Diff, Match, and Patch library 6 | // Original library is Copyright (c) 2006 Google Inc. 7 | // http://code.google.com/p/google-diff-match-patch/ 8 | 9 | package diffmatchpatch 10 | 11 | func min(x, y int) int { 12 | if x < y { 13 | return x 14 | } 15 | return y 16 | } 17 | 18 | func max(x, y int) int { 19 | if x > y { 20 | return x 21 | } 22 | return y 23 | } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/race0.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly 6 | 7 | package unix 8 | 9 | import ( 10 | "unsafe" 11 | ) 12 | 13 | const raceenabled = false 14 | 15 | func raceAcquire(addr unsafe.Pointer) { 16 | } 17 | 18 | func raceReleaseMerge(addr unsafe.Pointer) { 19 | } 20 | 21 | func raceReadRange(addr unsafe.Pointer, len int) { 22 | } 23 | 24 | func raceWriteRange(addr unsafe.Pointer, len int) { 25 | } 26 | -------------------------------------------------------------------------------- /vendor/gopkg.in/jcmturner/gokrb5.v7/crypto/rfc4757/msgtype.go: -------------------------------------------------------------------------------- 1 | package rfc4757 2 | 3 | import "encoding/binary" 4 | 5 | // UsageToMSMsgType converts Kerberos key usage numbers to Microsoft message type encoded as a little-endian four byte slice. 6 | func UsageToMSMsgType(usage uint32) []byte { 7 | // Translate usage numbers to the Microsoft T numbers 8 | switch usage { 9 | case 3: 10 | usage = 8 11 | case 9: 12 | usage = 8 13 | case 23: 14 | usage = 13 15 | } 16 | // Now convert to bytes 17 | tb := make([]byte, 4) // We force an int32 input so we can't go over 4 bytes 18 | binary.PutUvarint(tb, uint64(usage)) 19 | return tb 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/gogo/protobuf/AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of GoGo authors for copyright purposes. 2 | # This file is distinct from the CONTRIBUTORS file, which 3 | # lists people. For example, employees are listed in CONTRIBUTORS, 4 | # but not in AUTHORS, because the employer holds the copyright. 5 | 6 | # Names should be added to this file as one of 7 | # Organization's name 8 | # Individual's name 9 | # Individual's name 10 | 11 | # Please keep the list sorted. 12 | 13 | Sendgrid, Inc 14 | Vastech SA (PTY) LTD 15 | Walter Schulze 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,solaris 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: usec} 15 | } 16 | 17 | func (iov *Iovec) SetLen(length int) { 18 | iov.Len = uint64(length) 19 | } 20 | 21 | func (cmsg *Cmsghdr) SetLen(length int) { 22 | cmsg.Len = uint32(length) 23 | } 24 | -------------------------------------------------------------------------------- /scripts/push/gcr.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | # Find the directory we exist within 4 | DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 5 | cd ${DIR}/../.. 6 | source scripts/version-tag.sh 7 | 8 | echo 9 | echo "### docker login to us.gcr.io" 10 | echo 11 | 12 | docker login -u _json_key -p "$GOOGLE_AUTH" https://us.gcr.io 13 | 14 | echo 15 | echo "### docker push us.gcr.io/metrictank-gcr/metrictank:$version" 16 | echo 17 | 18 | docker push us.gcr.io/metrictank-gcr/metrictank:$version || exit 2 19 | 20 | echo 21 | echo "### docker push us.gcr.io/metrictank-gcr/metrictank:$tag" 22 | echo 23 | 24 | docker push us.gcr.io/metrictank-gcr/metrictank:$tag 25 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/api/types/plugin_device.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | // This file was generated by the swagger tool. 4 | // Editing this file might prove futile when you re-run the swagger generate command 5 | 6 | // PluginDevice plugin device 7 | // swagger:model PluginDevice 8 | type PluginDevice struct { 9 | 10 | // description 11 | // Required: true 12 | Description string `json:"Description"` 13 | 14 | // name 15 | // Required: true 16 | Name string `json:"Name"` 17 | 18 | // path 19 | // Required: true 20 | Path *string `json:"Path"` 21 | 22 | // settable 23 | // Required: true 24 | Settable []string `json:"Settable"` 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/raintank/worldping-api/LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright 2015-2016 Raintank Inc. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); you 4 | may not use this file except in compliance with the License. You may 5 | obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 | implied. See the License for the specific language governing 13 | permissions and limitations under the License. 14 | 15 | -------------------------------------------------------------------------------- /vendor/gopkg.in/jcmturner/gokrb5.v7/iana/asnAppTag/constants.go: -------------------------------------------------------------------------------- 1 | // Package asnAppTag provides ASN1 application tag numbers. 2 | package asnAppTag 3 | 4 | // ASN1 application tag numbers. 5 | const ( 6 | Ticket = 1 7 | Authenticator = 2 8 | EncTicketPart = 3 9 | ASREQ = 10 10 | TGSREQ = 12 11 | ASREP = 11 12 | TGSREP = 13 13 | APREQ = 14 14 | APREP = 15 15 | KRBSafe = 20 16 | KRBPriv = 21 17 | KRBCred = 22 18 | EncASRepPart = 25 19 | EncTGSRepPart = 26 20 | EncAPRepPart = 27 21 | EncKrbPrivPart = 28 22 | EncKrbCredPart = 29 23 | KRBError = 30 24 | ) 25 | -------------------------------------------------------------------------------- /cmd/mt-fakemetrics/cmd/getbuilder.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "github.com/grafana/metrictank/cmd/mt-fakemetrics/metricbuilder" 5 | ) 6 | 7 | func getBuilder(metricBuilder, metricName string) metricbuilder.Builder { 8 | switch metricBuilder { 9 | case "tagged": 10 | return metricbuilder.Tagged{ 11 | MetricName: metricName, 12 | CustomTags: customTags, 13 | AddTags: addTags, 14 | NumUniqueCustomTags: numUniqueCustomTags, 15 | NumUniqueTags: numUniqueTags, 16 | } 17 | case "simple": 18 | return metricbuilder.Simple{metricName} 19 | } 20 | panic("unknown metricbuilder :" + metricBuilder) 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/Shopify/sarama/zstd.go: -------------------------------------------------------------------------------- 1 | package sarama 2 | 3 | import ( 4 | "github.com/klauspost/compress/zstd" 5 | "sync" 6 | ) 7 | 8 | var ( 9 | zstdDec *zstd.Decoder 10 | zstdEnc *zstd.Encoder 11 | 12 | zstdEncOnce, zstdDecOnce sync.Once 13 | ) 14 | 15 | func zstdDecompress(dst, src []byte) ([]byte, error) { 16 | zstdDecOnce.Do(func() { 17 | zstdDec, _ = zstd.NewReader(nil) 18 | }) 19 | return zstdDec.DecodeAll(src, dst) 20 | } 21 | 22 | func zstdCompress(dst, src []byte) ([]byte, error) { 23 | zstdEncOnce.Do(func() { 24 | zstdEnc, _ = zstd.NewWriter(nil, zstd.WithZeroFrames(true)) 25 | }) 26 | return zstdEnc.EncodeAll(src, dst), nil 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/metrics20/go-metrics20/carbon20/validationlevellegacy_string.go: -------------------------------------------------------------------------------- 1 | // generated by stringer -type=ValidationLevelLegacy; DO NOT EDIT 2 | 3 | package carbon20 4 | 5 | import "fmt" 6 | 7 | const _ValidationLevelLegacy_name = "StrictLegacyMediumLegacyNoneLegacy" 8 | 9 | var _ValidationLevelLegacy_index = [...]uint8{0, 12, 24, 34} 10 | 11 | func (i ValidationLevelLegacy) String() string { 12 | if i < 0 || i >= ValidationLevelLegacy(len(_ValidationLevelLegacy_index)-1) { 13 | return fmt.Sprintf("ValidationLevelLegacy(%d)", i) 14 | } 15 | return _ValidationLevelLegacy_name[_ValidationLevelLegacy_index[i]:_ValidationLevelLegacy_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /expr/func_mock_test.go: -------------------------------------------------------------------------------- 1 | package expr 2 | 3 | import "github.com/grafana/metrictank/api/models" 4 | 5 | // internal function just for getting data 6 | type FuncMock struct { 7 | data []models.Series 8 | } 9 | 10 | func NewMock(data []models.Series) GraphiteFunc { 11 | return FuncMock{data} 12 | } 13 | 14 | func (s FuncMock) Signature() ([]Arg, []Arg) { 15 | return nil, []Arg{ArgSeries{}} 16 | } 17 | 18 | func (s FuncMock) Context(context Context) Context { 19 | return context 20 | } 21 | 22 | func (s FuncMock) Exec(dataMap DataMap) ([]models.Series, error) { 23 | for i := range s.data { 24 | s.data[i].SetTags() 25 | } 26 | 27 | return s.data, nil 28 | } 29 | -------------------------------------------------------------------------------- /test/path.go: -------------------------------------------------------------------------------- 1 | package test 2 | 3 | import ( 4 | "os" 5 | "strings" 6 | 7 | homedir "github.com/mitchellh/go-homedir" 8 | p "path" 9 | ) 10 | 11 | // path takes a relative path within the metrictank repository and returns the full absolute filepath, 12 | // assuming metrictank repo is in the first directory specified in GOPATH 13 | func Path(dst string) string { 14 | gopath := os.Getenv("GOPATH") 15 | if gopath == "" { 16 | var err error 17 | gopath, err = homedir.Expand("~/go") 18 | if err != nil { 19 | panic(err) 20 | } 21 | } 22 | firstPath := strings.Split(gopath, ":")[0] 23 | return p.Join(firstPath, "src/github.com/grafana/metrictank", dst) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/memberlist/merge_delegate.go: -------------------------------------------------------------------------------- 1 | package memberlist 2 | 3 | // MergeDelegate is used to involve a client in 4 | // a potential cluster merge operation. Namely, when 5 | // a node does a TCP push/pull (as part of a join), 6 | // the delegate is involved and allowed to cancel the join 7 | // based on custom logic. The merge delegate is NOT invoked 8 | // as part of the push-pull anti-entropy. 9 | type MergeDelegate interface { 10 | // NotifyMerge is invoked when a merge could take place. 11 | // Provides a list of the nodes known by the peer. If 12 | // the return value is non-nil, the merge is canceled. 13 | NotifyMerge(peers []*Node) error 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/smartystreets/assertions/internal/go-render/render/render_time.go: -------------------------------------------------------------------------------- 1 | package render 2 | 3 | import ( 4 | "reflect" 5 | "time" 6 | ) 7 | 8 | func renderTime(value reflect.Value) (string, bool) { 9 | if instant, ok := convertTime(value); !ok { 10 | return "", false 11 | } else if instant.IsZero() { 12 | return "0", true 13 | } else { 14 | return instant.String(), true 15 | } 16 | } 17 | 18 | func convertTime(value reflect.Value) (t time.Time, ok bool) { 19 | if value.Type() == timeType { 20 | defer func() { recover() }() 21 | t, ok = value.Interface().(time.Time) 22 | } 23 | return 24 | } 25 | 26 | var timeType = reflect.TypeOf(time.Time{}) 27 | -------------------------------------------------------------------------------- /vendor/gopkg.in/alexcesaro/statsd.v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package statsd is a simple and efficient StatsD client. 3 | 4 | Client's methods are fast and do not allocate memory. 5 | 6 | Internally, Client's methods buffers metrics. The buffer is flushed when either: 7 | - the background goroutine flushes the buffer (every 100ms by default) 8 | - the buffer is full (1440 bytes by default so that IP packets are not 9 | fragmented) 10 | 11 | The background goroutine can be disabled using the WithFlushPeriod(0) option. 12 | 13 | Buffering can be disabled using the WithMaxPacketSize(0) option. 14 | 15 | StatsD homepage: https://github.com/etsy/statsd 16 | */ 17 | package statsd 18 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/secret_update.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "net/url" 5 | "strconv" 6 | 7 | "github.com/docker/docker/api/types/swarm" 8 | "golang.org/x/net/context" 9 | ) 10 | 11 | // SecretUpdate updates a Secret. Currently, the only part of a secret spec 12 | // which can be updated is Labels. 13 | func (cli *Client) SecretUpdate(ctx context.Context, id string, version swarm.Version, secret swarm.SecretSpec) error { 14 | query := url.Values{} 15 | query.Set("version", strconv.FormatUint(version.Index, 10)) 16 | resp, err := cli.post(ctx, "/secrets/"+id+"/update", query, secret, nil) 17 | ensureReaderClosed(resp) 18 | return err 19 | } 20 | -------------------------------------------------------------------------------- /vendor/google.golang.org/appengine/appengine_vm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All rights reserved. 2 | // Use of this source code is governed by the Apache 2.0 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !appengine 6 | 7 | package appengine 8 | 9 | import ( 10 | "golang.org/x/net/context" 11 | 12 | "google.golang.org/appengine/internal" 13 | ) 14 | 15 | // BackgroundContext returns a context not associated with a request. 16 | // This should only be used when not servicing a request. 17 | // This only works in App Engine "flexible environment". 18 | func BackgroundContext() context.Context { 19 | return internal.BackgroundContext() 20 | } 21 | -------------------------------------------------------------------------------- /vendor/gopkg.in/jcmturner/gokrb5.v7/types/TypedData.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import "github.com/jcmturner/gofork/encoding/asn1" 4 | 5 | // TypedData implements RFC 4120 type: https://tools.ietf.org/html/rfc4120#section-5.9.1 6 | type TypedData struct { 7 | DataType int32 `asn1:"explicit,tag:0"` 8 | DataValue []byte `asn1:"optional,explicit,tag:1"` 9 | } 10 | 11 | // TypedDataSequence implements RFC 4120 type: https://tools.ietf.org/html/rfc4120#section-5.9.1 12 | type TypedDataSequence []TypedData 13 | 14 | // Unmarshal bytes into the TypedDataSequence. 15 | func (a *TypedDataSequence) Unmarshal(b []byte) error { 16 | _, err := asn1.Unmarshal(b, a) 17 | return err 18 | } 19 | -------------------------------------------------------------------------------- /input/plugin.go: -------------------------------------------------------------------------------- 1 | package input 2 | 3 | import "context" 4 | 5 | type Plugin interface { 6 | Name() string 7 | // Start starts the plugin. 8 | // The plugin calls cancel should any non-recoverable error occur after Start has returned. 9 | // if Start returns an error, or cancel is called by the plugin, 10 | // the caller (e.g. main process) should shut down all its resources and exit. 11 | // Note that upon fatal close, metrictank will call Stop() on all plugins, also the one that triggered it. 12 | Start(handler Handler, cancel context.CancelFunc) error 13 | MaintainPriority() 14 | ExplainPriority() interface{} 15 | Stop() // Should block until shutdown is complete. 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/network_connect.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "github.com/docker/docker/api/types" 5 | "github.com/docker/docker/api/types/network" 6 | "golang.org/x/net/context" 7 | ) 8 | 9 | // NetworkConnect connects a container to an existent network in the docker host. 10 | func (cli *Client) NetworkConnect(ctx context.Context, networkID, containerID string, config *network.EndpointSettings) error { 11 | nc := types.NetworkConnect{ 12 | Container: containerID, 13 | EndpointConfig: config, 14 | } 15 | resp, err := cli.post(ctx, "/networks/"+networkID+"/connect", nil, nc, nil) 16 | ensureReaderClosed(resp) 17 | return err 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/raintank/met/statsd/timer.go: -------------------------------------------------------------------------------- 1 | package statsd 2 | 3 | import "time" 4 | import "github.com/raintank/met" 5 | 6 | // note that due the preseeding in init, you shouldn't rely on the count and count_ps summaries 7 | // rather, consider maintaining a separate counter 8 | // see https://github.com/raintank/grafana/issues/133 9 | 10 | type Timer struct { 11 | key string 12 | backend Backend 13 | } 14 | 15 | func (b Backend) NewTimer(key string, val time.Duration) met.Timer { 16 | t := Timer{key, b} 17 | t.Value(val) 18 | return t 19 | } 20 | 21 | func (t Timer) Value(val time.Duration) { 22 | t.backend.client.Timing(t.key, int(val/time.Millisecond), 1) 23 | } 24 | -------------------------------------------------------------------------------- /cluster/partitioner/partitioner.go: -------------------------------------------------------------------------------- 1 | package partitioner 2 | 3 | import ( 4 | "github.com/grafana/metrictank/schema" 5 | ) 6 | 7 | type Partitioner interface { 8 | Partition(schema.PartitionedMetric, int32) (int32, error) 9 | } 10 | 11 | type Kafka struct { 12 | Method schema.PartitionByMethod 13 | } 14 | 15 | func NewKafka(partitionBy string) (*Kafka, error) { 16 | method, err := schema.PartitonMethodFromString(partitionBy) 17 | if err != nil { 18 | return nil, err 19 | } 20 | return &Kafka{Method: method}, err 21 | } 22 | 23 | func (k *Kafka) Partition(m schema.PartitionedMetric, numPartitions int32) (int32, error) { 24 | return m.PartitionID(k.Method, numPartitions) 25 | } 26 | -------------------------------------------------------------------------------- /docker/cfg/grafana-dashboards-main-extra-dockprom/config.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | providers: 4 | - name: 'main' 5 | orgId: 1 6 | folder: '' 7 | type: file 8 | disableDeletion: true 9 | updateIntervalSeconds: 3 10 | options: 11 | path: /var/lib/grafana/dashboards/main 12 | - name: 'extra' 13 | orgId: 1 14 | folder: '' 15 | type: file 16 | disableDeletion: true 17 | updateIntervalSeconds: 3 18 | options: 19 | path: /var/lib/grafana/dashboards/extra 20 | - name: 'dockprom' 21 | orgId: 1 22 | folder: 'dockprom' 23 | type: file 24 | disableDeletion: true 25 | updateIntervalSeconds: 3 26 | options: 27 | path: /var/lib/grafana/dashboards/dockprom 28 | -------------------------------------------------------------------------------- /vendor/github.com/googleapis/gax-go/header.go: -------------------------------------------------------------------------------- 1 | package gax 2 | 3 | import "bytes" 4 | 5 | // XGoogHeader is for use by the Google Cloud Libraries only. 6 | // 7 | // XGoogHeader formats key-value pairs. 8 | // The resulting string is suitable for x-goog-api-client header. 9 | func XGoogHeader(keyval ...string) string { 10 | if len(keyval) == 0 { 11 | return "" 12 | } 13 | if len(keyval)%2 != 0 { 14 | panic("gax.Header: odd argument count") 15 | } 16 | var buf bytes.Buffer 17 | for i := 0; i < len(keyval); i += 2 { 18 | buf.WriteByte(' ') 19 | buf.WriteString(keyval[i]) 20 | buf.WriteByte('/') 21 | buf.WriteString(keyval[i+1]) 22 | } 23 | return buf.String()[1:] 24 | } 25 | -------------------------------------------------------------------------------- /expr/func_group.go: -------------------------------------------------------------------------------- 1 | package expr 2 | 3 | import ( 4 | "github.com/grafana/metrictank/api/models" 5 | ) 6 | 7 | type FuncGroup struct { 8 | in []GraphiteFunc 9 | } 10 | 11 | func NewGroup() GraphiteFunc { 12 | return &FuncGroup{} 13 | } 14 | 15 | func (s *FuncGroup) Signature() ([]Arg, []Arg) { 16 | return []Arg{ 17 | ArgSeriesLists{val: &s.in}}, []Arg{ArgSeriesList{}} 18 | } 19 | 20 | func (s *FuncGroup) Context(context Context) Context { 21 | return context 22 | } 23 | 24 | func (s *FuncGroup) Exec(dataMap DataMap) ([]models.Series, error) { 25 | series, _, err := consumeFuncs(dataMap, s.in) 26 | if err != nil { 27 | return nil, err 28 | } 29 | 30 | return series, nil 31 | } 32 | -------------------------------------------------------------------------------- /idx/memory/stats.go: -------------------------------------------------------------------------------- 1 | package memory 2 | 3 | import "github.com/grafana/metrictank/stats" 4 | 5 | var ( 6 | // metric recovered_errors.idx.memory.corrupt-index is how many times 7 | // a corruption has been detected in one of the internal index structures 8 | // each time this happens, an error is logged with more details. 9 | corruptIndex = stats.NewCounter32("recovered_errors.idx.memory.corrupt-index") 10 | 11 | // metric recovered_errors.idx.memory.invalid-tag is how many times 12 | // an invalid tag for a metric is encountered. 13 | // each time this happens, an error is logged with more details. 14 | invalidTag = stats.NewCounter32("recovered_errors.idx.memory.invalid-tag") 15 | ) 16 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/memberlist/alive_delegate.go: -------------------------------------------------------------------------------- 1 | package memberlist 2 | 3 | // AliveDelegate is used to involve a client in processing 4 | // a node "alive" message. When a node joins, either through 5 | // a UDP gossip or TCP push/pull, we update the state of 6 | // that node via an alive message. This can be used to filter 7 | // a node out and prevent it from being considered a peer 8 | // using application specific logic. 9 | type AliveDelegate interface { 10 | // NotifyMerge is invoked when a merge could take place. 11 | // Provides a list of the nodes known by the peer. If 12 | // the return value is non-nil, the merge is canceled. 13 | NotifyAlive(peer *Node) error 14 | } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,!gccgo,386 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // Underlying system call writes to newoffset via pointer. 12 | // Implemented in assembly to avoid allocation. 13 | func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno) 14 | 15 | func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno) 16 | func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno) 17 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/swarm_get_unlock_key.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "encoding/json" 5 | 6 | "github.com/docker/docker/api/types" 7 | "golang.org/x/net/context" 8 | ) 9 | 10 | // SwarmGetUnlockKey retrieves the swarm's unlock key. 11 | func (cli *Client) SwarmGetUnlockKey(ctx context.Context) (types.SwarmUnlockKeyResponse, error) { 12 | serverResp, err := cli.get(ctx, "/swarm/unlockkey", nil, nil) 13 | if err != nil { 14 | return types.SwarmUnlockKeyResponse{}, err 15 | } 16 | 17 | var response types.SwarmUnlockKeyResponse 18 | err = json.NewDecoder(serverResp.body).Decode(&response) 19 | ensureReaderClosed(serverResp) 20 | return response, err 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/lex.go: -------------------------------------------------------------------------------- 1 | package hcl 2 | 3 | import ( 4 | "unicode" 5 | "unicode/utf8" 6 | ) 7 | 8 | type lexModeValue byte 9 | 10 | const ( 11 | lexModeUnknown lexModeValue = iota 12 | lexModeHcl 13 | lexModeJson 14 | ) 15 | 16 | // lexMode returns whether we're going to be parsing in JSON 17 | // mode or HCL mode. 18 | func lexMode(v []byte) lexModeValue { 19 | var ( 20 | r rune 21 | w int 22 | offset int 23 | ) 24 | 25 | for { 26 | r, w = utf8.DecodeRune(v[offset:]) 27 | offset += w 28 | if unicode.IsSpace(r) { 29 | continue 30 | } 31 | if r == '{' { 32 | return lexModeJson 33 | } 34 | break 35 | } 36 | 37 | return lexModeHcl 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/uber/jaeger-client-go/thrift-gen/agent/constants.go: -------------------------------------------------------------------------------- 1 | // Autogenerated by Thrift Compiler (0.9.3) 2 | // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 3 | 4 | package agent 5 | 6 | import ( 7 | "bytes" 8 | "fmt" 9 | "github.com/uber/jaeger-client-go/thrift" 10 | "github.com/uber/jaeger-client-go/thrift-gen/jaeger" 11 | "github.com/uber/jaeger-client-go/thrift-gen/zipkincore" 12 | ) 13 | 14 | // (needed to ensure safety because of naive import list construction.) 15 | var _ = thrift.ZERO 16 | var _ = fmt.Printf 17 | var _ = bytes.Equal 18 | 19 | var _ = jaeger.GoUnusedProtection__ 20 | var _ = zipkincore.GoUnusedProtection__ 21 | 22 | func init() { 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/uber/jaeger-client-go/thrift-gen/agent/ttypes.go: -------------------------------------------------------------------------------- 1 | // Autogenerated by Thrift Compiler (0.9.3) 2 | // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 3 | 4 | package agent 5 | 6 | import ( 7 | "bytes" 8 | "fmt" 9 | "github.com/uber/jaeger-client-go/thrift" 10 | "github.com/uber/jaeger-client-go/thrift-gen/jaeger" 11 | "github.com/uber/jaeger-client-go/thrift-gen/zipkincore" 12 | ) 13 | 14 | // (needed to ensure safety because of naive import list construction.) 15 | var _ = thrift.ZERO 16 | var _ = fmt.Printf 17 | var _ = bytes.Equal 18 | 19 | var _ = jaeger.GoUnusedProtection__ 20 | var _ = zipkincore.GoUnusedProtection__ 21 | var GoUnusedProtection__ int 22 | -------------------------------------------------------------------------------- /vendor/gopkg.in/jcmturner/gokrb5.v7/gssapi/contextFlags.go: -------------------------------------------------------------------------------- 1 | package gssapi 2 | 3 | import "github.com/jcmturner/gofork/encoding/asn1" 4 | 5 | // GSS-API context flags assigned numbers. 6 | const ( 7 | ContextFlagDeleg = 1 8 | ContextFlagMutual = 2 9 | ContextFlagReplay = 4 10 | ContextFlagSequence = 8 11 | ContextFlagConf = 16 12 | ContextFlagInteg = 32 13 | ContextFlagAnon = 64 14 | ) 15 | 16 | // ContextFlags flags for GSSAPI 17 | type ContextFlags asn1.BitString 18 | 19 | // NewContextFlags creates a new ContextFlags instance. 20 | func NewContextFlags() ContextFlags { 21 | var c ContextFlags 22 | c.BitLength = 32 23 | c.Bytes = make([]byte, 4) 24 | return c 25 | } 26 | -------------------------------------------------------------------------------- /scripts/config/schema-store-cassandra.toml: -------------------------------------------------------------------------------- 1 | schema_keyspace = """ 2 | CREATE KEYSPACE IF NOT EXISTS %s WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1} AND durable_writes = true 3 | """ 4 | 5 | schema_table = """ 6 | CREATE TABLE IF NOT EXISTS %s.%s ( 7 | key ascii, 8 | ts int, 9 | data blob, 10 | PRIMARY KEY (key, ts) 11 | ) WITH CLUSTERING ORDER BY (ts DESC) 12 | AND compaction = { 'class': 'TimeWindowCompactionStrategy', 'compaction_window_unit': 'HOURS', 'compaction_window_size': '%d', 'tombstone_threshold': '0.2', 'tombstone_compaction_interval': '86400'} 13 | AND compression = { 'class': 'LZ4Compressor' } 14 | AND gc_grace_seconds = %d 15 | """ 16 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/checkpoint_delete.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/docker/docker/api/types" 7 | "golang.org/x/net/context" 8 | ) 9 | 10 | // CheckpointDelete deletes the checkpoint with the given name from the given container 11 | func (cli *Client) CheckpointDelete(ctx context.Context, containerID string, options types.CheckpointDeleteOptions) error { 12 | query := url.Values{} 13 | if options.CheckpointDir != "" { 14 | query.Set("dir", options.CheckpointDir) 15 | } 16 | 17 | resp, err := cli.delete(ctx, "/containers/"+containerID+"/checkpoints/"+options.CheckpointID, query, nil) 18 | ensureReaderClosed(resp) 19 | return err 20 | } 21 | -------------------------------------------------------------------------------- /conf/init.go: -------------------------------------------------------------------------------- 1 | // Package conf reads config data from two of carbon's config files 2 | // * storage-schemas.conf (old and new retention format) 3 | // see https://graphite.readthedocs.io/en/0.9.9/config-carbon.html#storage-schemas-conf 4 | // * storage-aggregation.conf 5 | // see http://graphite.readthedocs.io/en/latest/config-carbon.html#storage-aggregation-conf 6 | // as well as our own file index-rules.conf 7 | // 8 | // it also adds defaults (the same ones as graphite), 9 | // so that even if nothing is matched in the user provided schemas or aggregations, 10 | // a setting is *always* found 11 | // uses some modified snippets from github.com/lomik/go-carbon and github.com/lomik/go-whisper 12 | package conf 13 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/image_history.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "encoding/json" 5 | "net/url" 6 | 7 | "github.com/docker/docker/api/types" 8 | "golang.org/x/net/context" 9 | ) 10 | 11 | // ImageHistory returns the changes in an image in history format. 12 | func (cli *Client) ImageHistory(ctx context.Context, imageID string) ([]types.ImageHistory, error) { 13 | var history []types.ImageHistory 14 | serverResp, err := cli.get(ctx, "/images/"+imageID+"/history", url.Values{}, nil) 15 | if err != nil { 16 | return history, err 17 | } 18 | 19 | err = json.NewDecoder(serverResp.body).Decode(&history) 20 | ensureReaderClosed(serverResp) 21 | return history, err 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/volume_create.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "encoding/json" 5 | 6 | "github.com/docker/docker/api/types" 7 | volumetypes "github.com/docker/docker/api/types/volume" 8 | "golang.org/x/net/context" 9 | ) 10 | 11 | // VolumeCreate creates a volume in the docker host. 12 | func (cli *Client) VolumeCreate(ctx context.Context, options volumetypes.VolumesCreateBody) (types.Volume, error) { 13 | var volume types.Volume 14 | resp, err := cli.post(ctx, "/volumes/create", nil, options, nil) 15 | if err != nil { 16 | return volume, err 17 | } 18 | err = json.NewDecoder(resp.body).Decode(&volume) 19 | ensureReaderClosed(resp) 20 | return volume, err 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/raintank/met/dogstatsd/timer.go: -------------------------------------------------------------------------------- 1 | package dogstatsd 2 | 3 | import "time" 4 | import "github.com/raintank/met" 5 | 6 | // note that due the preseeding in init, you shouldn't rely on the count and count_ps summaries 7 | // rather, consider maintaining a separate counter 8 | // see https://github.com/raintank/grafana/issues/133 9 | 10 | type Timer struct { 11 | key string 12 | backend Backend 13 | } 14 | 15 | func (b Backend) NewTimer(key string, val time.Duration) met.Timer { 16 | t := Timer{key, b} 17 | t.Value(val) 18 | return t 19 | } 20 | 21 | func (t Timer) Value(val time.Duration) { 22 | t.backend.client.TimeInMilliseconds(t.key, val.Seconds()*1000, []string{}, 1) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/trace/trace_go17.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.7 6 | 7 | package trace 8 | 9 | import "context" 10 | 11 | // NewContext returns a copy of the parent context 12 | // and associates it with a Trace. 13 | func NewContext(ctx context.Context, tr Trace) context.Context { 14 | return context.WithValue(ctx, contextKey, tr) 15 | } 16 | 17 | // FromContext returns the Trace bound to the context, if any. 18 | func FromContext(ctx context.Context) (tr Trace, ok bool) { 19 | tr, ok = ctx.Value(contextKey).(Trace) 20 | return 21 | } 22 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_unix_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | // +build !gccgo 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 13 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 14 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 15 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 16 | -------------------------------------------------------------------------------- /api/seriescycle/seriescycle.go: -------------------------------------------------------------------------------- 1 | package seriescycle 2 | 3 | import ( 4 | "github.com/grafana/metrictank/api/models" 5 | ) 6 | 7 | // SeriesCycler manages what should happen to a models.Series 8 | // when we create it, or drop our reference to it 9 | // Warning: this is for managing recycling of the Datapoints field. 10 | // In some places we create "new" series by repurposing existing 11 | // Series and adding a new Datapoints slice onto it. 12 | // E.g. in expr.NormalizeTo 13 | type SeriesCycler struct { 14 | New func(models.Series) 15 | Done func(models.Series) 16 | } 17 | 18 | var NullCycler = SeriesCycler{ 19 | New: func(in models.Series) { 20 | }, 21 | Done: func(in models.Series) { 22 | }, 23 | } 24 | -------------------------------------------------------------------------------- /scripts/push/dockerhub.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | # Find the directory we exist within 4 | DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 5 | cd ${DIR}/../.. 6 | source scripts/version-tag.sh 7 | 8 | echo 9 | echo "### docker push grafana/metrictank:$version" 10 | echo 11 | 12 | docker push grafana/metrictank:$version 13 | 14 | echo 15 | echo "### docker push grafana/metrictank:$tag" 16 | echo 17 | 18 | docker push grafana/metrictank:$tag 19 | 20 | 21 | echo 22 | echo "### docker push grafana/mt-gateway:$version" 23 | echo 24 | 25 | docker push grafana/mt-gateway:$version 26 | 27 | echo 28 | echo "### docker push grafana/mt-gateway:$tag" 29 | echo 30 | 31 | docker push grafana/mt-gateway:$tag 32 | -------------------------------------------------------------------------------- /vendor/github.com/dgryski/go-jump/jump.go: -------------------------------------------------------------------------------- 1 | // Package jump implements Google's Jump Consistent Hash 2 | /* 3 | 4 | From the paper "A Fast, Minimal Memory, Consistent Hash Algorithm" by John Lamping, Eric Veach (2014). 5 | 6 | http://arxiv.org/abs/1406.2294 7 | */ 8 | package jump 9 | 10 | // Hash consistently chooses a hash bucket number in the range [0, numBuckets) for the given key. numBuckets must be >= 1. 11 | func Hash(key uint64, numBuckets int) int32 { 12 | 13 | var b int64 = -1 14 | var j int64 15 | 16 | for j < int64(numBuckets) { 17 | b = j 18 | key = key*2862933555777941757 + 1 19 | j = int64(float64(b+1) * (float64(int64(1)<<31) / float64((key>>33)+1))) 20 | } 21 | 22 | return int32(b) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/interface_experimental.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "github.com/docker/docker/api/types" 5 | "golang.org/x/net/context" 6 | ) 7 | 8 | type apiClientExperimental interface { 9 | CheckpointAPIClient 10 | } 11 | 12 | // CheckpointAPIClient defines API client methods for the checkpoints 13 | type CheckpointAPIClient interface { 14 | CheckpointCreate(ctx context.Context, container string, options types.CheckpointCreateOptions) error 15 | CheckpointDelete(ctx context.Context, container string, options types.CheckpointDeleteOptions) error 16 | CheckpointList(ctx context.Context, container string, options types.CheckpointListOptions) ([]types.Checkpoint, error) 17 | } 18 | -------------------------------------------------------------------------------- /scripts/qa/vet-high-confidence.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # go vet has high confidence checks and low confidence ones. 3 | # for the purpose of CI, we shall only execute the high confidence ones. 4 | # we can just follow the ones `go test` uses, it's not documented, but 5 | # see https://github.com/golang/go/blob/release-branch.go1.10/src/cmd/go/internal/test/test.go#L509-L533 6 | # NOTE: why not just rely on the auto go vet execution via go test -> because not all packages use go test 7 | 8 | # find the dir we exist within... 9 | DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 10 | # and cd into root project dir 11 | cd ${DIR}/../.. 12 | 13 | export GO111MODULE=off 14 | go vet -atomic -bool -buildtags -nilfunc -printf ./... 15 | -------------------------------------------------------------------------------- /vendor/github.com/Shopify/sarama/config_resource_type.go: -------------------------------------------------------------------------------- 1 | package sarama 2 | 3 | // ConfigResourceType is a type for resources that have configs. 4 | type ConfigResourceType int8 5 | 6 | // Taken from: 7 | // https://github.com/apache/kafka/blob/ed7c071e07f1f90e4c2895582f61ca090ced3c42/clients/src/main/java/org/apache/kafka/common/config/ConfigResource.java#L32-L55 8 | 9 | const ( 10 | // UnknownResource constant type 11 | UnknownResource ConfigResourceType = 0 12 | // TopicResource constant type 13 | TopicResource ConfigResourceType = 2 14 | // BrokerResource constant type 15 | BrokerResource ConfigResourceType = 4 16 | // BrokerLoggerResource constant type 17 | BrokerLoggerResource ConfigResourceType = 8 18 | ) 19 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/info.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "net/url" 7 | 8 | "github.com/docker/docker/api/types" 9 | "golang.org/x/net/context" 10 | ) 11 | 12 | // Info returns information about the docker server. 13 | func (cli *Client) Info(ctx context.Context) (types.Info, error) { 14 | var info types.Info 15 | serverResp, err := cli.get(ctx, "/info", url.Values{}, nil) 16 | if err != nil { 17 | return info, err 18 | } 19 | defer ensureReaderClosed(serverResp) 20 | 21 | if err := json.NewDecoder(serverResp.body).Decode(&info); err != nil { 22 | return info, fmt.Errorf("Error reading remote info: %v", err) 23 | } 24 | 25 | return info, nil 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-multierror/format.go: -------------------------------------------------------------------------------- 1 | package multierror 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | ) 7 | 8 | // ErrorFormatFunc is a function callback that is called by Error to 9 | // turn the list of errors into a string. 10 | type ErrorFormatFunc func([]error) string 11 | 12 | // ListFormatFunc is a basic formatter that outputs the number of errors 13 | // that occurred along with a bullet point list of the errors. 14 | func ListFormatFunc(es []error) string { 15 | points := make([]string, len(es)) 16 | for i, err := range es { 17 | points[i] = fmt.Sprintf("* %s", err) 18 | } 19 | 20 | return fmt.Sprintf( 21 | "%d error(s) occurred:\n\n%s", 22 | len(es), strings.Join(points, "\n")) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dirent.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // ParseDirent parses up to max directory entries in buf, 12 | // appending the names to names. It returns the number of 13 | // bytes consumed from buf, the number of entries added 14 | // to names, and the new names slice. 15 | func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) { 16 | return syscall.ParseDirent(buf, max, names) 17 | } 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,gccgo,arm 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func seek(fd int, offset int64, whence int) (int64, syscall.Errno) { 15 | var newoffset int64 16 | offsetLow := uint32(offset & 0xffffffff) 17 | offsetHigh := uint32((offset >> 32) & 0xffffffff) 18 | _, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0) 19 | return newoffset, err 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/env_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Windows environment variables. 6 | 7 | package windows 8 | 9 | import "syscall" 10 | 11 | func Getenv(key string) (value string, found bool) { 12 | return syscall.Getenv(key) 13 | } 14 | 15 | func Setenv(key, value string) error { 16 | return syscall.Setenv(key, value) 17 | } 18 | 19 | func Clearenv() { 20 | syscall.Clearenv() 21 | } 22 | 23 | func Environ() []string { 24 | return syscall.Environ() 25 | } 26 | 27 | func Unsetenv(key string) error { 28 | return syscall.Unsetenv(key) 29 | } 30 | -------------------------------------------------------------------------------- /expr/pool.go: -------------------------------------------------------------------------------- 1 | package expr 2 | 3 | import ( 4 | "github.com/grafana/metrictank/pointslicepool" 5 | ) 6 | 7 | var pointSlicePool *pointslicepool.PointSlicePool 8 | 9 | func init() { 10 | pointSlicePool = pointslicepool.New(0) 11 | } 12 | 13 | // Pool tells the expr library which pool to use for temporary []schema.Point 14 | // this lets the expr package effectively create and drop point slices as needed 15 | // it is recommended you use the same pool in your application, e.g. to get slices 16 | // when loading the initial data, and to return the buffers back to the pool once 17 | // the output from this package's processing is no longer needed. 18 | func Pool(p *pointslicepool.PointSlicePool) { 19 | pointSlicePool = p 20 | } 21 | -------------------------------------------------------------------------------- /schema/metric_serialization_json_test.go: -------------------------------------------------------------------------------- 1 | package schema 2 | 3 | import ( 4 | "encoding/json" 5 | "testing" 6 | ) 7 | 8 | func BenchmarkSerializeMetricDataArrayJson(b *testing.B) { 9 | metrics := getDifferentMetricDataArray(b.N) 10 | b.ResetTimer() 11 | data, err := json.Marshal(metrics) 12 | checkErr(b, err) 13 | b.Logf("with %10d metrics -> final size: %.1f bytes per metric", b.N, float64(len(data))/float64(b.N)) 14 | } 15 | 16 | func BenchmarkDeSerializeMetricDataArrayJson(b *testing.B) { 17 | metrics := getDifferentMetricDataArray(b.N) 18 | data, err := json.Marshal(metrics) 19 | checkErr(b, err) 20 | var out []*MetricData 21 | b.ResetTimer() 22 | err = json.Unmarshal(data, &out) 23 | checkErr(b, err) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/Shopify/sarama/heartbeat_response.go: -------------------------------------------------------------------------------- 1 | package sarama 2 | 3 | type HeartbeatResponse struct { 4 | Err KError 5 | } 6 | 7 | func (r *HeartbeatResponse) encode(pe packetEncoder) error { 8 | pe.putInt16(int16(r.Err)) 9 | return nil 10 | } 11 | 12 | func (r *HeartbeatResponse) decode(pd packetDecoder, version int16) error { 13 | kerr, err := pd.getInt16() 14 | if err != nil { 15 | return err 16 | } 17 | r.Err = KError(kerr) 18 | 19 | return nil 20 | } 21 | 22 | func (r *HeartbeatResponse) key() int16 { 23 | return 12 24 | } 25 | 26 | func (r *HeartbeatResponse) version() int16 { 27 | return 0 28 | } 29 | 30 | func (r *HeartbeatResponse) requiredVersion() KafkaVersion { 31 | return V0_9_0_0 32 | } 33 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-multierror/flatten.go: -------------------------------------------------------------------------------- 1 | package multierror 2 | 3 | // Flatten flattens the given error, merging any *Errors together into 4 | // a single *Error. 5 | func Flatten(err error) error { 6 | // If it isn't an *Error, just return the error as-is 7 | if _, ok := err.(*Error); !ok { 8 | return err 9 | } 10 | 11 | // Otherwise, make the result and flatten away! 12 | flatErr := new(Error) 13 | flatten(err, flatErr) 14 | return flatErr 15 | } 16 | 17 | func flatten(err error, flatErr *Error) { 18 | switch err := err.(type) { 19 | case *Error: 20 | for _, e := range err.Errors { 21 | flatten(e, flatErr) 22 | } 23 | default: 24 | flatErr.Errors = append(flatErr.Errors, err) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/trace/trace_go16.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !go1.7 6 | 7 | package trace 8 | 9 | import "golang.org/x/net/context" 10 | 11 | // NewContext returns a copy of the parent context 12 | // and associates it with a Trace. 13 | func NewContext(ctx context.Context, tr Trace) context.Context { 14 | return context.WithValue(ctx, contextKey, tr) 15 | } 16 | 17 | // FromContext returns the Trace bound to the context, if any. 18 | func FromContext(ctx context.Context) (tr Trace, ok bool) { 19 | tr, ok = ctx.Value(contextKey).(Trace) 20 | return 21 | } 22 | -------------------------------------------------------------------------------- /scripts/dev/tools-to-doc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # Find the directory we exist within 5 | DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 6 | cd ${DIR}/../../build 7 | 8 | cat << EOF 9 | # Tools 10 | 11 | Metrictank comes with a bunch of helper tools. 12 | 13 | Here is an overview of them all. 14 | 15 | This file is generated by [tools-to-doc](https://github.com/grafana/metrictank/blob/master/scripts/dev/tools-to-doc.sh) 16 | 17 | --- 18 | 19 | EOF 20 | 21 | for tool in mt-*; do 22 | echo 23 | echo "## $tool" 24 | echo 25 | echo '```' 26 | ./$tool -h 2>&1 | sed 's#run at most n tests in parallel (default .*)#run at most n tests in parallel (default num-processors)#' 27 | echo '```' 28 | echo 29 | done 30 | -------------------------------------------------------------------------------- /vendor/github.com/docker/docker/client/disk_usage.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | 7 | "github.com/docker/docker/api/types" 8 | "golang.org/x/net/context" 9 | ) 10 | 11 | // DiskUsage requests the current data usage from the daemon 12 | func (cli *Client) DiskUsage(ctx context.Context) (types.DiskUsage, error) { 13 | var du types.DiskUsage 14 | 15 | serverResp, err := cli.get(ctx, "/system/df", nil, nil) 16 | if err != nil { 17 | return du, err 18 | } 19 | defer ensureReaderClosed(serverResp) 20 | 21 | if err := json.NewDecoder(serverResp.body).Decode(&du); err != nil { 22 | return du, fmt.Errorf("Error retrieving disk usage: %v", err) 23 | } 24 | 25 | return du, nil 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/jtolds/gls/stack_tags_main.go: -------------------------------------------------------------------------------- 1 | // +build !js 2 | 3 | package gls 4 | 5 | // This file is used for standard Go builds, which have the expected runtime 6 | // support 7 | 8 | import ( 9 | "runtime" 10 | ) 11 | 12 | var ( 13 | findPtr = func() uintptr { 14 | var pc [1]uintptr 15 | n := runtime.Callers(4, pc[:]) 16 | if n != 1 { 17 | panic("failed to find function pointer") 18 | } 19 | return pc[0] 20 | } 21 | 22 | getStack = func(offset, amount int) (stack []uintptr, next_offset int) { 23 | stack = make([]uintptr, amount) 24 | stack = stack[:runtime.Callers(offset, stack)] 25 | if len(stack) < amount { 26 | return stack, 0 27 | } 28 | return stack, offset + len(stack) 29 | } 30 | ) 31 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_solaris.go: -------------------------------------------------------------------------------- 1 | // +build solaris 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import ( 7 | "golang.org/x/sys/unix" 8 | ) 9 | 10 | // IsTerminal returns true if the given file descriptor is a terminal. 11 | // see: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libbc/libc/gen/common/isatty.c 12 | func IsTerminal(fd uintptr) bool { 13 | var termio unix.Termio 14 | err := unix.IoctlSetTermio(int(fd), unix.TCGETA, &termio) 15 | return err == nil 16 | } 17 | 18 | // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2 19 | // terminal. This is also always false on this environment. 20 | func IsCygwinTerminal(fd uintptr) bool { 21 | return false 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package logrus is a structured logger for Go, completely API compatible with the standard library logger. 3 | 4 | 5 | The simplest way to use Logrus is simply the package-level exported logger: 6 | 7 | package main 8 | 9 | import ( 10 | log "github.com/sirupsen/logrus" 11 | ) 12 | 13 | func main() { 14 | log.WithFields(log.Fields{ 15 | "animal": "walrus", 16 | "number": 1, 17 | "size": 10, 18 | }).Info("A walrus appears") 19 | } 20 | 21 | Output: 22 | time="2015-09-07T08:48:33Z" level=info msg="A walrus appears" animal=walrus number=1 size=10 23 | 24 | For a full guide visit https://github.com/sirupsen/logrus 25 | */ 26 | package logrus 27 | -------------------------------------------------------------------------------- /api/response/csv.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | type Csvable interface { 4 | Csv([]byte) ([]byte, error) 5 | } 6 | 7 | type Csv struct { 8 | code int 9 | body Csvable 10 | buf []byte 11 | } 12 | 13 | func NewCsv(code int, body Csvable) *Csv { 14 | return &Csv{ 15 | code: code, 16 | body: body, 17 | buf: BufferPool.Get(), 18 | } 19 | } 20 | 21 | func (r *Csv) Code() int { 22 | return r.code 23 | } 24 | 25 | func (r *Csv) Close() { 26 | BufferPool.Put(r.buf) 27 | } 28 | 29 | func (r *Csv) Body() ([]byte, error) { 30 | var err error 31 | r.buf, err = r.body.Csv(r.buf) 32 | return r.buf, err 33 | } 34 | 35 | func (r *Csv) Headers() (headers map[string]string) { 36 | return map[string]string{"content-type": "text/csv"} 37 | } 38 | -------------------------------------------------------------------------------- /scripts/config/schema-store-scylladb.toml: -------------------------------------------------------------------------------- 1 | schema_keyspace = """ 2 | CREATE KEYSPACE IF NOT EXISTS %s WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1} AND durable_writes = true 3 | """ 4 | 5 | schema_table = """ 6 | CREATE TABLE IF NOT EXISTS %s.%s ( 7 | key ascii, 8 | ts int, 9 | data blob, 10 | PRIMARY KEY (key, ts) 11 | ) WITH CLUSTERING ORDER BY (ts DESC) 12 | AND compaction = { 'class': 'TimeWindowCompactionStrategy', 'compaction_window_unit': 'HOURS', 'compaction_window_size': '%d', 'tombstone_threshold': '0.2', 'tombstone_compaction_interval': '86400'} 13 | AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'} 14 | AND gc_grace_seconds = %d 15 | """ 16 | --------------------------------------------------------------------------------