Showing preview only (2,216K chars total). Download the full file or copy to clipboard to get everything.
Repository: nathanielc/morgoth
Branch: master
Commit: c9874e8c4225
Files: 352
Total size: 2.0 MB
Directory structure:
gitextract_y5n2h024/
├── .gitignore
├── .gitmodules
├── .travis.yml
├── Gopkg.toml
├── LICENSE
├── README.md
├── cmd/
│ └── morgoth/
│ └── main.go
├── counter/
│ ├── counter.go
│ ├── lossy_counter.go
│ └── lossy_counter_test.go
├── detector.go
├── fingerprint.go
├── fingerprinters/
│ ├── jsdiv/
│ │ ├── jsdiv.go
│ │ └── jsdiv_test.go
│ ├── kstest/
│ │ ├── kstest.go
│ │ └── kstest_test.go
│ └── sigma/
│ └── sigma.go
├── vendor/
│ └── github.com/
│ ├── beorn7/
│ │ └── perks/
│ │ ├── .gitignore
│ │ ├── LICENSE
│ │ ├── README.md
│ │ └── quantile/
│ │ ├── bench_test.go
│ │ ├── example_test.go
│ │ ├── exampledata.txt
│ │ ├── stream.go
│ │ └── stream_test.go
│ ├── davecgh/
│ │ └── go-spew/
│ │ ├── .gitignore
│ │ ├── .travis.yml
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── cov_report.sh
│ │ ├── spew/
│ │ │ ├── bypass.go
│ │ │ ├── bypasssafe.go
│ │ │ ├── common.go
│ │ │ ├── common_test.go
│ │ │ ├── config.go
│ │ │ ├── doc.go
│ │ │ ├── dump.go
│ │ │ ├── dump_test.go
│ │ │ ├── dumpcgo_test.go
│ │ │ ├── dumpnocgo_test.go
│ │ │ ├── example_test.go
│ │ │ ├── format.go
│ │ │ ├── format_test.go
│ │ │ ├── internal_test.go
│ │ │ ├── internalunsafe_test.go
│ │ │ ├── spew.go
│ │ │ └── spew_test.go
│ │ └── test_coverage.txt
│ ├── golang/
│ │ └── protobuf/
│ │ ├── .gitignore
│ │ ├── .travis.yml
│ │ ├── AUTHORS
│ │ ├── CONTRIBUTORS
│ │ ├── LICENSE
│ │ ├── Make.protobuf
│ │ ├── Makefile
│ │ ├── README.md
│ │ └── proto/
│ │ ├── Makefile
│ │ ├── all_test.go
│ │ ├── any_test.go
│ │ ├── clone.go
│ │ ├── clone_test.go
│ │ ├── decode.go
│ │ ├── decode_test.go
│ │ ├── encode.go
│ │ ├── encode_test.go
│ │ ├── equal.go
│ │ ├── equal_test.go
│ │ ├── extensions.go
│ │ ├── extensions_test.go
│ │ ├── lib.go
│ │ ├── map_test.go
│ │ ├── message_set.go
│ │ ├── message_set_test.go
│ │ ├── pointer_reflect.go
│ │ ├── pointer_unsafe.go
│ │ ├── properties.go
│ │ ├── proto3_test.go
│ │ ├── size2_test.go
│ │ ├── size_test.go
│ │ ├── text.go
│ │ ├── text_parser.go
│ │ ├── text_parser_test.go
│ │ └── text_test.go
│ ├── influxdata/
│ │ ├── kapacitor/
│ │ │ ├── .dockerignore
│ │ │ ├── .gitattributes
│ │ │ ├── .gitignore
│ │ │ ├── BLOB_STORE_DESIGN.md
│ │ │ ├── CHANGELOG.md
│ │ │ ├── CONTRIBUTING.md
│ │ │ ├── DESIGN.md
│ │ │ ├── Dockerfile_build_ubuntu32
│ │ │ ├── Dockerfile_build_ubuntu64
│ │ │ ├── Gopkg.toml
│ │ │ ├── LICENSE
│ │ │ ├── LICENSE_OF_DEPENDENCIES.md
│ │ │ ├── README.md
│ │ │ ├── alert.go
│ │ │ ├── autoscale.go
│ │ │ ├── batch.go
│ │ │ ├── build.py
│ │ │ ├── build.sh
│ │ │ ├── circle-test.sh
│ │ │ ├── circle.yml
│ │ │ ├── combine.go
│ │ │ ├── combine_test.go
│ │ │ ├── default.go
│ │ │ ├── delete.go
│ │ │ ├── derivative.go
│ │ │ ├── doc.go
│ │ │ ├── edge.go
│ │ │ ├── eval.go
│ │ │ ├── expr.go
│ │ │ ├── flatten.go
│ │ │ ├── gobuild.sh
│ │ │ ├── group_by.go
│ │ │ ├── http_out.go
│ │ │ ├── http_post.go
│ │ │ ├── influxdb_out.go
│ │ │ ├── influxql.gen.go
│ │ │ ├── influxql.gen.go.tmpl
│ │ │ ├── influxql.go
│ │ │ ├── join.go
│ │ │ ├── kapacitor_loopback.go
│ │ │ ├── list-deps
│ │ │ ├── log.go
│ │ │ ├── metaclient.go
│ │ │ ├── node.go
│ │ │ ├── noop.go
│ │ │ ├── output.go
│ │ │ ├── query.go
│ │ │ ├── query_test.go
│ │ │ ├── replay.go
│ │ │ ├── result.go
│ │ │ ├── sample.go
│ │ │ ├── shift.go
│ │ │ ├── state_tracking.go
│ │ │ ├── stats.go
│ │ │ ├── stream.go
│ │ │ ├── task.go
│ │ │ ├── task_master.go
│ │ │ ├── template.go
│ │ │ ├── test.sh
│ │ │ ├── tmpldata.json
│ │ │ ├── udf/
│ │ │ │ ├── agent/
│ │ │ │ │ ├── README.md
│ │ │ │ │ ├── agent.go
│ │ │ │ │ ├── io.go
│ │ │ │ │ ├── io_test.go
│ │ │ │ │ ├── server.go
│ │ │ │ │ ├── udf.pb.go
│ │ │ │ │ └── udf.proto
│ │ │ │ ├── server.go
│ │ │ │ ├── server_test.go
│ │ │ │ └── udf.go
│ │ │ ├── udf.go
│ │ │ ├── udf_test.go
│ │ │ ├── union.go
│ │ │ ├── update_tick_docs.sh
│ │ │ ├── where.go
│ │ │ ├── window.go
│ │ │ └── window_test.go
│ │ └── wlog/
│ │ ├── LICENSE
│ │ ├── README.md
│ │ └── writer.go
│ ├── matttproud/
│ │ └── golang_protobuf_extensions/
│ │ ├── .travis.yml
│ │ ├── LICENSE
│ │ ├── NOTICE
│ │ ├── README.md
│ │ └── pbutil/
│ │ ├── all_test.go
│ │ ├── decode.go
│ │ ├── decode_test.go
│ │ ├── doc.go
│ │ ├── encode.go
│ │ ├── encode_test.go
│ │ └── fixtures_test.go
│ ├── pkg/
│ │ └── errors/
│ │ ├── .gitignore
│ │ ├── .travis.yml
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── appveyor.yml
│ │ ├── bench_test.go
│ │ ├── errors.go
│ │ ├── errors_test.go
│ │ ├── example_test.go
│ │ ├── format_test.go
│ │ ├── stack.go
│ │ └── stack_test.go
│ ├── pmezard/
│ │ └── go-difflib/
│ │ ├── .travis.yml
│ │ ├── LICENSE
│ │ ├── README.md
│ │ └── difflib/
│ │ ├── difflib.go
│ │ └── difflib_test.go
│ ├── prometheus/
│ │ ├── client_golang/
│ │ │ ├── .gitignore
│ │ │ ├── .travis.yml
│ │ │ ├── CHANGELOG.md
│ │ │ ├── CONTRIBUTING.md
│ │ │ ├── LICENSE
│ │ │ ├── MAINTAINERS.md
│ │ │ ├── NOTICE
│ │ │ ├── README.md
│ │ │ ├── VERSION
│ │ │ └── prometheus/
│ │ │ ├── .gitignore
│ │ │ ├── README.md
│ │ │ ├── benchmark_test.go
│ │ │ ├── collector.go
│ │ │ ├── counter.go
│ │ │ ├── counter_test.go
│ │ │ ├── desc.go
│ │ │ ├── desc_test.go
│ │ │ ├── doc.go
│ │ │ ├── example_clustermanager_test.go
│ │ │ ├── example_timer_complex_test.go
│ │ │ ├── example_timer_gauge_test.go
│ │ │ ├── example_timer_test.go
│ │ │ ├── examples_test.go
│ │ │ ├── expvar_collector.go
│ │ │ ├── expvar_collector_test.go
│ │ │ ├── fnv.go
│ │ │ ├── gauge.go
│ │ │ ├── gauge_test.go
│ │ │ ├── go_collector.go
│ │ │ ├── go_collector_test.go
│ │ │ ├── histogram.go
│ │ │ ├── histogram_test.go
│ │ │ ├── http.go
│ │ │ ├── http_test.go
│ │ │ ├── labels.go
│ │ │ ├── metric.go
│ │ │ ├── metric_test.go
│ │ │ ├── observer.go
│ │ │ ├── process_collector.go
│ │ │ ├── process_collector_test.go
│ │ │ ├── promhttp/
│ │ │ │ ├── delegator.go
│ │ │ │ ├── delegator_1_8.go
│ │ │ │ ├── delegator_pre_1_8.go
│ │ │ │ ├── http.go
│ │ │ │ ├── http_test.go
│ │ │ │ ├── instrument_client.go
│ │ │ │ ├── instrument_client_1_8.go
│ │ │ │ ├── instrument_client_1_8_test.go
│ │ │ │ ├── instrument_server.go
│ │ │ │ └── instrument_server_test.go
│ │ │ ├── registry.go
│ │ │ ├── registry_test.go
│ │ │ ├── summary.go
│ │ │ ├── summary_test.go
│ │ │ ├── timer.go
│ │ │ ├── timer_test.go
│ │ │ ├── untyped.go
│ │ │ ├── value.go
│ │ │ ├── value_test.go
│ │ │ ├── vec.go
│ │ │ └── vec_test.go
│ │ ├── client_model/
│ │ │ ├── .gitignore
│ │ │ ├── CONTRIBUTING.md
│ │ │ ├── LICENSE
│ │ │ ├── MAINTAINERS.md
│ │ │ ├── Makefile
│ │ │ ├── NOTICE
│ │ │ ├── README.md
│ │ │ ├── go/
│ │ │ │ └── metrics.pb.go
│ │ │ ├── metrics.proto
│ │ │ ├── pom.xml
│ │ │ └── setup.py
│ │ ├── common/
│ │ │ ├── .travis.yml
│ │ │ ├── CONTRIBUTING.md
│ │ │ ├── LICENSE
│ │ │ ├── MAINTAINERS.md
│ │ │ ├── NOTICE
│ │ │ ├── README.md
│ │ │ ├── expfmt/
│ │ │ │ ├── bench_test.go
│ │ │ │ ├── decode.go
│ │ │ │ ├── decode_test.go
│ │ │ │ ├── encode.go
│ │ │ │ ├── expfmt.go
│ │ │ │ ├── fuzz.go
│ │ │ │ ├── text_create.go
│ │ │ │ ├── text_create_test.go
│ │ │ │ ├── text_parse.go
│ │ │ │ └── text_parse_test.go
│ │ │ ├── internal/
│ │ │ │ └── bitbucket.org/
│ │ │ │ └── ww/
│ │ │ │ └── goautoneg/
│ │ │ │ ├── README.txt
│ │ │ │ ├── autoneg.go
│ │ │ │ └── autoneg_test.go
│ │ │ └── model/
│ │ │ ├── alert.go
│ │ │ ├── alert_test.go
│ │ │ ├── fingerprinting.go
│ │ │ ├── fnv.go
│ │ │ ├── labels.go
│ │ │ ├── labels_test.go
│ │ │ ├── labelset.go
│ │ │ ├── metric.go
│ │ │ ├── metric_test.go
│ │ │ ├── model.go
│ │ │ ├── signature.go
│ │ │ ├── signature_test.go
│ │ │ ├── silence.go
│ │ │ ├── silence_test.go
│ │ │ ├── time.go
│ │ │ ├── time_test.go
│ │ │ ├── value.go
│ │ │ └── value_test.go
│ │ └── procfs/
│ │ ├── .travis.yml
│ │ ├── CONTRIBUTING.md
│ │ ├── LICENSE
│ │ ├── MAINTAINERS.md
│ │ ├── Makefile
│ │ ├── NOTICE
│ │ ├── README.md
│ │ ├── buddyinfo.go
│ │ ├── buddyinfo_test.go
│ │ ├── doc.go
│ │ ├── fs.go
│ │ ├── fs_test.go
│ │ ├── ipvs.go
│ │ ├── ipvs_test.go
│ │ ├── mdstat.go
│ │ ├── mdstat_test.go
│ │ ├── mountstats.go
│ │ ├── mountstats_test.go
│ │ ├── proc.go
│ │ ├── proc_io.go
│ │ ├── proc_io_test.go
│ │ ├── proc_limits.go
│ │ ├── proc_limits_test.go
│ │ ├── proc_stat.go
│ │ ├── proc_stat_test.go
│ │ ├── proc_test.go
│ │ ├── stat.go
│ │ ├── stat_test.go
│ │ ├── ttar
│ │ ├── xfrm.go
│ │ ├── xfrm_test.go
│ │ └── xfs/
│ │ ├── parse.go
│ │ ├── parse_test.go
│ │ └── xfs.go
│ └── stretchr/
│ └── testify/
│ ├── .gitignore
│ ├── .travis.yml
│ ├── LICENCE.txt
│ ├── LICENSE
│ ├── README.md
│ ├── assert/
│ │ ├── assertion_forward.go
│ │ ├── assertion_forward.go.tmpl
│ │ ├── assertions.go
│ │ ├── assertions_test.go
│ │ ├── doc.go
│ │ ├── errors.go
│ │ ├── forward_assertions.go
│ │ ├── forward_assertions_test.go
│ │ ├── http_assertions.go
│ │ └── http_assertions_test.go
│ ├── doc.go
│ └── package_test.go
└── window.go
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
================================================
FILE: .gitmodules
================================================
[submodule "docs"]
path = docs
url = https://github.com/nvcook42/morgoth.git
branch = gh-pages
================================================
FILE: .travis.yml
================================================
language: go
sudo: false
go:
- 1.7
install: true
script:
- go test -v $(go list ./... | grep -v vendor/)
before_deploy:
# Build binary
- go get -u github.com/mitchellh/gox
- CGO_ENABLED=0 gox ./cmd/morgoth
deploy:
provider: releases
api_key:
secure: cK0/w0ggcVawInO+b++4qqwMGrVoP7PzNkTxaNq+tbFc9cu8CSUS2+PlgRkdoRYfD+fohri3lqdzHUH0rcC7gOfx/Dvtw7mcs14gzfvuNL+/xMlKn/mBoPkOGPXQeh86qsmGbsrgDzv/BwGNgxqqEimxdiev2ZDlssTD16RQZR8=
file:
- morgoth_darwin_386
- morgoth_darwin_amd64
- morgoth_freebsd_386
- morgoth_freebsd_amd64
- morgoth_freebsd_arm
- morgoth_linux_386
- morgoth_linux_amd64
- morgoth_linux_arm
- morgoth_netbsd_386
- morgoth_netbsd_amd64
- morgoth_netbsd_arm
- morgoth_openbsd_386
- morgoth_openbsd_amd64
- morgoth_windows_386.exe
- morgoth_windows_amd64.exe
skip_cleanup: true
on:
tags: true
================================================
FILE: Gopkg.toml
================================================
[[constraint]]
branch = "master"
name = "github.com/influxdata/kapacitor"
[[constraint]]
branch = "master"
name = "github.com/prometheus/client_golang"
[[constraint]]
branch = "master"
name = "github.com/prometheus/client_model"
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
================================================
FILE: README.md
================================================
Morgoth [](https://travis-ci.org/nathanielc/morgoth)
=======
Morgoth is a framework for flexible anomaly detection algorithms packaged to be used with [Kapacitor](https://github.com/influxdata/kapacitor/)
Morgoth provides a framework for implementing the smaller pieces of an anomaly detection problem.
The basic framework is that Morgoth maintains a dictionary of normal behaviors and compares new windows of data to the normal dictionary.
If the new window of data is not found in the dictionary then it is considered anomalous.
Morgoth uses algorithms, called fingerprinters, to compare windows of data to determine if they are similar.
The [Lossy Counting Algorithm](http://www.vldb.org/conf/2002/S10P03.pdf)(LCA) is used to maintain the dictionary of normal windows.
The LCA is a space efficient algorithm that can account for drift in the normal dictionary, more on LCA below.
Morgoth uses a consensus model where each fingerprinter votes for whether it thinks the current window is anomalous.
If the total votes percentage is greater than a consensus threshold then the window is considered anomalous.
## Getting started
### Install
Morgoth can be installed via go:
```sh
go get github.com/nathanielc/morgoth/cmd/morgoth
```
### Configuring
Morgoth can run as either a child process of Kapacitor or as a standalone daemon that listens on a socket.
#### Child Process
Morgoth is a UDF for [Kapacitor](https://github.com/influxdata/kapacitor).
Add this configuration to Kapacitor in order to enable using Morgoth.
```
[udf]
[udf.functions]
[udf.functions.morgoth]
prog = "/path/to/bin/morgoth"
timeout = "10s"
```
Restart Kapacitor and you are ready to start using Morgoth within Kapacitor.
#### Socket
To use Morgoth as a socket UDF start the morgoth process with the `-socket` option.
```
morgoth -socket /path/to/morgoth/socket
```
Next you will need to configure Kapacitor to use the morgoth socket.
```
[udf]
[udf.functions]
[udf.functions.morgoth]
socket = "/path/to/morgoth/socket"
timeout = "10s"
```
Restart Kapacitor and you are ready to start using Morgoth within Kapacitor.
### TICKscript
Here is an example TICKscript for detecting anomalies in cpu data from [Telegraf](https://github.com/influxdata/telegraf).
```javascript
stream
|from()
.measurement('cpu')
.where(lambda: "cpu" == 'cpu-total')
.groupBy(*)
|window()
.period(1m)
.every(1m)
@morgoth()
// track the 'usage_idle' field
.field('usage_idle')
// label output data as anomalous using the 'anomalous' boolean field.
.anomalousField('anomalous')
.errorTolerance(0.01)
// The window is anomalous if it occurs less the 5% of the time.
.minSupport(0.05)
// Use the sigma fingerprinter
.sigma(3.0)
// Multiple fingerprinters can be defined...
|alert()
// Trigger a critical alert when the window is marked as anomalous.
.crit(lambda: "anomalous")
```
## Fingerprinters
A fingerprinter is a method that can determine if a window of data is similar to a previous window of data.
In effect the fingerprinters take fingerprints of the incoming data and can compare fingerprints of new data to see if they match.
These fingerprinting algorithms provide the core of Morgoth as they are the means by which Morgoth determines if a new window of data is new or something already observed.
An example fingerprinting algorithm is a *sigma* algorithm that computes the mean and standard deviation of a window and store them as the fingerprint for the window.
When a new window arrives it compares the fingerprint (mean, stddev) of the new window to the previous window.
If the windows are too far apart then they are not considered at match.
By defining several fingerprinting algorithms Morgoth can decide whether new data is anomalous or normal.
## Lossy Counting Algorithm
The LCA counts frequent items in a stream of data.
It is *lossy* because to conserve space it will drop less frequent items.
The result is that the algorithm will find frequent items but may loose track of less frequent items.
More on the specific mathematical properties of the algorithm can be found below.
There are two parameters to the algorithm, error tolerance (e) and minimum support (m).
First e is in the range [0, 1] and is an error bound, interpreted as a percentage value.
For example given and e = 0.01 (1%), items less the 1% frequent in the data set can be dropped.
Decreasing e will require more space but will keep track of less frequent items.
Increasing e will require less space but will loose track of less frequent items.
Second m is in the range [0, 1] and is a minimum support such that items that are considered frequent have at least m% frequency.
For example if m = 0.05 (5%) then if an item has a support less than 5% it is not considered frequent, aka normal.
The minimum support becomes the threshold for when items are considered anomalous.
Notice that m > e, this is so that we reduce the number of false positives.
For example say we set e = 5% and m = 5%.
If a *normal* behavior X, has a true frequency of 6% than based on variations in the true frequency, X might fall below 5% for a small interval and be dropped.
This will cause X's frequency to be underestimated, which will cause it to be flagged as an anomaly, triggering a false positive.
By setting e < m we have a buffer to help mitigate creating false positives.
### Properties
The Lossy Counting algorithm has three properties:
1. there are no false negatives,
2. false positives are guaranteed to have a frequency of at least (m - e)*N,
3. the frequency of an item can underestimated by at most e*N,
where N is the number of items encountered.
The space requirements for the algorithm are at most (1 / e) * log(e*N).
It has also been show that if the item with low frequency are uniformly random than the space requirements are no more than 7 / e.
This means that as Morgoth continues to processes windows of data its memory usage will grow as the log of the number of windows and can reach a stable upper bound.
## Metrics
Morgoth exposes metrics about each detector and fingerprinter.
The metrics are exposed as a promethues `/metrics` endpoint over HTTP.
By default the metrics HTTP endpoint binds to `:6767`.
>NOTE: Using the metrics HTTP endpoint only makes sense if you are using Morgoth in socket mode as otherwise each new process would collide on the bind port.
Metrics will have some or all of these labels:
* task - the Kapacitor task ID.
* node - the ID of the morgoth node within the Kapacitor task.
* group - the Kapacitor group ID.
* fingerprinter - the unique name for the specific fingerprinter, i.e. `sigma-0`.
The most useful metric for debugging why Morgoth is not behaving as expected is likely to be the `morgoth_unique_fingerprints` gauge.
The metric reports the number of unique fingerprints each fingerprinter is tracking.
This is useful because if the number is large or growing with each new window its likely that the fingerprinter is erroneously marking every window as anomalous.
By providing visibility into each fingerprinter, Morgoth can be tuned as needed.
Using Kapacitor's scraping service you can scrape the Morgoth UDF process for these metrics and consume them within Kapacitor.
See this [tutorial](https://docs.influxdata.com/kapacitor/latest/pull_metrics/scraping-and-discovery/) for more information.
================================================
FILE: cmd/morgoth/main.go
================================================
package main
import (
"flag"
"fmt"
"log"
"net"
"net/http"
"os"
"strings"
"syscall"
"github.com/influxdata/kapacitor/udf/agent"
"github.com/influxdata/wlog"
"github.com/nathanielc/morgoth"
"github.com/nathanielc/morgoth/counter"
"github.com/nathanielc/morgoth/fingerprinters/jsdiv"
"github.com/nathanielc/morgoth/fingerprinters/kstest"
"github.com/nathanielc/morgoth/fingerprinters/sigma"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
const (
defaultMinSupport = 0.05
defaultErrorTolerance = 0.01
defaultConsensus = 0.5
defaultMetricsBindAddr = ":6767"
defaultAnomalousField = "anomalous"
)
var socket = flag.String("socket", "", "Optional listen socket. If set then Morgoth will run in UDF socket mode, otherwise it will expect communication over STDIN/STDOUT.")
var logLevel = flag.String("log-level", "info", "Default log level, one of debug, info, warn or error.")
var metricsBind = flag.String("metrics-bind", defaultMetricsBindAddr, "Bind address of the metrics HTTP server. The metrics server will only start if also using the socket mode of operation.")
var detectorGauge = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "morgoth_detectors",
Help: "Current number of active detectors.",
})
func init() {
prometheus.MustRegister(detectorGauge)
}
func main() {
// Parse flags
flag.Parse()
// Setup logging
log.SetOutput(wlog.NewWriter(os.Stderr))
if err := wlog.SetLevelFromName(*logLevel); err != nil {
log.Fatal("E! ", err)
}
// Create error channels
metricsErr := make(chan error, 1)
errC := make(chan error, 1)
if *socket == "" {
a := agent.New(os.Stdin, os.Stdout)
h := newHandler(a)
a.Handler = h
defer h.Stop()
log.Println("I! Starting agent using STDIN/STDOUT")
a.Start()
go func() {
errC <- a.Wait()
}()
} else {
// Start the metrics server.
// Only start the metrics server in socket mode or the bind address would conflict with each new process.
go func() {
log.Println("I! Starting metrics HTTP server on", *metricsBind)
http.Handle("/metrics", promhttp.Handler())
metricsErr <- http.ListenAndServe(*metricsBind, nil)
}()
// Create unix socket
addr, err := net.ResolveUnixAddr("unix", *socket)
if err != nil {
log.Fatal("E! ", err)
}
l, err := net.ListenUnix("unix", addr)
if err != nil {
log.Fatal("E! ", err)
}
// Create server that listens on the socket
s := agent.NewServer(l, &accepter{})
defer s.Stop() // this closes the listener
// Setup signal handler to stop Server on various signals
s.StopOnSignals(os.Interrupt, syscall.SIGTERM)
go func() {
log.Println("I! Starting socket server on", addr.String())
errC <- s.Serve()
}()
}
select {
case err := <-metricsErr:
if err != nil {
log.Println("E!", err)
}
case err := <-errC:
if err != nil {
log.Println("E!", err)
}
}
log.Println("I! Stopping")
}
// Simple connection accepter
type accepter struct {
count int64
}
// Create a new agent/handler for each new connection.
// Count and log each new connection and termination.
func (acc *accepter) Accept(conn net.Conn) {
count := acc.count
acc.count++
a := agent.New(conn, conn)
h := newHandler(a)
a.Handler = h
log.Println("I! Starting agent for connection", count)
a.Start()
go func() {
err := a.Wait()
if err != nil {
log.Printf("E! Agent for connection %d terminated with error: %s", count, err)
} else {
log.Printf("I! Agent for connection %d finished", count)
}
h.Close()
}()
}
type fingerprinterInfo struct {
init initFingerprinterFunc
options *agent.OptionInfo
}
// Function that creates a new instance of a fingerprinter
type createFingerprinterFunc func() morgoth.Fingerprinter
// Init createFingerprinterFunc from agent.OptionValues
type initFingerprinterFunc func(opts []*agent.OptionValue) (createFingerprinterFunc, error)
var fingerprinters = map[string]fingerprinterInfo{
"sigma": {
options: &agent.OptionInfo{ValueTypes: []agent.ValueType{agent.ValueType_DOUBLE}},
init: func(args []*agent.OptionValue) (createFingerprinterFunc, error) {
deviations := args[0].Value.(*agent.OptionValue_DoubleValue).DoubleValue
if deviations <= 0 {
return nil, fmt.Errorf("sigma: deviations must be > 0, got %f", deviations)
}
return func() morgoth.Fingerprinter {
return sigma.New(deviations)
}, nil
},
},
"kstest": {
options: &agent.OptionInfo{ValueTypes: []agent.ValueType{agent.ValueType_INT}},
init: func(args []*agent.OptionValue) (createFingerprinterFunc, error) {
confidence := args[0].Value.(*agent.OptionValue_IntValue).IntValue
if confidence < 0 || confidence > 5 {
return nil, fmt.Errorf("kstest: confidence must be in range [0,5], got %d", confidence)
}
return func() morgoth.Fingerprinter {
return kstest.New(uint(confidence))
}, nil
},
},
"jsdiv": {
options: &agent.OptionInfo{ValueTypes: []agent.ValueType{
agent.ValueType_DOUBLE,
agent.ValueType_DOUBLE,
agent.ValueType_DOUBLE,
agent.ValueType_DOUBLE,
}},
init: func(args []*agent.OptionValue) (createFingerprinterFunc, error) {
min := args[0].Value.(*agent.OptionValue_DoubleValue).DoubleValue
max := args[1].Value.(*agent.OptionValue_DoubleValue).DoubleValue
binWidth := args[2].Value.(*agent.OptionValue_DoubleValue).DoubleValue
pValue := args[3].Value.(*agent.OptionValue_DoubleValue).DoubleValue
if binWidth <= 0 {
return nil, fmt.Errorf("jsdiv: binWidth, arg 3, must be > 0, got %f", binWidth)
}
if pValue <= 0 || pValue > 1 {
return nil, fmt.Errorf("jsdiv: pValue, arg 4, must be in range (0,1], got %f", pValue)
}
if (max-min)/binWidth < 3 {
return nil, fmt.Errorf("jsdiv: more than 3 bins should fit in the range [min,max]")
}
return func() morgoth.Fingerprinter {
return jsdiv.New(min, max, binWidth, pValue)
}, nil
},
},
}
// A Kapacitor UDF Handler
type Handler struct {
taskID string
nodeID string
field string
scoreField string
anomalousField string
minSupport float64
errorTolerance float64
consensus float64
agent *agent.Agent
currentWindow *morgoth.Window
beginBatch *agent.BeginBatch
batchPoints []*agent.Point
detectors map[string]*morgoth.Detector
fingerprinters []fingerprinterCreator
}
type fingerprinterCreator struct {
Kind string
Create createFingerprinterFunc
}
func newHandler(a *agent.Agent) *Handler {
return &Handler{
agent: a,
minSupport: defaultMinSupport,
errorTolerance: defaultErrorTolerance,
consensus: defaultConsensus,
detectors: make(map[string]*morgoth.Detector),
anomalousField: defaultAnomalousField,
}
}
func (h *Handler) Close() {
for _, d := range h.detectors {
detectorGauge.Dec()
d.Close()
}
}
func (h *Handler) detectorName(group string) string {
return fmt.Sprintf("%s:%s,group=%s", h.taskID, h.nodeID, group)
}
// Return the InfoResponse. Describing the properties of this Handler
func (h *Handler) Info() (*agent.InfoResponse, error) {
options := map[string]*agent.OptionInfo{
"field": {ValueTypes: []agent.ValueType{agent.ValueType_STRING}},
"scoreField": {ValueTypes: []agent.ValueType{agent.ValueType_STRING}},
"anomalousField": {ValueTypes: []agent.ValueType{agent.ValueType_STRING}},
"minSupport": {ValueTypes: []agent.ValueType{agent.ValueType_DOUBLE}},
"errorTolerance": {ValueTypes: []agent.ValueType{agent.ValueType_DOUBLE}},
"consensus": {ValueTypes: []agent.ValueType{agent.ValueType_DOUBLE}},
"logLevel": {ValueTypes: []agent.ValueType{agent.ValueType_STRING}},
}
// Add in options from fingerprinters
for name, info := range fingerprinters {
options[name] = info.options
}
info := &agent.InfoResponse{
Wants: agent.EdgeType_BATCH,
Provides: agent.EdgeType_BATCH,
Options: options,
}
return info, nil
}
// Initialize the Handler with the provided options.
func (h *Handler) Init(r *agent.InitRequest) (*agent.InitResponse, error) {
h.taskID = r.TaskID
h.nodeID = r.NodeID
init := &agent.InitResponse{
Success: true,
}
var errors []string
for _, opt := range r.Options {
switch opt.Name {
case "field":
h.field = opt.Values[0].Value.(*agent.OptionValue_StringValue).StringValue
case "scoreField":
h.scoreField = opt.Values[0].Value.(*agent.OptionValue_StringValue).StringValue
case "anomalousField":
h.anomalousField = opt.Values[0].Value.(*agent.OptionValue_StringValue).StringValue
case "minSupport":
h.minSupport = opt.Values[0].Value.(*agent.OptionValue_DoubleValue).DoubleValue
case "errorTolerance":
h.errorTolerance = opt.Values[0].Value.(*agent.OptionValue_DoubleValue).DoubleValue
case "consensus":
h.consensus = opt.Values[0].Value.(*agent.OptionValue_DoubleValue).DoubleValue
case "logLevel":
level := opt.Values[0].Value.(*agent.OptionValue_StringValue).StringValue
err := wlog.SetLevelFromName(level)
if err != nil {
init.Success = false
errors = append(errors, err.Error())
}
default:
if info, ok := fingerprinters[opt.Name]; ok {
createFn, err := info.init(opt.Values)
if err != nil {
init.Success = false
errors = append(errors, err.Error())
} else {
h.fingerprinters = append(h.fingerprinters, fingerprinterCreator{
Kind: opt.Name,
Create: createFn,
})
}
} else {
return nil, fmt.Errorf("received unknown init option %q", opt.Name)
}
}
}
if h.field == "" {
errors = append(errors, "field must not be empty")
}
if h.anomalousField == "" {
errors = append(errors, "anomalousField must not be empty")
}
if h.minSupport < 0 || h.minSupport > 1 {
errors = append(errors, "minSupport must be in the range [0,1)")
}
if h.errorTolerance < 0 || h.errorTolerance > 1 {
errors = append(errors, "errorTolerance must be in the range [0,1)")
}
if (h.consensus != -1 && h.consensus < 0) || h.consensus > 1 {
errors = append(errors, "consensus must be in the range [0,1) or equal to -1")
}
if h.minSupport <= h.errorTolerance {
errors = append(errors, "invalid minSupport or errorTolerance: minSupport must be greater than errorTolerance")
}
init.Success = len(errors) == 0
init.Error = strings.Join(errors, "\n")
return init, nil
}
// Create a snapshot of the running state of the handler.
func (h *Handler) Snapshot() (*agent.SnapshotResponse, error) {
return &agent.SnapshotResponse{}, nil
}
// Restore a previous snapshot.
func (h *Handler) Restore(*agent.RestoreRequest) (*agent.RestoreResponse, error) {
return &agent.RestoreResponse{}, nil
}
// A batch has begun.
func (h *Handler) BeginBatch(b *agent.BeginBatch) error {
h.currentWindow = &morgoth.Window{}
h.beginBatch = b
h.batchPoints = h.batchPoints[0:0]
return nil
}
// A point has arrived.
func (h *Handler) Point(p *agent.Point) error {
// Keep point around
h.batchPoints = append(h.batchPoints, p)
var value float64
if f, ok := p.FieldsDouble[h.field]; ok {
value = f
} else {
if i, ok := p.FieldsInt[h.field]; ok {
value = float64(i)
} else {
return fmt.Errorf("field %q is not a float or int", h.field)
}
}
h.currentWindow.Data = append(h.currentWindow.Data, value)
return nil
}
// The batch is complete.
func (h *Handler) EndBatch(b *agent.EndBatch) error {
detector, ok := h.detectors[b.Group]
if !ok {
metrics := h.createDetectorMetrics(b.Group)
if err := metrics.Register(); err != nil {
return errors.Wrapf(err, "failed to register metrics for group: %q", b.Group)
}
// We validated the args ourselves, ignore the error here
detector, _ = morgoth.NewDetector(
metrics,
h.consensus,
h.minSupport,
h.errorTolerance,
h.newFingerprinters(),
)
h.detectors[b.Group] = detector
detectorGauge.Inc()
}
anomalous, avgSupport := detector.IsAnomalous(h.currentWindow)
// Send batch back to Kapacitor
h.agent.Responses <- &agent.Response{
Message: &agent.Response_Begin{
Begin: h.beginBatch,
},
}
for _, p := range h.batchPoints {
if p.FieldsBool == nil {
p.FieldsBool = make(map[string]bool, 1)
}
p.FieldsBool[h.anomalousField] = anomalous
if h.scoreField != "" {
if p.FieldsDouble == nil {
p.FieldsDouble = make(map[string]float64, 1)
}
p.FieldsDouble[h.scoreField] = 1 - avgSupport
}
h.agent.Responses <- &agent.Response{
Message: &agent.Response_Point{
Point: p,
},
}
}
h.agent.Responses <- &agent.Response{
Message: &agent.Response_End{
End: b,
},
}
return nil
}
func (h *Handler) createDetectorMetrics(group string) *morgoth.DetectorMetrics {
labels := prometheus.Labels{
"task": h.taskID,
"node": h.nodeID,
"group": group,
}
metrics := &morgoth.DetectorMetrics{
WindowCount: prometheus.NewCounter(
prometheus.CounterOpts{
Name: "morgoth_windows_total",
Help: "Number of windows processed.",
ConstLabels: labels,
},
),
PointCount: prometheus.NewCounter(prometheus.CounterOpts{
Name: "morgoth_points_total",
Help: "Number of points processed.",
ConstLabels: labels,
}),
AnomalousCount: prometheus.NewCounter(prometheus.CounterOpts{
Name: "morgoth_anomalies_total",
Help: "Number of anomalies detected.",
ConstLabels: labels,
}),
FingerprinterMetrics: make([]*counter.Metrics, len(h.fingerprinters)),
}
for i, creator := range h.fingerprinters {
fingerprinterLabel := fmt.Sprintf("%s-%d", creator.Kind, i)
fLabels := prometheus.Labels{
"task": h.taskID,
"node": h.nodeID,
"group": group,
"fingerprinter": fingerprinterLabel,
}
metrics.FingerprinterMetrics[i] = &counter.Metrics{
UniqueFingerprints: prometheus.NewGauge(prometheus.GaugeOpts{
Name: "morgoth_unique_fingerprints",
Help: "Current number of unique fingerprints.",
ConstLabels: fLabels,
}),
Distribution: prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "morgoth_fingerprints_distribution",
Help: "Distribution of counts per unique fingerprint. The label \"fp\" is an arbitrary index to identify the fingerprint and it may change.",
ConstLabels: fLabels,
},
[]string{"fp"},
),
}
// Unregistering a metric does not forget the last value.
// We need to explicitly reset the value.
metrics.FingerprinterMetrics[i].UniqueFingerprints.Set(0)
}
return metrics
}
// Gracefully stop the Handler.
// No other methods will be called.
func (h *Handler) Stop() {
close(h.agent.Responses)
}
func (h *Handler) newFingerprinters() []morgoth.Fingerprinter {
f := make([]morgoth.Fingerprinter, len(h.fingerprinters))
for i, creator := range h.fingerprinters {
f[i] = creator.Create()
}
return f
}
================================================
FILE: counter/counter.go
================================================
package counter
import (
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
)
type Counter interface {
// Count a fingerprint and return the support for the item.
// support = count / total
Count(Countable) float64
}
type Countable interface {
IsMatch(other Countable) bool
}
type Metrics struct {
UniqueFingerprints prometheus.Gauge
Distribution *prometheus.GaugeVec
}
func (m *Metrics) Register() error {
if err := prometheus.Register(m.UniqueFingerprints); err != nil {
return errors.Wrap(err, "unique fingerprints metric")
}
if err := prometheus.Register(m.Distribution); err != nil {
return errors.Wrap(err, "distribution metric")
}
return nil
}
func (m *Metrics) Unregister() {
prometheus.Unregister(m.UniqueFingerprints)
prometheus.Unregister(m.Distribution)
}
================================================
FILE: counter/lossy_counter.go
================================================
package counter
import (
"math"
"strconv"
"sync"
"github.com/prometheus/client_golang/prometheus"
)
type lossyCounter struct {
mu sync.RWMutex
errorTolerance float64
frequencies []*entry
distributionGauges []prometheus.Gauge
width int
total int
bucket int
metrics *Metrics
}
type entry struct {
countable Countable
count int
delta int
}
//Create a new lossycounter with specified errorTolerance
func NewLossyCounter(metrics *Metrics, errorTolerance float64) *lossyCounter {
return &lossyCounter{
metrics: metrics,
errorTolerance: errorTolerance,
width: int(math.Ceil(1.0 / errorTolerance)),
total: 0,
bucket: 1,
}
}
// Count a countable and return the support for the countable.
func (self *lossyCounter) Count(countable Countable) float64 {
self.mu.Lock()
defer self.mu.Unlock()
self.total++
count := 0
for i, existing := range self.frequencies {
if existing.countable.IsMatch(countable) {
//Found match, count it
existing.count++
count = existing.count
// Keep new countable to allow for drift
self.frequencies[i].countable = countable
self.distributionGauges[i].Set(float64(count))
break
}
}
if count == 0 {
// No matches create new entry
count = 1
// Create new gauge
g := self.metrics.Distribution.WithLabelValues(strconv.Itoa(len(self.distributionGauges)))
g.Set(float64(count))
// Count new unique fingerprint
self.metrics.UniqueFingerprints.Inc()
// append
self.frequencies = append(self.frequencies, &entry{
countable: countable,
count: count,
delta: self.bucket - 1,
})
self.distributionGauges = append(self.distributionGauges, g)
}
if self.total%self.width == 0 {
self.prune()
self.bucket++
}
return float64(count) / float64(self.total)
}
//Remove infrequent items from the list
func (self *lossyCounter) prune() {
filteredFreqs := self.frequencies[0:0]
filteredGauges := self.distributionGauges[0:0]
self.metrics.Distribution.Reset()
for i, entry := range self.frequencies {
if entry.count+entry.delta > self.bucket {
g := self.metrics.Distribution.WithLabelValues(strconv.Itoa(i))
g.Set(float64(entry.count))
filteredFreqs = append(filteredFreqs, entry)
filteredGauges = append(filteredGauges, g)
}
}
self.frequencies = filteredFreqs
self.distributionGauges = filteredGauges
self.metrics.UniqueFingerprints.Set(float64(len(self.frequencies)))
}
================================================
FILE: counter/lossy_counter_test.go
================================================
package counter
import (
"math"
"testing"
"github.com/prometheus/client_golang/prometheus"
"github.com/stretchr/testify/assert"
)
//Simple fingerprint implementation
type fp struct {
id int
}
func (self *fp) IsMatch(other Countable) bool {
fp, ok := other.(*fp)
return ok && self.id == fp.id
}
var metrics = &Metrics{
UniqueFingerprints: prometheus.NewGauge(
prometheus.GaugeOpts{
Name: "unique",
Help: "help",
},
),
Distribution: prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "distribution",
Help: "help",
},
[]string{"fp"},
),
}
func TestLossyCounterShouldCountAllItems(t *testing.T) {
assert := assert.New(t)
lc := NewLossyCounter(metrics, 0.01)
fp1 := &fp{1}
fp2 := &fp{2}
assert.NotEqual(fp1, fp2)
assert.Equal(1.0/1.0, lc.Count(fp1))
assert.Equal(2.0/2.0, lc.Count(fp1))
assert.Equal(1.0/3.0, lc.Count(fp2))
assert.Equal(2.0/4.0, lc.Count(fp2))
assert.Equal(3.0/5.0, lc.Count(fp1))
assert.Equal(4.0/6.0, lc.Count(fp1))
}
func TestLossyCounterShouldByLossy(t *testing.T) {
assert := assert.New(t)
//Create Lossy Counter that will drop items less than 10% frequent
lc := NewLossyCounter(metrics, 0.10)
fp1 := &fp{1}
fp2 := &fp{2}
// Count fp1 10 times: 10%
for i := 0; i < 10; i++ {
assert.Equal(1.0, lc.Count(fp1))
}
// Count fp2 90 times: 90%
for i := 0; i < 90; i++ {
assert.Equal(float64(i+1)/float64(11+i), lc.Count(fp2))
}
// Count fp1 once more, should have been dropped and
// now is counted only once
assert.Equal(1.0/101.0, lc.Count(fp1))
}
//Benchmark the worst case scenario for the lossy counter:
// every item is errorTolerance frequent
func BenchmarkCounting(b *testing.B) {
e := 0.01
lc := NewLossyCounter(metrics, 0.01)
unique := int(math.Ceil(1.0 / e))
fps := make([]*fp, unique)
for i := 0; i < unique; i++ {
fps[i] = &fp{i}
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
id := i % unique
lc.Count(fps[id])
}
}
================================================
FILE: detector.go
================================================
package morgoth
import (
"log"
"sync"
"github.com/nathanielc/morgoth/counter"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
)
type Detector struct {
mu sync.RWMutex
consensus float64
minSupport float64
errorTolerance float64
counters []fingerprinterCounter
metrics *DetectorMetrics
}
type DetectorMetrics struct {
WindowCount prometheus.Counter
PointCount prometheus.Counter
AnomalousCount prometheus.Counter
FingerprinterMetrics []*counter.Metrics
}
func (m *DetectorMetrics) Register() error {
if err := prometheus.Register(m.WindowCount); err != nil {
return errors.Wrap(err, "window count metric")
}
if err := prometheus.Register(m.PointCount); err != nil {
return errors.Wrap(err, "point count metric")
}
if err := prometheus.Register(m.AnomalousCount); err != nil {
return errors.Wrap(err, "anomalous count metric")
}
for i, f := range m.FingerprinterMetrics {
if err := f.Register(); err != nil {
return errors.Wrapf(err, "fingerprinter %d", i)
}
}
return nil
}
func (m *DetectorMetrics) Unregister() {
prometheus.Unregister(m.WindowCount)
prometheus.Unregister(m.PointCount)
prometheus.Unregister(m.AnomalousCount)
for _, f := range m.FingerprinterMetrics {
f.Unregister()
}
}
// Pair of fingerprinter and counter
type fingerprinterCounter struct {
Fingerprinter
counter.Counter
}
// Create a new Lossy couting based detector
// The consensus is a percentage of the fingerprinters that must agree in order to flag a window as anomalous.
// If the consensus is -1 then the average support from each fingerprinter is compared to minSupport instead of using a consensus.
// The minSupport defines a minimum frequency as a percentage for a window to be considered normal.
// The errorTolerance defines a frequency as a precentage for the smallest frequency that will be retained in memory.
// The errorTolerance must be less than the minSupport.
func NewDetector(metrics *DetectorMetrics, consensus, minSupport, errorTolerance float64, fingerprinters []Fingerprinter) (*Detector, error) {
if (consensus != -1 && consensus < 0) || consensus > 1 {
return nil, errors.New("consensus must be in the range [0,1) or equal to -1")
}
if minSupport <= errorTolerance {
return nil, errors.New("minSupport must be greater than errorTolerance")
}
if len(metrics.FingerprinterMetrics) != len(fingerprinters) {
return nil, errors.New("must provide the same number of fingerprinter metrics as fingerprinters")
}
counters := make([]fingerprinterCounter, len(fingerprinters))
for i, fingerprinter := range fingerprinters {
counters[i] = fingerprinterCounter{
Fingerprinter: fingerprinter,
Counter: counter.NewLossyCounter(metrics.FingerprinterMetrics[i], errorTolerance),
}
}
return &Detector{
metrics: metrics,
consensus: consensus,
minSupport: minSupport,
errorTolerance: errorTolerance,
counters: counters,
}, nil
}
// Determine if the window is anomalous
func (self *Detector) IsAnomalous(window *Window) (bool, float64) {
self.mu.Lock()
defer self.mu.Unlock()
self.metrics.WindowCount.Inc()
self.metrics.PointCount.Add(float64(len(window.Data)))
vote := 0.0
avgSupport := 0.0
n := 0.0
for _, fc := range self.counters {
fingerprint := fc.Fingerprint(window.Copy())
support := fc.Count(fingerprint)
anomalous := support <= self.minSupport
if anomalous {
vote++
}
log.Printf("D! %T anomalous? %v support: %f", fc.Fingerprinter, anomalous, support)
avgSupport = ((avgSupport * n) + support) / (n + 1)
n++
}
anomalous := false
if self.consensus != -1 {
// Use voting consensus
vote /= float64(len(self.counters))
anomalous = vote >= self.consensus
} else {
// Use average suppport
anomalous = avgSupport <= self.minSupport
}
if anomalous {
self.metrics.AnomalousCount.Inc()
}
return anomalous, avgSupport
}
func (self *Detector) Close() {
self.metrics.Unregister()
}
================================================
FILE: fingerprint.go
================================================
package morgoth
import "github.com/nathanielc/morgoth/counter"
type Fingerprint interface {
IsMatch(other counter.Countable) bool
}
type Fingerprinter interface {
Fingerprint(window *Window) Fingerprint
}
================================================
FILE: fingerprinters/jsdiv/jsdiv.go
================================================
package jsdiv
import (
"math"
"github.com/nathanielc/morgoth"
"github.com/nathanielc/morgoth/counter"
)
const iterations = 20
type histogram map[int]float64
var ln2 = math.Log(2)
// Jensen-Shannon Divergence
//
// Fingerprints store the histogram of the window.
// Fingerprints are compared to see their JS divergence distance is less than a critical threshold.
//
// Configuration:
// min: Excpected minimum value of the window data.
// max: Excpected maximum value of the window data.
// binwidth: Size of a bin for the histogram
// pValue: Standard p-value statistical threshold. Typical value is 0.05
type JSDiv struct {
minIndex int
maxIndex int
binWidth float64
pValue float64
}
func New(min, max, binWidth, pValue float64) *JSDiv {
return &JSDiv{
minIndex: int(math.Floor(min / binWidth)),
maxIndex: int(math.Floor(max / binWidth)),
binWidth: binWidth,
pValue: pValue,
}
}
func (self *JSDiv) Fingerprint(window *morgoth.Window) morgoth.Fingerprint {
hist, count := calcHistogram(window.Data, self.binWidth)
return &JSDivFingerprint{
hist,
count,
self.pValue,
self.minIndex,
self.maxIndex,
}
}
func calcHistogram(xs []float64, binWidth float64) (hist histogram, count int) {
count = len(xs)
c := float64(count)
hist = make(histogram)
for _, x := range xs {
i := int(math.Floor(x / binWidth))
hist[i] += 1.0 / c
}
return
}
type JSDivFingerprint struct {
histogram histogram
count int
pValue float64
minIndex int
maxIndex int
}
func (self *JSDivFingerprint) IsMatch(other counter.Countable) bool {
othr, ok := other.(*JSDivFingerprint)
if !ok {
return false
}
s := self.calcSignificance(othr)
return s < self.pValue
}
func (self *JSDivFingerprint) calcSignificance(other *JSDivFingerprint) float64 {
p := self.histogram
q := other.histogram
m := make(histogram, len(p)+len(q))
min := self.minIndex
max := self.maxIndex
for i := range p {
if i < min {
min = i
}
if i > max {
max = i
}
m[i] = 0.5 * p[i]
}
for i := range q {
if i < min {
min = i
}
if i > max {
max = i
}
m[i] += 0.5 * q[i]
}
k := max - min
v := 0.5 * float64(k-1)
D := calcS(m) - (0.5*calcS(p) + 0.5*calcS(q))
inc := apporxIncompleteGamma(v, float64(self.count+other.count)*ln2*D)
gamma := math.Gamma(v)
return inc / gamma
}
// Calculate the Shannon measure for a histogram
func calcS(hist histogram) float64 {
s := 0.0
for _, v := range hist {
if v != 0 {
s += v * math.Log2(v)
}
}
return -s
}
// This is a work in progress. Need to update.
func apporxIncompleteGamma(s, x float64) float64 {
g := 0.0
xs := math.Pow(x, s)
ex := math.Exp(-x)
for k := 0; k < iterations; k++ {
denominator := s
for i := 1; i <= k; i++ {
denominator *= s + float64(i)
}
g += (xs * ex * math.Pow(x, float64(k))) / denominator
}
return g
}
================================================
FILE: fingerprinters/jsdiv/jsdiv_test.go
================================================
package jsdiv
================================================
FILE: fingerprinters/kstest/kstest.go
================================================
package kstest
import (
"math"
"sort"
"github.com/nathanielc/morgoth"
"github.com/nathanielc/morgoth/counter"
)
var confidenceMappings = []float64{
1.22,
1.36,
1.48,
1.63,
1.73,
1.95,
}
// Kolmogorov–Smirnov test.
// https://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Smirnov_test
//
// The fingerprint is the cummulative distribution of the window.
// The fingerprints are compared by computing the largest distance between the cummulative distribution functions and comparing to a critical value.
//
// Configuration:
// The only parameter is a confidence level.
// Valid values are from 0-5.
// The level maps to a list of predefined critical values for the KS test.
// Increasing 'confidence' decreases the number of anomalies detected.
//
type KSTest struct {
confidence uint
}
func New(confidence uint) *KSTest {
return &KSTest{
confidence: confidence,
}
}
func (self *KSTest) Fingerprint(window *morgoth.Window) morgoth.Fingerprint {
sort.Float64s(window.Data)
return &KSTestFingerprint{self.confidence, window.Data}
}
type KSTestFingerprint struct {
confidence uint
edf []float64
}
func (self *KSTestFingerprint) IsMatch(other counter.Countable) bool {
othr, ok := other.(*KSTestFingerprint)
if !ok {
return false
}
if self.confidence != othr.confidence {
return false
}
threshold := self.calcThreshold(othr)
D := calcD(self.edf, othr.edf)
return D < threshold
}
// Calculate the critical threshold for this comparision
func (self *KSTestFingerprint) calcThreshold(othr *KSTestFingerprint) float64 {
c := confidenceMappings[self.confidence]
n := float64(len(self.edf))
m := float64(len(othr.edf))
return c * math.Sqrt((n+m)/(n*m))
}
// Calculate maximum distance between cummulative distributions
func calcD(f1, f2 []float64) float64 {
D := 0.0
n := len(f1)
m := len(f2)
i := 0
j := 0
for i < n && j < m {
for i < n && j < m && f1[i] < f2[j] {
i++
}
for i < n && j < m && f1[i] > f2[j] {
j++
}
for i < n && j < m && f1[i] == f2[j] {
i++
j++
}
cdf1 := float64(i) / float64(n)
cdf2 := float64(j) / float64(m)
if d := math.Abs(cdf1 - cdf2); d > D {
D = d
}
}
return D
}
================================================
FILE: fingerprinters/kstest/kstest_test.go
================================================
package kstest
import (
"testing"
"github.com/nathanielc/morgoth"
"github.com/stretchr/testify/assert"
)
func TestCalcDShouldBe0(t *testing.T) {
assert := assert.New(t)
data := make([]float64, 10)
for i := range data {
data[i] = float64(i+1) / float64(len(data))
}
expectedD := 0.0
d := calcD(data, data)
assert.InDelta(expectedD, d, 1e-5)
}
func TestCalcDShouldBeSmall(t *testing.T) {
assert := assert.New(t)
data1 := make([]float64, 10)
for i := range data1 {
data1[i] = float64(i+1) / float64(len(data1))
}
data2 := make([]float64, 10)
for i := range data2 {
data2[i] = float64(i) / float64(len(data2))
}
expectedD := 0.1
d := calcD(data1, data2)
assert.InDelta(expectedD, d, 1e-5)
d = calcD(data2, data1)
assert.InDelta(expectedD, d, 1e-5)
}
func TestCalcDShouldBe1(t *testing.T) {
assert := assert.New(t)
data1 := make([]float64, 10)
for i := range data1 {
data1[i] = 0.0
}
data2 := make([]float64, 10)
for i := range data2 {
data2[i] = float64(i+1) / float64(len(data2))
}
expectedD := 1.0
d := calcD(data1, data2)
assert.InDelta(expectedD, d, 1e-5)
d = calcD(data2, data1)
assert.InDelta(expectedD, d, 1e-5)
}
func BenchmarkCalcD(b *testing.B) {
data := make([]float64, 100)
for i := range data {
data[i] = float64(i+1) / float64(len(data))
}
for i := 0; i < b.N; i++ {
calcD(data, data)
}
}
func BenchmarkIsMatch(b *testing.B) {
data1 := make([]float64, 100)
for i := range data1 {
data1[i] = float64(-i) / float64(len(data1))
}
data2 := make([]float64, 100)
for i := range data2 {
data2[i] = float64(i+1) / float64(len(data2))
}
ks := KSTest{
confidence: 4,
}
f1 := ks.Fingerprint(&morgoth.Window{
Data: data1,
})
f2 := ks.Fingerprint(&morgoth.Window{
Data: data2,
})
for i := 0; i < b.N; i++ {
f1.IsMatch(f2)
}
}
func BenchmarkFingerprint(b *testing.B) {
data := make([]float64, 100)
for i := range data {
data[i] = float64(i) / float64(len(data))
}
ks := KSTest{
confidence: 4,
}
w := &morgoth.Window{
Data: data,
}
for i := 0; i < b.N; i++ {
ks.Fingerprint(w)
}
}
================================================
FILE: fingerprinters/sigma/sigma.go
================================================
package sigma
import (
"math"
"github.com/nathanielc/morgoth"
"github.com/nathanielc/morgoth/counter"
)
// Simple fingerprinter that computes both mean and standard deviation of a window.
// Fingerprints are compared to see if the means are more than n deviations apart.
type Sigma struct {
deviations float64
}
func New(deviations float64) *Sigma {
return &Sigma{
deviations: deviations,
}
}
func (self *Sigma) Fingerprint(window *morgoth.Window) morgoth.Fingerprint {
mean, std := calcStats(window.Data)
return SigmaFingerprint{
mean: mean,
threshold: self.deviations * std,
}
}
func calcStats(xs []float64) (mean, std float64) {
n := 0.0
M2 := 0.0
for _, x := range xs {
n++
delta := x - mean
mean = mean + delta/n
M2 += delta * (x - mean)
}
std = math.Sqrt(M2 / n)
return
}
type SigmaFingerprint struct {
mean float64
threshold float64
}
func (self SigmaFingerprint) IsMatch(other counter.Countable) bool {
o, ok := other.(SigmaFingerprint)
if !ok {
return false
}
return math.Abs(self.mean-o.mean) <= self.threshold
}
================================================
FILE: vendor/github.com/beorn7/perks/.gitignore
================================================
*.test
*.prof
================================================
FILE: vendor/github.com/beorn7/perks/LICENSE
================================================
Copyright (C) 2013 Blake Mizerany
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: vendor/github.com/beorn7/perks/README.md
================================================
# Perks for Go (golang.org)
Perks contains the Go package quantile that computes approximate quantiles over
an unbounded data stream within low memory and CPU bounds.
For more information and examples, see:
http://godoc.org/github.com/bmizerany/perks
A very special thank you and shout out to Graham Cormode (Rutgers University),
Flip Korn (AT&T Labs–Research), S. Muthukrishnan (Rutgers University), and
Divesh Srivastava (AT&T Labs–Research) for their research and publication of
[Effective Computation of Biased Quantiles over Data Streams](http://www.cs.rutgers.edu/~muthu/bquant.pdf)
Thank you, also:
* Armon Dadgar (@armon)
* Andrew Gerrand (@nf)
* Brad Fitzpatrick (@bradfitz)
* Keith Rarick (@kr)
FAQ:
Q: Why not move the quantile package into the project root?
A: I want to add more packages to perks later.
Copyright (C) 2013 Blake Mizerany
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: vendor/github.com/beorn7/perks/quantile/bench_test.go
================================================
package quantile
import (
"testing"
)
func BenchmarkInsertTargeted(b *testing.B) {
b.ReportAllocs()
s := NewTargeted(Targets)
b.ResetTimer()
for i := float64(0); i < float64(b.N); i++ {
s.Insert(i)
}
}
func BenchmarkInsertTargetedSmallEpsilon(b *testing.B) {
s := NewTargeted(TargetsSmallEpsilon)
b.ResetTimer()
for i := float64(0); i < float64(b.N); i++ {
s.Insert(i)
}
}
func BenchmarkInsertBiased(b *testing.B) {
s := NewLowBiased(0.01)
b.ResetTimer()
for i := float64(0); i < float64(b.N); i++ {
s.Insert(i)
}
}
func BenchmarkInsertBiasedSmallEpsilon(b *testing.B) {
s := NewLowBiased(0.0001)
b.ResetTimer()
for i := float64(0); i < float64(b.N); i++ {
s.Insert(i)
}
}
func BenchmarkQuery(b *testing.B) {
s := NewTargeted(Targets)
for i := float64(0); i < 1e6; i++ {
s.Insert(i)
}
b.ResetTimer()
n := float64(b.N)
for i := float64(0); i < n; i++ {
s.Query(i / n)
}
}
func BenchmarkQuerySmallEpsilon(b *testing.B) {
s := NewTargeted(TargetsSmallEpsilon)
for i := float64(0); i < 1e6; i++ {
s.Insert(i)
}
b.ResetTimer()
n := float64(b.N)
for i := float64(0); i < n; i++ {
s.Query(i / n)
}
}
================================================
FILE: vendor/github.com/beorn7/perks/quantile/example_test.go
================================================
// +build go1.1
package quantile_test
import (
"bufio"
"fmt"
"log"
"os"
"strconv"
"time"
"github.com/beorn7/perks/quantile"
)
func Example_simple() {
ch := make(chan float64)
go sendFloats(ch)
// Compute the 50th, 90th, and 99th percentile.
q := quantile.NewTargeted(map[float64]float64{
0.50: 0.005,
0.90: 0.001,
0.99: 0.0001,
})
for v := range ch {
q.Insert(v)
}
fmt.Println("perc50:", q.Query(0.50))
fmt.Println("perc90:", q.Query(0.90))
fmt.Println("perc99:", q.Query(0.99))
fmt.Println("count:", q.Count())
// Output:
// perc50: 5
// perc90: 16
// perc99: 223
// count: 2388
}
func Example_mergeMultipleStreams() {
// Scenario:
// We have multiple database shards. On each shard, there is a process
// collecting query response times from the database logs and inserting
// them into a Stream (created via NewTargeted(0.90)), much like the
// Simple example. These processes expose a network interface for us to
// ask them to serialize and send us the results of their
// Stream.Samples so we may Merge and Query them.
//
// NOTES:
// * These sample sets are small, allowing us to get them
// across the network much faster than sending the entire list of data
// points.
//
// * For this to work correctly, we must supply the same quantiles
// a priori the process collecting the samples supplied to NewTargeted,
// even if we do not plan to query them all here.
ch := make(chan quantile.Samples)
getDBQuerySamples(ch)
q := quantile.NewTargeted(map[float64]float64{0.90: 0.001})
for samples := range ch {
q.Merge(samples)
}
fmt.Println("perc90:", q.Query(0.90))
}
func Example_window() {
// Scenario: We want the 90th, 95th, and 99th percentiles for each
// minute.
ch := make(chan float64)
go sendStreamValues(ch)
tick := time.NewTicker(1 * time.Minute)
q := quantile.NewTargeted(map[float64]float64{
0.90: 0.001,
0.95: 0.0005,
0.99: 0.0001,
})
for {
select {
case t := <-tick.C:
flushToDB(t, q.Samples())
q.Reset()
case v := <-ch:
q.Insert(v)
}
}
}
func sendStreamValues(ch chan float64) {
// Use your imagination
}
func flushToDB(t time.Time, samples quantile.Samples) {
// Use your imagination
}
// This is a stub for the above example. In reality this would hit the remote
// servers via http or something like it.
func getDBQuerySamples(ch chan quantile.Samples) {}
func sendFloats(ch chan<- float64) {
f, err := os.Open("exampledata.txt")
if err != nil {
log.Fatal(err)
}
sc := bufio.NewScanner(f)
for sc.Scan() {
b := sc.Bytes()
v, err := strconv.ParseFloat(string(b), 64)
if err != nil {
log.Fatal(err)
}
ch <- v
}
if sc.Err() != nil {
log.Fatal(sc.Err())
}
close(ch)
}
================================================
FILE: vendor/github.com/beorn7/perks/quantile/exampledata.txt
================================================
8
5
26
12
5
235
13
6
28
30
3
3
3
3
5
2
33
7
2
4
7
12
14
5
8
3
10
4
5
3
6
6
209
20
3
10
14
3
4
6
8
5
11
7
3
2
3
3
212
5
222
4
10
10
5
6
3
8
3
10
254
220
2
3
5
24
5
4
222
7
3
3
223
8
15
12
14
14
3
2
2
3
13
3
11
4
4
6
5
7
13
5
3
5
2
5
3
5
2
7
15
17
14
3
6
6
3
17
5
4
7
6
4
4
8
6
8
3
9
3
6
3
4
5
3
3
660
4
6
10
3
6
3
2
5
13
2
4
4
10
4
8
4
3
7
9
9
3
10
37
3
13
4
12
3
6
10
8
5
21
2
3
8
3
2
3
3
4
12
2
4
8
8
4
3
2
20
1
6
32
2
11
6
18
3
8
11
3
212
3
4
2
6
7
12
11
3
2
16
10
6
4
6
3
2
7
3
2
2
2
2
5
6
4
3
10
3
4
6
5
3
4
4
5
6
4
3
4
4
5
7
5
5
3
2
7
2
4
12
4
5
6
2
4
4
8
4
15
13
7
16
5
3
23
5
5
7
3
2
9
8
7
5
8
11
4
10
76
4
47
4
3
2
7
4
2
3
37
10
4
2
20
5
4
4
10
10
4
3
7
23
240
7
13
5
5
3
3
2
5
4
2
8
7
19
2
23
8
7
2
5
3
8
3
8
13
5
5
5
2
3
23
4
9
8
4
3
3
5
220
2
3
4
6
14
3
53
6
2
5
18
6
3
219
6
5
2
5
3
6
5
15
4
3
17
3
2
4
7
2
3
3
4
4
3
2
664
6
3
23
5
5
16
5
8
2
4
2
24
12
3
2
3
5
8
3
5
4
3
14
3
5
8
2
3
7
9
4
2
3
6
8
4
3
4
6
5
3
3
6
3
19
4
4
6
3
6
3
5
22
5
4
4
3
8
11
4
9
7
6
13
4
4
4
6
17
9
3
3
3
4
3
221
5
11
3
4
2
12
6
3
5
7
5
7
4
9
7
14
37
19
217
16
3
5
2
2
7
19
7
6
7
4
24
5
11
4
7
7
9
13
3
4
3
6
28
4
4
5
5
2
5
6
4
4
6
10
5
4
3
2
3
3
6
5
5
4
3
2
3
7
4
6
18
16
8
16
4
5
8
6
9
13
1545
6
215
6
5
6
3
45
31
5
2
2
4
3
3
2
5
4
3
5
7
7
4
5
8
5
4
749
2
31
9
11
2
11
5
4
4
7
9
11
4
5
4
7
3
4
6
2
15
3
4
3
4
3
5
2
13
5
5
3
3
23
4
4
5
7
4
13
2
4
3
4
2
6
2
7
3
5
5
3
29
5
4
4
3
10
2
3
79
16
6
6
7
7
3
5
5
7
4
3
7
9
5
6
5
9
6
3
6
4
17
2
10
9
3
6
2
3
21
22
5
11
4
2
17
2
224
2
14
3
4
4
2
4
4
4
4
5
3
4
4
10
2
6
3
3
5
7
2
7
5
6
3
218
2
2
5
2
6
3
5
222
14
6
33
3
2
5
3
3
3
9
5
3
3
2
7
4
3
4
3
5
6
5
26
4
13
9
7
3
221
3
3
4
4
4
4
2
18
5
3
7
9
6
8
3
10
3
11
9
5
4
17
5
5
6
6
3
2
4
12
17
6
7
218
4
2
4
10
3
5
15
3
9
4
3
3
6
29
3
3
4
5
5
3
8
5
6
6
7
5
3
5
3
29
2
31
5
15
24
16
5
207
4
3
3
2
15
4
4
13
5
5
4
6
10
2
7
8
4
6
20
5
3
4
3
12
12
5
17
7
3
3
3
6
10
3
5
25
80
4
9
3
2
11
3
3
2
3
8
7
5
5
19
5
3
3
12
11
2
6
5
5
5
3
3
3
4
209
14
3
2
5
19
4
4
3
4
14
5
6
4
13
9
7
4
7
10
2
9
5
7
2
8
4
6
5
5
222
8
7
12
5
216
3
4
4
6
3
14
8
7
13
4
3
3
3
3
17
5
4
3
33
6
6
33
7
5
3
8
7
5
2
9
4
2
233
24
7
4
8
10
3
4
15
2
16
3
3
13
12
7
5
4
207
4
2
4
27
15
2
5
2
25
6
5
5
6
13
6
18
6
4
12
225
10
7
5
2
2
11
4
14
21
8
10
3
5
4
232
2
5
5
3
7
17
11
6
6
23
4
6
3
5
4
2
17
3
6
5
8
3
2
2
14
9
4
4
2
5
5
3
7
6
12
6
10
3
6
2
2
19
5
4
4
9
2
4
13
3
5
6
3
6
5
4
9
6
3
5
7
3
6
6
4
3
10
6
3
221
3
5
3
6
4
8
5
3
6
4
4
2
54
5
6
11
3
3
4
4
4
3
7
3
11
11
7
10
6
13
223
213
15
231
7
3
7
228
2
3
4
4
5
6
7
4
13
3
4
5
3
6
4
6
7
2
4
3
4
3
3
6
3
7
3
5
18
5
6
8
10
3
3
3
2
4
2
4
4
5
6
6
4
10
13
3
12
5
12
16
8
4
19
11
2
4
5
6
8
5
6
4
18
10
4
2
216
6
6
6
2
4
12
8
3
11
5
6
14
5
3
13
4
5
4
5
3
28
6
3
7
219
3
9
7
3
10
6
3
4
19
5
7
11
6
15
19
4
13
11
3
7
5
10
2
8
11
2
6
4
6
24
6
3
3
3
3
6
18
4
11
4
2
5
10
8
3
9
5
3
4
5
6
2
5
7
4
4
14
6
4
4
5
5
7
2
4
3
7
3
3
6
4
5
4
4
4
3
3
3
3
8
14
2
3
5
3
2
4
5
3
7
3
3
18
3
4
4
5
7
3
3
3
13
5
4
8
211
5
5
3
5
2
5
4
2
655
6
3
5
11
2
5
3
12
9
15
11
5
12
217
2
6
17
3
3
207
5
5
4
5
9
3
2
8
5
4
3
2
5
12
4
14
5
4
2
13
5
8
4
225
4
3
4
5
4
3
3
6
23
9
2
6
7
233
4
4
6
18
3
4
6
3
4
4
2
3
7
4
13
227
4
3
5
4
2
12
9
17
3
7
14
6
4
5
21
4
8
9
2
9
25
16
3
6
4
7
8
5
2
3
5
4
3
3
5
3
3
3
2
3
19
2
4
3
4
2
3
4
4
2
4
3
3
3
2
6
3
17
5
6
4
3
13
5
3
3
3
4
9
4
2
14
12
4
5
24
4
3
37
12
11
21
3
4
3
13
4
2
3
15
4
11
4
4
3
8
3
4
4
12
8
5
3
3
4
2
220
3
5
223
3
3
3
10
3
15
4
241
9
7
3
6
6
23
4
13
7
3
4
7
4
9
3
3
4
10
5
5
1
5
24
2
4
5
5
6
14
3
8
2
3
5
13
13
3
5
2
3
15
3
4
2
10
4
4
4
5
5
3
5
3
4
7
4
27
3
6
4
15
3
5
6
6
5
4
8
3
9
2
6
3
4
3
7
4
18
3
11
3
3
8
9
7
24
3
219
7
10
4
5
9
12
2
5
4
4
4
3
3
19
5
8
16
8
6
22
3
23
3
242
9
4
3
3
5
7
3
3
5
8
3
7
5
14
8
10
3
4
3
7
4
6
7
4
10
4
3
11
3
7
10
3
13
6
8
12
10
5
7
9
3
4
7
7
10
8
30
9
19
4
3
19
15
4
13
3
215
223
4
7
4
8
17
16
3
7
6
5
5
4
12
3
7
4
4
13
4
5
2
5
6
5
6
6
7
10
18
23
9
3
3
6
5
2
4
2
7
3
3
2
5
5
14
10
224
6
3
4
3
7
5
9
3
6
4
2
5
11
4
3
3
2
8
4
7
4
10
7
3
3
18
18
17
3
3
3
4
5
3
3
4
12
7
3
11
13
5
4
7
13
5
4
11
3
12
3
6
4
4
21
4
6
9
5
3
10
8
4
6
4
4
6
5
4
8
6
4
6
4
4
5
9
6
3
4
2
9
3
18
2
4
3
13
3
6
6
8
7
9
3
2
16
3
4
6
3
2
33
22
14
4
9
12
4
5
6
3
23
9
4
3
5
5
3
4
5
3
5
3
10
4
5
5
8
4
4
6
8
5
4
3
4
6
3
3
3
5
9
12
6
5
9
3
5
3
2
2
2
18
3
2
21
2
5
4
6
4
5
10
3
9
3
2
10
7
3
6
6
4
4
8
12
7
3
7
3
3
9
3
4
5
4
4
5
5
10
15
4
4
14
6
227
3
14
5
216
22
5
4
2
2
6
3
4
2
9
9
4
3
28
13
11
4
5
3
3
2
3
3
5
3
4
3
5
23
26
3
4
5
6
4
6
3
5
5
3
4
3
2
2
2
7
14
3
6
7
17
2
2
15
14
16
4
6
7
13
6
4
5
6
16
3
3
28
3
6
15
3
9
2
4
6
3
3
22
4
12
6
7
2
5
4
10
3
16
6
9
2
5
12
7
5
5
5
5
2
11
9
17
4
3
11
7
3
5
15
4
3
4
211
8
7
5
4
7
6
7
6
3
6
5
6
5
3
4
4
26
4
6
10
4
4
3
2
3
3
4
5
9
3
9
4
4
5
5
8
2
4
2
3
8
4
11
19
5
8
6
3
5
6
12
3
2
4
16
12
3
4
4
8
6
5
6
6
219
8
222
6
16
3
13
19
5
4
3
11
6
10
4
7
7
12
5
3
3
5
6
10
3
8
2
5
4
7
2
4
4
2
12
9
6
4
2
40
2
4
10
4
223
4
2
20
6
7
24
5
4
5
2
20
16
6
5
13
2
3
3
19
3
2
4
5
6
7
11
12
5
6
7
7
3
5
3
5
3
14
3
4
4
2
11
1
7
3
9
6
11
12
5
8
6
221
4
2
12
4
3
15
4
5
226
7
218
7
5
4
5
18
4
5
9
4
4
2
9
18
18
9
5
6
6
3
3
7
3
5
4
4
4
12
3
6
31
5
4
7
3
6
5
6
5
11
2
2
11
11
6
7
5
8
7
10
5
23
7
4
3
5
34
2
5
23
7
3
6
8
4
4
4
2
5
3
8
5
4
8
25
2
3
17
8
3
4
8
7
3
15
6
5
7
21
9
5
6
6
5
3
2
3
10
3
6
3
14
7
4
4
8
7
8
2
6
12
4
213
6
5
21
8
2
5
23
3
11
2
3
6
25
2
3
6
7
6
6
4
4
6
3
17
9
7
6
4
3
10
7
2
3
3
3
11
8
3
7
6
4
14
36
3
4
3
3
22
13
21
4
2
7
4
4
17
15
3
7
11
2
4
7
6
209
6
3
2
2
24
4
9
4
3
3
3
29
2
2
4
3
3
5
4
6
3
3
2
4
================================================
FILE: vendor/github.com/beorn7/perks/quantile/stream.go
================================================
// Package quantile computes approximate quantiles over an unbounded data
// stream within low memory and CPU bounds.
//
// A small amount of accuracy is traded to achieve the above properties.
//
// Multiple streams can be merged before calling Query to generate a single set
// of results. This is meaningful when the streams represent the same type of
// data. See Merge and Samples.
//
// For more detailed information about the algorithm used, see:
//
// Effective Computation of Biased Quantiles over Data Streams
//
// http://www.cs.rutgers.edu/~muthu/bquant.pdf
package quantile
import (
"math"
"sort"
)
// Sample holds an observed value and meta information for compression. JSON
// tags have been added for convenience.
type Sample struct {
Value float64 `json:",string"`
Width float64 `json:",string"`
Delta float64 `json:",string"`
}
// Samples represents a slice of samples. It implements sort.Interface.
type Samples []Sample
func (a Samples) Len() int { return len(a) }
func (a Samples) Less(i, j int) bool { return a[i].Value < a[j].Value }
func (a Samples) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
type invariant func(s *stream, r float64) float64
// NewLowBiased returns an initialized Stream for low-biased quantiles
// (e.g. 0.01, 0.1, 0.5) where the needed quantiles are not known a priori, but
// error guarantees can still be given even for the lower ranks of the data
// distribution.
//
// The provided epsilon is a relative error, i.e. the true quantile of a value
// returned by a query is guaranteed to be within (1±Epsilon)*Quantile.
//
// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error
// properties.
func NewLowBiased(epsilon float64) *Stream {
ƒ := func(s *stream, r float64) float64 {
return 2 * epsilon * r
}
return newStream(ƒ)
}
// NewHighBiased returns an initialized Stream for high-biased quantiles
// (e.g. 0.01, 0.1, 0.5) where the needed quantiles are not known a priori, but
// error guarantees can still be given even for the higher ranks of the data
// distribution.
//
// The provided epsilon is a relative error, i.e. the true quantile of a value
// returned by a query is guaranteed to be within 1-(1±Epsilon)*(1-Quantile).
//
// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error
// properties.
func NewHighBiased(epsilon float64) *Stream {
ƒ := func(s *stream, r float64) float64 {
return 2 * epsilon * (s.n - r)
}
return newStream(ƒ)
}
// NewTargeted returns an initialized Stream concerned with a particular set of
// quantile values that are supplied a priori. Knowing these a priori reduces
// space and computation time. The targets map maps the desired quantiles to
// their absolute errors, i.e. the true quantile of a value returned by a query
// is guaranteed to be within (Quantile±Epsilon).
//
// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error properties.
func NewTargeted(targets map[float64]float64) *Stream {
ƒ := func(s *stream, r float64) float64 {
var m = math.MaxFloat64
var f float64
for quantile, epsilon := range targets {
if quantile*s.n <= r {
f = (2 * epsilon * r) / quantile
} else {
f = (2 * epsilon * (s.n - r)) / (1 - quantile)
}
if f < m {
m = f
}
}
return m
}
return newStream(ƒ)
}
// Stream computes quantiles for a stream of float64s. It is not thread-safe by
// design. Take care when using across multiple goroutines.
type Stream struct {
*stream
b Samples
sorted bool
}
func newStream(ƒ invariant) *Stream {
x := &stream{ƒ: ƒ}
return &Stream{x, make(Samples, 0, 500), true}
}
// Insert inserts v into the stream.
func (s *Stream) Insert(v float64) {
s.insert(Sample{Value: v, Width: 1})
}
func (s *Stream) insert(sample Sample) {
s.b = append(s.b, sample)
s.sorted = false
if len(s.b) == cap(s.b) {
s.flush()
}
}
// Query returns the computed qth percentiles value. If s was created with
// NewTargeted, and q is not in the set of quantiles provided a priori, Query
// will return an unspecified result.
func (s *Stream) Query(q float64) float64 {
if !s.flushed() {
// Fast path when there hasn't been enough data for a flush;
// this also yields better accuracy for small sets of data.
l := len(s.b)
if l == 0 {
return 0
}
i := int(math.Ceil(float64(l) * q))
if i > 0 {
i -= 1
}
s.maybeSort()
return s.b[i].Value
}
s.flush()
return s.stream.query(q)
}
// Merge merges samples into the underlying streams samples. This is handy when
// merging multiple streams from separate threads, database shards, etc.
//
// ATTENTION: This method is broken and does not yield correct results. The
// underlying algorithm is not capable of merging streams correctly.
func (s *Stream) Merge(samples Samples) {
sort.Sort(samples)
s.stream.merge(samples)
}
// Reset reinitializes and clears the list reusing the samples buffer memory.
func (s *Stream) Reset() {
s.stream.reset()
s.b = s.b[:0]
}
// Samples returns stream samples held by s.
func (s *Stream) Samples() Samples {
if !s.flushed() {
return s.b
}
s.flush()
return s.stream.samples()
}
// Count returns the total number of samples observed in the stream
// since initialization.
func (s *Stream) Count() int {
return len(s.b) + s.stream.count()
}
func (s *Stream) flush() {
s.maybeSort()
s.stream.merge(s.b)
s.b = s.b[:0]
}
func (s *Stream) maybeSort() {
if !s.sorted {
s.sorted = true
sort.Sort(s.b)
}
}
func (s *Stream) flushed() bool {
return len(s.stream.l) > 0
}
type stream struct {
n float64
l []Sample
ƒ invariant
}
func (s *stream) reset() {
s.l = s.l[:0]
s.n = 0
}
func (s *stream) insert(v float64) {
s.merge(Samples{{v, 1, 0}})
}
func (s *stream) merge(samples Samples) {
// TODO(beorn7): This tries to merge not only individual samples, but
// whole summaries. The paper doesn't mention merging summaries at
// all. Unittests show that the merging is inaccurate. Find out how to
// do merges properly.
var r float64
i := 0
for _, sample := range samples {
for ; i < len(s.l); i++ {
c := s.l[i]
if c.Value > sample.Value {
// Insert at position i.
s.l = append(s.l, Sample{})
copy(s.l[i+1:], s.l[i:])
s.l[i] = Sample{
sample.Value,
sample.Width,
math.Max(sample.Delta, math.Floor(s.ƒ(s, r))-1),
// TODO(beorn7): How to calculate delta correctly?
}
i++
goto inserted
}
r += c.Width
}
s.l = append(s.l, Sample{sample.Value, sample.Width, 0})
i++
inserted:
s.n += sample.Width
r += sample.Width
}
s.compress()
}
func (s *stream) count() int {
return int(s.n)
}
func (s *stream) query(q float64) float64 {
t := math.Ceil(q * s.n)
t += math.Ceil(s.ƒ(s, t) / 2)
p := s.l[0]
var r float64
for _, c := range s.l[1:] {
r += p.Width
if r+c.Width+c.Delta > t {
return p.Value
}
p = c
}
return p.Value
}
func (s *stream) compress() {
if len(s.l) < 2 {
return
}
x := s.l[len(s.l)-1]
xi := len(s.l) - 1
r := s.n - 1 - x.Width
for i := len(s.l) - 2; i >= 0; i-- {
c := s.l[i]
if c.Width+x.Width+x.Delta <= s.ƒ(s, r) {
x.Width += c.Width
s.l[xi] = x
// Remove element at i.
copy(s.l[i:], s.l[i+1:])
s.l = s.l[:len(s.l)-1]
xi -= 1
} else {
x = c
xi = i
}
r -= c.Width
}
}
func (s *stream) samples() Samples {
samples := make(Samples, len(s.l))
copy(samples, s.l)
return samples
}
================================================
FILE: vendor/github.com/beorn7/perks/quantile/stream_test.go
================================================
package quantile
import (
"math"
"math/rand"
"sort"
"testing"
)
var (
Targets = map[float64]float64{
0.01: 0.001,
0.10: 0.01,
0.50: 0.05,
0.90: 0.01,
0.99: 0.001,
}
TargetsSmallEpsilon = map[float64]float64{
0.01: 0.0001,
0.10: 0.001,
0.50: 0.005,
0.90: 0.001,
0.99: 0.0001,
}
LowQuantiles = []float64{0.01, 0.1, 0.5}
HighQuantiles = []float64{0.99, 0.9, 0.5}
)
const RelativeEpsilon = 0.01
func verifyPercsWithAbsoluteEpsilon(t *testing.T, a []float64, s *Stream) {
sort.Float64s(a)
for quantile, epsilon := range Targets {
n := float64(len(a))
k := int(quantile * n)
if k < 1 {
k = 1
}
lower := int((quantile - epsilon) * n)
if lower < 1 {
lower = 1
}
upper := int(math.Ceil((quantile + epsilon) * n))
if upper > len(a) {
upper = len(a)
}
w, min, max := a[k-1], a[lower-1], a[upper-1]
if g := s.Query(quantile); g < min || g > max {
t.Errorf("q=%f: want %v [%f,%f], got %v", quantile, w, min, max, g)
}
}
}
func verifyLowPercsWithRelativeEpsilon(t *testing.T, a []float64, s *Stream) {
sort.Float64s(a)
for _, qu := range LowQuantiles {
n := float64(len(a))
k := int(qu * n)
lowerRank := int((1 - RelativeEpsilon) * qu * n)
upperRank := int(math.Ceil((1 + RelativeEpsilon) * qu * n))
w, min, max := a[k-1], a[lowerRank-1], a[upperRank-1]
if g := s.Query(qu); g < min || g > max {
t.Errorf("q=%f: want %v [%f,%f], got %v", qu, w, min, max, g)
}
}
}
func verifyHighPercsWithRelativeEpsilon(t *testing.T, a []float64, s *Stream) {
sort.Float64s(a)
for _, qu := range HighQuantiles {
n := float64(len(a))
k := int(qu * n)
lowerRank := int((1 - (1+RelativeEpsilon)*(1-qu)) * n)
upperRank := int(math.Ceil((1 - (1-RelativeEpsilon)*(1-qu)) * n))
w, min, max := a[k-1], a[lowerRank-1], a[upperRank-1]
if g := s.Query(qu); g < min || g > max {
t.Errorf("q=%f: want %v [%f,%f], got %v", qu, w, min, max, g)
}
}
}
func populateStream(s *Stream) []float64 {
a := make([]float64, 0, 1e5+100)
for i := 0; i < cap(a); i++ {
v := rand.NormFloat64()
// Add 5% asymmetric outliers.
if i%20 == 0 {
v = v*v + 1
}
s.Insert(v)
a = append(a, v)
}
return a
}
func TestTargetedQuery(t *testing.T) {
rand.Seed(42)
s := NewTargeted(Targets)
a := populateStream(s)
verifyPercsWithAbsoluteEpsilon(t, a, s)
}
func TestTargetedQuerySmallSampleSize(t *testing.T) {
rand.Seed(42)
s := NewTargeted(TargetsSmallEpsilon)
a := []float64{1, 2, 3, 4, 5}
for _, v := range a {
s.Insert(v)
}
verifyPercsWithAbsoluteEpsilon(t, a, s)
// If not yet flushed, results should be precise:
if !s.flushed() {
for φ, want := range map[float64]float64{
0.01: 1,
0.10: 1,
0.50: 3,
0.90: 5,
0.99: 5,
} {
if got := s.Query(φ); got != want {
t.Errorf("want %f for φ=%f, got %f", want, φ, got)
}
}
}
}
func TestLowBiasedQuery(t *testing.T) {
rand.Seed(42)
s := NewLowBiased(RelativeEpsilon)
a := populateStream(s)
verifyLowPercsWithRelativeEpsilon(t, a, s)
}
func TestHighBiasedQuery(t *testing.T) {
rand.Seed(42)
s := NewHighBiased(RelativeEpsilon)
a := populateStream(s)
verifyHighPercsWithRelativeEpsilon(t, a, s)
}
// BrokenTestTargetedMerge is broken, see Merge doc comment.
func BrokenTestTargetedMerge(t *testing.T) {
rand.Seed(42)
s1 := NewTargeted(Targets)
s2 := NewTargeted(Targets)
a := populateStream(s1)
a = append(a, populateStream(s2)...)
s1.Merge(s2.Samples())
verifyPercsWithAbsoluteEpsilon(t, a, s1)
}
// BrokenTestLowBiasedMerge is broken, see Merge doc comment.
func BrokenTestLowBiasedMerge(t *testing.T) {
rand.Seed(42)
s1 := NewLowBiased(RelativeEpsilon)
s2 := NewLowBiased(RelativeEpsilon)
a := populateStream(s1)
a = append(a, populateStream(s2)...)
s1.Merge(s2.Samples())
verifyLowPercsWithRelativeEpsilon(t, a, s2)
}
// BrokenTestHighBiasedMerge is broken, see Merge doc comment.
func BrokenTestHighBiasedMerge(t *testing.T) {
rand.Seed(42)
s1 := NewHighBiased(RelativeEpsilon)
s2 := NewHighBiased(RelativeEpsilon)
a := populateStream(s1)
a = append(a, populateStream(s2)...)
s1.Merge(s2.Samples())
verifyHighPercsWithRelativeEpsilon(t, a, s2)
}
func TestUncompressed(t *testing.T) {
q := NewTargeted(Targets)
for i := 100; i > 0; i-- {
q.Insert(float64(i))
}
if g := q.Count(); g != 100 {
t.Errorf("want count 100, got %d", g)
}
// Before compression, Query should have 100% accuracy.
for quantile := range Targets {
w := quantile * 100
if g := q.Query(quantile); g != w {
t.Errorf("want %f, got %f", w, g)
}
}
}
func TestUncompressedSamples(t *testing.T) {
q := NewTargeted(map[float64]float64{0.99: 0.001})
for i := 1; i <= 100; i++ {
q.Insert(float64(i))
}
if g := q.Samples().Len(); g != 100 {
t.Errorf("want count 100, got %d", g)
}
}
func TestUncompressedOne(t *testing.T) {
q := NewTargeted(map[float64]float64{0.99: 0.01})
q.Insert(3.14)
if g := q.Query(0.90); g != 3.14 {
t.Error("want PI, got", g)
}
}
func TestDefaults(t *testing.T) {
if g := NewTargeted(map[float64]float64{0.99: 0.001}).Query(0.99); g != 0 {
t.Errorf("want 0, got %f", g)
}
}
================================================
FILE: vendor/github.com/davecgh/go-spew/.gitignore
================================================
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
================================================
FILE: vendor/github.com/davecgh/go-spew/.travis.yml
================================================
language: go
go:
- 1.5.4
- 1.6.3
- 1.7
install:
- go get -v golang.org/x/tools/cmd/cover
script:
- go test -v -tags=safe ./spew
- go test -v -tags=testcgo ./spew -covermode=count -coverprofile=profile.cov
after_success:
- go get -v github.com/mattn/goveralls
- export PATH=$PATH:$HOME/gopath/bin
- goveralls -coverprofile=profile.cov -service=travis-ci
================================================
FILE: vendor/github.com/davecgh/go-spew/LICENSE
================================================
ISC License
Copyright (c) 2012-2016 Dave Collins <dave@davec.name>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
================================================
FILE: vendor/github.com/davecgh/go-spew/README.md
================================================
go-spew
=======
[]
(https://travis-ci.org/davecgh/go-spew) [![ISC License]
(http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) [![Coverage Status]
(https://img.shields.io/coveralls/davecgh/go-spew.svg)]
(https://coveralls.io/r/davecgh/go-spew?branch=master)
Go-spew implements a deep pretty printer for Go data structures to aid in
debugging. A comprehensive suite of tests with 100% test coverage is provided
to ensure proper functionality. See `test_coverage.txt` for the gocov coverage
report. Go-spew is licensed under the liberal ISC license, so it may be used in
open source or commercial projects.
If you're interested in reading about how this package came to life and some
of the challenges involved in providing a deep pretty printer, there is a blog
post about it
[here](https://web.archive.org/web/20160304013555/https://blog.cyphertite.com/go-spew-a-journey-into-dumping-go-data-structures/).
## Documentation
[]
(http://godoc.org/github.com/davecgh/go-spew/spew)
Full `go doc` style documentation for the project can be viewed online without
installing this package by using the excellent GoDoc site here:
http://godoc.org/github.com/davecgh/go-spew/spew
You can also view the documentation locally once the package is installed with
the `godoc` tool by running `godoc -http=":6060"` and pointing your browser to
http://localhost:6060/pkg/github.com/davecgh/go-spew/spew
## Installation
```bash
$ go get -u github.com/davecgh/go-spew/spew
```
## Quick Start
Add this import line to the file you're working in:
```Go
import "github.com/davecgh/go-spew/spew"
```
To dump a variable with full newlines, indentation, type, and pointer
information use Dump, Fdump, or Sdump:
```Go
spew.Dump(myVar1, myVar2, ...)
spew.Fdump(someWriter, myVar1, myVar2, ...)
str := spew.Sdump(myVar1, myVar2, ...)
```
Alternatively, if you would prefer to use format strings with a compacted inline
printing style, use the convenience wrappers Printf, Fprintf, etc with %v (most
compact), %+v (adds pointer addresses), %#v (adds types), or %#+v (adds types
and pointer addresses):
```Go
spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2)
spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4)
spew.Fprintf(someWriter, "myVar1: %v -- myVar2: %+v", myVar1, myVar2)
spew.Fprintf(someWriter, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4)
```
## Debugging a Web Application Example
Here is an example of how you can use `spew.Sdump()` to help debug a web application. Please be sure to wrap your output using the `html.EscapeString()` function for safety reasons. You should also only use this debugging technique in a development environment, never in production.
```Go
package main
import (
"fmt"
"html"
"net/http"
"github.com/davecgh/go-spew/spew"
)
func handler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/html")
fmt.Fprintf(w, "Hi there, %s!", r.URL.Path[1:])
fmt.Fprintf(w, "<!--\n" + html.EscapeString(spew.Sdump(w)) + "\n-->")
}
func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":8080", nil)
}
```
## Sample Dump Output
```
(main.Foo) {
unexportedField: (*main.Bar)(0xf84002e210)({
flag: (main.Flag) flagTwo,
data: (uintptr) <nil>
}),
ExportedField: (map[interface {}]interface {}) {
(string) "one": (bool) true
}
}
([]uint8) {
00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 |............... |
00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 |!"#$%&'()*+,-./0|
00000020 31 32 |12|
}
```
## Sample Formatter Output
Double pointer to a uint8:
```
%v: <**>5
%+v: <**>(0xf8400420d0->0xf8400420c8)5
%#v: (**uint8)5
%#+v: (**uint8)(0xf8400420d0->0xf8400420c8)5
```
Pointer to circular struct with a uint8 field and a pointer to itself:
```
%v: <*>{1 <*><shown>}
%+v: <*>(0xf84003e260){ui8:1 c:<*>(0xf84003e260)<shown>}
%#v: (*main.circular){ui8:(uint8)1 c:(*main.circular)<shown>}
%#+v: (*main.circular)(0xf84003e260){ui8:(uint8)1 c:(*main.circular)(0xf84003e260)<shown>}
```
## Configuration Options
Configuration of spew is handled by fields in the ConfigState type. For
convenience, all of the top-level functions use a global state available via the
spew.Config global.
It is also possible to create a ConfigState instance that provides methods
equivalent to the top-level functions. This allows concurrent configuration
options. See the ConfigState documentation for more details.
```
* Indent
String to use for each indentation level for Dump functions.
It is a single space by default. A popular alternative is "\t".
* MaxDepth
Maximum number of levels to descend into nested data structures.
There is no limit by default.
* DisableMethods
Disables invocation of error and Stringer interface methods.
Method invocation is enabled by default.
* DisablePointerMethods
Disables invocation of error and Stringer interface methods on types
which only accept pointer receivers from non-pointer variables. This option
relies on access to the unsafe package, so it will not have any effect when
running in environments without access to the unsafe package such as Google
App Engine or with the "safe" build tag specified.
Pointer method invocation is enabled by default.
* DisablePointerAddresses
DisablePointerAddresses specifies whether to disable the printing of
pointer addresses. This is useful when diffing data structures in tests.
* DisableCapacities
DisableCapacities specifies whether to disable the printing of capacities
for arrays, slices, maps and channels. This is useful when diffing data
structures in tests.
* ContinueOnMethod
Enables recursion into types after invoking error and Stringer interface
methods. Recursion after method invocation is disabled by default.
* SortKeys
Specifies map keys should be sorted before being printed. Use
this to have a more deterministic, diffable output. Note that
only native types (bool, int, uint, floats, uintptr and string)
and types which implement error or Stringer interfaces are supported,
with other types sorted according to the reflect.Value.String() output
which guarantees display stability. Natural map order is used by
default.
* SpewKeys
SpewKeys specifies that, as a last resort attempt, map keys should be
spewed to strings and sorted by those strings. This is only considered
if SortKeys is true.
```
## Unsafe Package Dependency
This package relies on the unsafe package to perform some of the more advanced
features, however it also supports a "limited" mode which allows it to work in
environments where the unsafe package is not available. By default, it will
operate in this mode on Google App Engine and when compiled with GopherJS. The
"safe" build tag may also be specified to force the package to build without
using the unsafe package.
## License
Go-spew is licensed under the [copyfree](http://copyfree.org) ISC License.
================================================
FILE: vendor/github.com/davecgh/go-spew/cov_report.sh
================================================
#!/bin/sh
# This script uses gocov to generate a test coverage report.
# The gocov tool my be obtained with the following command:
# go get github.com/axw/gocov/gocov
#
# It will be installed to $GOPATH/bin, so ensure that location is in your $PATH.
# Check for gocov.
if ! type gocov >/dev/null 2>&1; then
echo >&2 "This script requires the gocov tool."
echo >&2 "You may obtain it with the following command:"
echo >&2 "go get github.com/axw/gocov/gocov"
exit 1
fi
# Only run the cgo tests if gcc is installed.
if type gcc >/dev/null 2>&1; then
(cd spew && gocov test -tags testcgo | gocov report)
else
(cd spew && gocov test | gocov report)
fi
================================================
FILE: vendor/github.com/davecgh/go-spew/spew/bypass.go
================================================
// Copyright (c) 2015-2016 Dave Collins <dave@davec.name>
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
// NOTE: Due to the following build constraints, this file will only be compiled
// when the code is not running on Google App Engine, compiled by GopherJS, and
// "-tags safe" is not added to the go build command line. The "disableunsafe"
// tag is deprecated and thus should not be used.
// +build !js,!appengine,!safe,!disableunsafe
package spew
import (
"reflect"
"unsafe"
)
const (
// UnsafeDisabled is a build-time constant which specifies whether or
// not access to the unsafe package is available.
UnsafeDisabled = false
// ptrSize is the size of a pointer on the current arch.
ptrSize = unsafe.Sizeof((*byte)(nil))
)
var (
// offsetPtr, offsetScalar, and offsetFlag are the offsets for the
// internal reflect.Value fields. These values are valid before golang
// commit ecccf07e7f9d which changed the format. The are also valid
// after commit 82f48826c6c7 which changed the format again to mirror
// the original format. Code in the init function updates these offsets
// as necessary.
offsetPtr = uintptr(ptrSize)
offsetScalar = uintptr(0)
offsetFlag = uintptr(ptrSize * 2)
// flagKindWidth and flagKindShift indicate various bits that the
// reflect package uses internally to track kind information.
//
// flagRO indicates whether or not the value field of a reflect.Value is
// read-only.
//
// flagIndir indicates whether the value field of a reflect.Value is
// the actual data or a pointer to the data.
//
// These values are valid before golang commit 90a7c3c86944 which
// changed their positions. Code in the init function updates these
// flags as necessary.
flagKindWidth = uintptr(5)
flagKindShift = uintptr(flagKindWidth - 1)
flagRO = uintptr(1 << 0)
flagIndir = uintptr(1 << 1)
)
func init() {
// Older versions of reflect.Value stored small integers directly in the
// ptr field (which is named val in the older versions). Versions
// between commits ecccf07e7f9d and 82f48826c6c7 added a new field named
// scalar for this purpose which unfortunately came before the flag
// field, so the offset of the flag field is different for those
// versions.
//
// This code constructs a new reflect.Value from a known small integer
// and checks if the size of the reflect.Value struct indicates it has
// the scalar field. When it does, the offsets are updated accordingly.
vv := reflect.ValueOf(0xf00)
if unsafe.Sizeof(vv) == (ptrSize * 4) {
offsetScalar = ptrSize * 2
offsetFlag = ptrSize * 3
}
// Commit 90a7c3c86944 changed the flag positions such that the low
// order bits are the kind. This code extracts the kind from the flags
// field and ensures it's the correct type. When it's not, the flag
// order has been changed to the newer format, so the flags are updated
// accordingly.
upf := unsafe.Pointer(uintptr(unsafe.Pointer(&vv)) + offsetFlag)
upfv := *(*uintptr)(upf)
flagKindMask := uintptr((1<<flagKindWidth - 1) << flagKindShift)
if (upfv&flagKindMask)>>flagKindShift != uintptr(reflect.Int) {
flagKindShift = 0
flagRO = 1 << 5
flagIndir = 1 << 6
// Commit adf9b30e5594 modified the flags to separate the
// flagRO flag into two bits which specifies whether or not the
// field is embedded. This causes flagIndir to move over a bit
// and means that flagRO is the combination of either of the
// original flagRO bit and the new bit.
//
// This code detects the change by extracting what used to be
// the indirect bit to ensure it's set. When it's not, the flag
// order has been changed to the newer format, so the flags are
// updated accordingly.
if upfv&flagIndir == 0 {
flagRO = 3 << 5
flagIndir = 1 << 7
}
}
}
// unsafeReflectValue converts the passed reflect.Value into a one that bypasses
// the typical safety restrictions preventing access to unaddressable and
// unexported data. It works by digging the raw pointer to the underlying
// value out of the protected value and generating a new unprotected (unsafe)
// reflect.Value to it.
//
// This allows us to check for implementations of the Stringer and error
// interfaces to be used for pretty printing ordinarily unaddressable and
// inaccessible values such as unexported struct fields.
func unsafeReflectValue(v reflect.Value) (rv reflect.Value) {
indirects := 1
vt := v.Type()
upv := unsafe.Pointer(uintptr(unsafe.Pointer(&v)) + offsetPtr)
rvf := *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&v)) + offsetFlag))
if rvf&flagIndir != 0 {
vt = reflect.PtrTo(v.Type())
indirects++
} else if offsetScalar != 0 {
// The value is in the scalar field when it's not one of the
// reference types.
switch vt.Kind() {
case reflect.Uintptr:
case reflect.Chan:
case reflect.Func:
case reflect.Map:
case reflect.Ptr:
case reflect.UnsafePointer:
default:
upv = unsafe.Pointer(uintptr(unsafe.Pointer(&v)) +
offsetScalar)
}
}
pv := reflect.NewAt(vt, upv)
rv = pv
for i := 0; i < indirects; i++ {
rv = rv.Elem()
}
return rv
}
================================================
FILE: vendor/github.com/davecgh/go-spew/spew/bypasssafe.go
================================================
// Copyright (c) 2015-2016 Dave Collins <dave@davec.name>
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
// NOTE: Due to the following build constraints, this file will only be compiled
// when the code is running on Google App Engine, compiled by GopherJS, or
// "-tags safe" is added to the go build command line. The "disableunsafe"
// tag is deprecated and thus should not be used.
// +build js appengine safe disableunsafe
package spew
import "reflect"
const (
// UnsafeDisabled is a build-time constant which specifies whether or
// not access to the unsafe package is available.
UnsafeDisabled = true
)
// unsafeReflectValue typically converts the passed reflect.Value into a one
// that bypasses the typical safety restrictions preventing access to
// unaddressable and unexported data. However, doing this relies on access to
// the unsafe package. This is a stub version which simply returns the passed
// reflect.Value when the unsafe package is not available.
func unsafeReflectValue(v reflect.Value) reflect.Value {
return v
}
================================================
FILE: vendor/github.com/davecgh/go-spew/spew/common.go
================================================
/*
* Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
package spew
import (
"bytes"
"fmt"
"io"
"reflect"
"sort"
"strconv"
)
// Some constants in the form of bytes to avoid string overhead. This mirrors
// the technique used in the fmt package.
var (
panicBytes = []byte("(PANIC=")
plusBytes = []byte("+")
iBytes = []byte("i")
trueBytes = []byte("true")
falseBytes = []byte("false")
interfaceBytes = []byte("(interface {})")
commaNewlineBytes = []byte(",\n")
newlineBytes = []byte("\n")
openBraceBytes = []byte("{")
openBraceNewlineBytes = []byte("{\n")
closeBraceBytes = []byte("}")
asteriskBytes = []byte("*")
colonBytes = []byte(":")
colonSpaceBytes = []byte(": ")
openParenBytes = []byte("(")
closeParenBytes = []byte(")")
spaceBytes = []byte(" ")
pointerChainBytes = []byte("->")
nilAngleBytes = []byte("<nil>")
maxNewlineBytes = []byte("<max depth reached>\n")
maxShortBytes = []byte("<max>")
circularBytes = []byte("<already shown>")
circularShortBytes = []byte("<shown>")
invalidAngleBytes = []byte("<invalid>")
openBracketBytes = []byte("[")
closeBracketBytes = []byte("]")
percentBytes = []byte("%")
precisionBytes = []byte(".")
openAngleBytes = []byte("<")
closeAngleBytes = []byte(">")
openMapBytes = []byte("map[")
closeMapBytes = []byte("]")
lenEqualsBytes = []byte("len=")
capEqualsBytes = []byte("cap=")
)
// hexDigits is used to map a decimal value to a hex digit.
var hexDigits = "0123456789abcdef"
// catchPanic handles any panics that might occur during the handleMethods
// calls.
func catchPanic(w io.Writer, v reflect.Value) {
if err := recover(); err != nil {
w.Write(panicBytes)
fmt.Fprintf(w, "%v", err)
w.Write(closeParenBytes)
}
}
// handleMethods attempts to call the Error and String methods on the underlying
// type the passed reflect.Value represents and outputes the result to Writer w.
//
// It handles panics in any called methods by catching and displaying the error
// as the formatted value.
func handleMethods(cs *ConfigState, w io.Writer, v reflect.Value) (handled bool) {
// We need an interface to check if the type implements the error or
// Stringer interface. However, the reflect package won't give us an
// interface on certain things like unexported struct fields in order
// to enforce visibility rules. We use unsafe, when it's available,
// to bypass these restrictions since this package does not mutate the
// values.
if !v.CanInterface() {
if UnsafeDisabled {
return false
}
v = unsafeReflectValue(v)
}
// Choose whether or not to do error and Stringer interface lookups against
// the base type or a pointer to the base type depending on settings.
// Technically calling one of these methods with a pointer receiver can
// mutate the value, however, types which choose to satisify an error or
// Stringer interface with a pointer receiver should not be mutating their
// state inside these interface methods.
if !cs.DisablePointerMethods && !UnsafeDisabled && !v.CanAddr() {
v = unsafeReflectValue(v)
}
if v.CanAddr() {
v = v.Addr()
}
// Is it an error or Stringer?
switch iface := v.Interface().(type) {
case error:
defer catchPanic(w, v)
if cs.ContinueOnMethod {
w.Write(openParenBytes)
w.Write([]byte(iface.Error()))
w.Write(closeParenBytes)
w.Write(spaceBytes)
return false
}
w.Write([]byte(iface.Error()))
return true
case fmt.Stringer:
defer catchPanic(w, v)
if cs.ContinueOnMethod {
w.Write(openParenBytes)
w.Write([]byte(iface.String()))
w.Write(closeParenBytes)
w.Write(spaceBytes)
return false
}
w.Write([]byte(iface.String()))
return true
}
return false
}
// printBool outputs a boolean value as true or false to Writer w.
func printBool(w io.Writer, val bool) {
if val {
w.Write(trueBytes)
} else {
w.Write(falseBytes)
}
}
// printInt outputs a signed integer value to Writer w.
func printInt(w io.Writer, val int64, base int) {
w.Write([]byte(strconv.FormatInt(val, base)))
}
// printUint outputs an unsigned integer value to Writer w.
func printUint(w io.Writer, val uint64, base int) {
w.Write([]byte(strconv.FormatUint(val, base)))
}
// printFloat outputs a floating point value using the specified precision,
// which is expected to be 32 or 64bit, to Writer w.
func printFloat(w io.Writer, val float64, precision int) {
w.Write([]byte(strconv.FormatFloat(val, 'g', -1, precision)))
}
// printComplex outputs a complex value using the specified float precision
// for the real and imaginary parts to Writer w.
func printComplex(w io.Writer, c complex128, floatPrecision int) {
r := real(c)
w.Write(openParenBytes)
w.Write([]byte(strconv.FormatFloat(r, 'g', -1, floatPrecision)))
i := imag(c)
if i >= 0 {
w.Write(plusBytes)
}
w.Write([]byte(strconv.FormatFloat(i, 'g', -1, floatPrecision)))
w.Write(iBytes)
w.Write(closeParenBytes)
}
// printHexPtr outputs a uintptr formatted as hexidecimal with a leading '0x'
// prefix to Writer w.
func printHexPtr(w io.Writer, p uintptr) {
// Null pointer.
num := uint64(p)
if num == 0 {
w.Write(nilAngleBytes)
return
}
// Max uint64 is 16 bytes in hex + 2 bytes for '0x' prefix
buf := make([]byte, 18)
// It's simpler to construct the hex string right to left.
base := uint64(16)
i := len(buf) - 1
for num >= base {
buf[i] = hexDigits[num%base]
num /= base
i--
}
buf[i] = hexDigits[num]
// Add '0x' prefix.
i--
buf[i] = 'x'
i--
buf[i] = '0'
// Strip unused leading bytes.
buf = buf[i:]
w.Write(buf)
}
// valuesSorter implements sort.Interface to allow a slice of reflect.Value
// elements to be sorted.
type valuesSorter struct {
values []reflect.Value
strings []string // either nil or same len and values
cs *ConfigState
}
// newValuesSorter initializes a valuesSorter instance, which holds a set of
// surrogate keys on which the data should be sorted. It uses flags in
// ConfigState to decide if and how to populate those surrogate keys.
func newValuesSorter(values []reflect.Value, cs *ConfigState) sort.Interface {
vs := &valuesSorter{values: values, cs: cs}
if canSortSimply(vs.values[0].Kind()) {
return vs
}
if !cs.DisableMethods {
vs.strings = make([]string, len(values))
for i := range vs.values {
b := bytes.Buffer{}
if !handleMethods(cs, &b, vs.values[i]) {
vs.strings = nil
break
}
vs.strings[i] = b.String()
}
}
if vs.strings == nil && cs.SpewKeys {
vs.strings = make([]string, len(values))
for i := range vs.values {
vs.strings[i] = Sprintf("%#v", vs.values[i].Interface())
}
}
return vs
}
// canSortSimply tests whether a reflect.Kind is a primitive that can be sorted
// directly, or whether it should be considered for sorting by surrogate keys
// (if the ConfigState allows it).
func canSortSimply(kind reflect.Kind) bool {
// This switch parallels valueSortLess, except for the default case.
switch kind {
case reflect.Bool:
return true
case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:
return true
case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:
return true
case reflect.Float32, reflect.Float64:
return true
case reflect.String:
return true
case reflect.Uintptr:
return true
case reflect.Array:
return true
}
return false
}
// Len returns the number of values in the slice. It is part of the
// sort.Interface implementation.
func (s *valuesSorter) Len() int {
return len(s.values)
}
// Swap swaps the values at the passed indices. It is part of the
// sort.Interface implementation.
func (s *valuesSorter) Swap(i, j int) {
s.values[i], s.values[j] = s.values[j], s.values[i]
if s.strings != nil {
s.strings[i], s.strings[j] = s.strings[j], s.strings[i]
}
}
// valueSortLess returns whether the first value should sort before the second
// value. It is used by valueSorter.Less as part of the sort.Interface
// implementation.
func valueSortLess(a, b reflect.Value) bool {
switch a.Kind() {
case reflect.Bool:
return !a.Bool() && b.Bool()
case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:
return a.Int() < b.Int()
case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:
return a.Uint() < b.Uint()
case reflect.Float32, reflect.Float64:
return a.Float() < b.Float()
case reflect.String:
return a.String() < b.String()
case reflect.Uintptr:
return a.Uint() < b.Uint()
case reflect.Array:
// Compare the contents of both arrays.
l := a.Len()
for i := 0; i < l; i++ {
av := a.Index(i)
bv := b.Index(i)
if av.Interface() == bv.Interface() {
continue
}
return valueSortLess(av, bv)
}
}
return a.String() < b.String()
}
// Less returns whether the value at index i should sort before the
// value at index j. It is part of the sort.Interface implementation.
func (s *valuesSorter) Less(i, j int) bool {
if s.strings == nil {
return valueSortLess(s.values[i], s.values[j])
}
return s.strings[i] < s.strings[j]
}
// sortValues is a sort function that handles both native types and any type that
// can be converted to error or Stringer. Other inputs are sorted according to
// their Value.String() value to ensure display stability.
func sortValues(values []reflect.Value, cs *ConfigState) {
if len(values) == 0 {
return
}
sort.Sort(newValuesSorter(values, cs))
}
================================================
FILE: vendor/github.com/davecgh/go-spew/spew/common_test.go
================================================
/*
* Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
package spew_test
import (
"fmt"
"reflect"
"testing"
"github.com/davecgh/go-spew/spew"
)
// custom type to test Stinger interface on non-pointer receiver.
type stringer string
// String implements the Stringer interface for testing invocation of custom
// stringers on types with non-pointer receivers.
func (s stringer) String() string {
return "stringer " + string(s)
}
// custom type to test Stinger interface on pointer receiver.
type pstringer string
// String implements the Stringer interface for testing invocation of custom
// stringers on types with only pointer receivers.
func (s *pstringer) String() string {
return "stringer " + string(*s)
}
// xref1 and xref2 are cross referencing structs for testing circular reference
// detection.
type xref1 struct {
ps2 *xref2
}
type xref2 struct {
ps1 *xref1
}
// indirCir1, indirCir2, and indirCir3 are used to generate an indirect circular
// reference for testing detection.
type indirCir1 struct {
ps2 *indirCir2
}
type indirCir2 struct {
ps3 *indirCir3
}
type indirCir3 struct {
ps1 *indirCir1
}
// embed is used to test embedded structures.
type embed struct {
a string
}
// embedwrap is used to test embedded structures.
type embedwrap struct {
*embed
e *embed
}
// panicer is used to intentionally cause a panic for testing spew properly
// handles them
type panicer int
func (p panicer) String() string {
panic("test panic")
}
// customError is used to test custom error interface invocation.
type customError int
func (e customError) Error() string {
return fmt.Sprintf("error: %d", int(e))
}
// stringizeWants converts a slice of wanted test output into a format suitable
// for a test error message.
func stringizeWants(wants []string) string {
s := ""
for i, want := range wants {
if i > 0 {
s += fmt.Sprintf("want%d: %s", i+1, want)
} else {
s += "want: " + want
}
}
return s
}
// testFailed returns whether or not a test failed by checking if the result
// of the test is in the slice of wanted strings.
func testFailed(result string, wants []string) bool {
for _, want := range wants {
if result == want {
return false
}
}
return true
}
type sortableStruct struct {
x int
}
func (ss sortableStruct) String() string {
return fmt.Sprintf("ss.%d", ss.x)
}
type unsortableStruct struct {
x int
}
type sortTestCase struct {
input []reflect.Value
expected []reflect.Value
}
func helpTestSortValues(tests []sortTestCase, cs *spew.ConfigState, t *testing.T) {
getInterfaces := func(values []reflect.Value) []interface{} {
interfaces := []interface{}{}
for _, v := range values {
interfaces = append(interfaces, v.Interface())
}
return interfaces
}
for _, test := range tests {
spew.SortValues(test.input, cs)
// reflect.DeepEqual cannot really make sense of reflect.Value,
// probably because of all the pointer tricks. For instance,
// v(2.0) != v(2.0) on a 32-bits system. Turn them into interface{}
// instead.
input := getInterfaces(test.input)
expected := getInterfaces(test.expected)
if !reflect.DeepEqual(input, expected) {
t.Errorf("Sort mismatch:\n %v != %v", input, expected)
}
}
}
// TestSortValues ensures the sort functionality for relect.Value based sorting
// works as intended.
func TestSortValues(t *testing.T) {
v := reflect.ValueOf
a := v("a")
b := v("b")
c := v("c")
embedA := v(embed{"a"})
embedB := v(embed{"b"})
embedC := v(embed{"c"})
tests := []sortTestCase{
// No values.
{
[]reflect.Value{},
[]reflect.Value{},
},
// Bools.
{
[]reflect.Value{v(false), v(true), v(false)},
[]reflect.Value{v(false), v(false), v(true)},
},
// Ints.
{
[]reflect.Value{v(2), v(1), v(3)},
[]reflect.Value{v(1), v(2), v(3)},
},
// Uints.
{
[]reflect.Value{v(uint8(2)), v(uint8(1)), v(uint8(3))},
[]reflect.Value{v(uint8(1)), v(uint8(2)), v(uint8(3))},
},
// Floats.
{
[]reflect.Value{v(2.0), v(1.0), v(3.0)},
[]reflect.Value{v(1.0), v(2.0), v(3.0)},
},
// Strings.
{
[]reflect.Value{b, a, c},
[]reflect.Value{a, b, c},
},
// Array
{
[]reflect.Value{v([3]int{3, 2, 1}), v([3]int{1, 3, 2}), v([3]int{1, 2, 3})},
[]reflect.Value{v([3]int{1, 2, 3}), v([3]int{1, 3, 2}), v([3]int{3, 2, 1})},
},
// Uintptrs.
{
[]reflect.Value{v(uintptr(2)), v(uintptr(1)), v(uintptr(3))},
[]reflect.Value{v(uintptr(1)), v(uintptr(2)), v(uintptr(3))},
},
// SortableStructs.
{
// Note: not sorted - DisableMethods is set.
[]reflect.Value{v(sortableStruct{2}), v(sortableStruct{1}), v(sortableStruct{3})},
[]reflect.Value{v(sortableStruct{2}), v(sortableStruct{1}), v(sortableStruct{3})},
},
// UnsortableStructs.
{
// Note: not sorted - SpewKeys is false.
[]reflect.Value{v(unsortableStruct{2}), v(unsortableStruct{1}), v(unsortableStruct{3})},
[]reflect.Value{v(unsortableStruct{2}), v(unsortableStruct{1}), v(unsortableStruct{3})},
},
// Invalid.
{
[]reflect.Value{embedB, embedA, embedC},
[]reflect.Value{embedB, embedA, embedC},
},
}
cs := spew.ConfigState{DisableMethods: true, SpewKeys: false}
helpTestSortValues(tests, &cs, t)
}
// TestSortValuesWithMethods ensures the sort functionality for relect.Value
// based sorting works as intended when using string methods.
func TestSortValuesWithMethods(t *testing.T) {
v := reflect.ValueOf
a := v("a")
b := v("b")
c := v("c")
tests := []sortTestCase{
// Ints.
{
[]reflect.Value{v(2), v(1), v(3)},
[]reflect.Value{v(1), v(2), v(3)},
},
// Strings.
{
[]reflect.Value{b, a, c},
[]reflect.Value{a, b, c},
},
// SortableStructs.
{
[]reflect.Value{v(sortableStruct{2}), v(sortableStruct{1}), v(sortableStruct{3})},
[]reflect.Value{v(sortableStruct{1}), v(sortableStruct{2}), v(sortableStruct{3})},
},
// UnsortableStructs.
{
// Note: not sorted - SpewKeys is false.
[]reflect.Value{v(unsortableStruct{2}), v(unsortableStruct{1}), v(unsortableStruct{3})},
[]reflect.Value{v(unsortableStruct{2}), v(unsortableStruct{1}), v(unsortableStruct{3})},
},
}
cs := spew.ConfigState{DisableMethods: false, SpewKeys: false}
helpTestSortValues(tests, &cs, t)
}
// TestSortValuesWithSpew ensures the sort functionality for relect.Value
// based sorting works as intended when using spew to stringify keys.
func TestSortValuesWithSpew(t *testing.T) {
v := reflect.ValueOf
a := v("a")
b := v("b")
c := v("c")
tests := []sortTestCase{
// Ints.
{
[]reflect.Value{v(2), v(1), v(3)},
[]reflect.Value{v(1), v(2), v(3)},
},
// Strings.
{
[]reflect.Value{b, a, c},
[]reflect.Value{a, b, c},
},
// SortableStructs.
{
[]reflect.Value{v(sortableStruct{2}), v(sortableStruct{1}), v(sortableStruct{3})},
[]reflect.Value{v(sortableStruct{1}), v(sortableStruct{2}), v(sortableStruct{3})},
},
// UnsortableStructs.
{
[]reflect.Value{v(unsortableStruct{2}), v(unsortableStruct{1}), v(unsortableStruct{3})},
[]reflect.Value{v(unsortableStruct{1}), v(unsortableStruct{2}), v(unsortableStruct{3})},
},
}
cs := spew.ConfigState{DisableMethods: true, SpewKeys: true}
helpTestSortValues(tests, &cs, t)
}
================================================
FILE: vendor/github.com/davecgh/go-spew/spew/config.go
================================================
/*
* Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
package spew
import (
"bytes"
"fmt"
"io"
"os"
)
// ConfigState houses the configuration options used by spew to format and
// display values. There is a global instance, Config, that is used to control
// all top-level Formatter and Dump functionality. Each ConfigState instance
// provides methods equivalent to the top-level functions.
//
// The zero value for ConfigState provides no indentation. You would typically
// want to set it to a space or a tab.
//
// Alternatively, you can use NewDefaultConfig to get a ConfigState instance
// with default settings. See the documentation of NewDefaultConfig for default
// values.
type ConfigState struct {
// Indent specifies the string to use for each indentation level. The
// global config instance that all top-level functions use set this to a
// single space by default. If you would like more indentation, you might
// set this to a tab with "\t" or perhaps two spaces with " ".
Indent string
// MaxDepth controls the maximum number of levels to descend into nested
// data structures. The default, 0, means there is no limit.
//
// NOTE: Circular data structures are properly detected, so it is not
// necessary to set this value unless you specifically want to limit deeply
// nested data structures.
MaxDepth int
// DisableMethods specifies whether or not error and Stringer interfaces are
// invoked for types that implement them.
DisableMethods bool
// DisablePointerMethods specifies whether or not to check for and invoke
// error and Stringer interfaces on types which only accept a pointer
// receiver when the current type is not a pointer.
//
// NOTE: This might be an unsafe action since calling one of these methods
// with a pointer receiver could technically mutate the value, however,
// in practice, types which choose to satisify an error or Stringer
// interface with a pointer receiver should not be mutating their state
// inside these interface methods. As a result, this option relies on
// access to the unsafe package, so it will not have any effect when
// running in environments without access to the unsafe package such as
// Google App Engine or with the "safe" build tag specified.
DisablePointerMethods bool
// DisablePointerAddresses specifies whether to disable the printing of
// pointer addresses. This is useful when diffing data structures in tests.
DisablePointerAddresses bool
// DisableCapacities specifies whether to disable the printing of capacities
// for arrays, slices, maps and channels. This is useful when diffing
// data structures in tests.
DisableCapacities bool
// ContinueOnMethod specifies whether or not recursion should continue once
// a custom error or Stringer interface is invoked. The default, false,
// means it will print the results of invoking the custom error or Stringer
// interface and return immediately instead of continuing to recurse into
// the internals of the data type.
//
// NOTE: This flag does not have any effect if method invocation is disabled
// via the DisableMethods or DisablePointerMethods options.
ContinueOnMethod bool
// SortKeys specifies map keys should be sorted before being printed. Use
// this to have a more deterministic, diffable output. Note that only
// native types (bool, int, uint, floats, uintptr and string) and types
// that support the error or Stringer interfaces (if methods are
// enabled) are supported, with other types sorted according to the
// reflect.Value.String() output which guarantees display stability.
SortKeys bool
// SpewKeys specifies that, as a last resort attempt, map keys should
// be spewed to strings and sorted by those strings. This is only
// considered if SortKeys is true.
SpewKeys bool
}
// Config is the active configuration of the top-level functions.
// The configuration can be changed by modifying the contents of spew.Config.
var Config = ConfigState{Indent: " "}
// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were
// passed with a Formatter interface returned by c.NewFormatter. It returns
// the formatted string as a value that satisfies error. See NewFormatter
// for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Errorf(format, c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Errorf(format string, a ...interface{}) (err error) {
return fmt.Errorf(format, c.convertArgs(a)...)
}
// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were
// passed with a Formatter interface returned by c.NewFormatter. It returns
// the number of bytes written and any write error encountered. See
// NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Fprint(w, c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Fprint(w io.Writer, a ...interface{}) (n int, err error) {
return fmt.Fprint(w, c.convertArgs(a)...)
}
// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were
// passed with a Formatter interface returned by c.NewFormatter. It returns
// the number of bytes written and any write error encountered. See
// NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Fprintf(w, format, c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) {
return fmt.Fprintf(w, format, c.convertArgs(a)...)
}
// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it
// passed with a Formatter interface returned by c.NewFormatter. See
// NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Fprintln(w, c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Fprintln(w io.Writer, a ...interface{}) (n int, err error) {
return fmt.Fprintln(w, c.convertArgs(a)...)
}
// Print is a wrapper for fmt.Print that treats each argument as if it were
// passed with a Formatter interface returned by c.NewFormatter. It returns
// the number of bytes written and any write error encountered. See
// NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Print(c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Print(a ...interface{}) (n int, err error) {
return fmt.Print(c.convertArgs(a)...)
}
// Printf is a wrapper for fmt.Printf that treats each argument as if it were
// passed with a Formatter interface returned by c.NewFormatter. It returns
// the number of bytes written and any write error encountered. See
// NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Printf(format, c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Printf(format string, a ...interface{}) (n int, err error) {
return fmt.Printf(format, c.convertArgs(a)...)
}
// Println is a wrapper for fmt.Println that treats each argument as if it were
// passed with a Formatter interface returned by c.NewFormatter. It returns
// the number of bytes written and any write error encountered. See
// NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Println(c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Println(a ...interface{}) (n int, err error) {
return fmt.Println(c.convertArgs(a)...)
}
// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were
// passed with a Formatter interface returned by c.NewFormatter. It returns
// the resulting string. See NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Sprint(c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Sprint(a ...interface{}) string {
return fmt.Sprint(c.convertArgs(a)...)
}
// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were
// passed with a Formatter interface returned by c.NewFormatter. It returns
// the resulting string. See NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Sprintf(format, c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Sprintf(format string, a ...interface{}) string {
return fmt.Sprintf(format, c.convertArgs(a)...)
}
// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it
// were passed with a Formatter interface returned by c.NewFormatter. It
// returns the resulting string. See NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Sprintln(c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Sprintln(a ...interface{}) string {
return fmt.Sprintln(c.convertArgs(a)...)
}
/*
NewFormatter returns a custom formatter that satisfies the fmt.Formatter
interface. As a result, it integrates cleanly with standard fmt package
printing functions. The formatter is useful for inline printing of smaller data
types similar to the standard %v format specifier.
The custom formatter only responds to the %v (most compact), %+v (adds pointer
addresses), %#v (adds types), and %#+v (adds types and pointer addresses) verb
combinations. Any other verbs such as %x and %q will be sent to the the
standard fmt package for formatting. In addition, the custom formatter ignores
the width and precision arguments (however they will still work on the format
specifiers not handled by the custom formatter).
Typically this function shouldn't be called directly. It is much easier to make
use of the custom formatter by calling one of the convenience functions such as
c.Printf, c.Println, or c.Printf.
*/
func (c *ConfigState) NewFormatter(v interface{}) fmt.Formatter {
return newFormatter(c, v)
}
// Fdump formats and displays the passed arguments to io.Writer w. It formats
// exactly the same as Dump.
func (c *ConfigState) Fdump(w io.Writer, a ...interface{}) {
fdump(c, w, a...)
}
/*
Dump displays the passed parameters to standard out with newlines, customizable
indentation, and additional debug information such as complete types and all
pointer addresses used to indirect to the final value. It provides the
following features over the built-in printing facilities provided by the fmt
package:
* Pointers are dereferenced and followed
* Circular data structures are detected and handled properly
* Custom Stringer/error interfaces are optionally invoked, including
on unexported types
* Custom types which only implement the Stringer/error interfaces via
a pointer receiver are optionally invoked when passing non-pointer
variables
* Byte arrays and slices are dumped like the hexdump -C command which
includes offsets, byte values in hex, and ASCII output
The configuration options are controlled by modifying the public members
of c. See ConfigState for options documentation.
See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to
get the formatted result as a string.
*/
func (c *ConfigState) Dump(a ...interface{}) {
fdump(c, os.Stdout, a...)
}
// Sdump returns a string with the passed arguments formatted exactly the same
// as Dump.
func (c *ConfigState) Sdump(a ...interface{}) string {
var buf bytes.Buffer
fdump(c, &buf, a...)
return buf.String()
}
// convertArgs accepts a slice of arguments and returns a slice of the same
// length with each argument converted to a spew Formatter interface using
// the ConfigState associated with s.
func (c *ConfigState) convertArgs(args []interface{}) (formatters []interface{}) {
formatters = make([]interface{}, len(args))
for index, arg := range args {
formatters[index] = newFormatter(c, arg)
}
return formatters
}
// NewDefaultConfig returns a ConfigState with the following default settings.
//
// Indent: " "
// MaxDepth: 0
// DisableMethods: false
// DisablePointerMethods: false
// ContinueOnMethod: false
// SortKeys: false
func NewDefaultConfig() *ConfigState {
return &ConfigState{Indent: " "}
}
================================================
FILE: vendor/github.com/davecgh/go-spew/spew/doc.go
================================================
/*
* Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
Package spew implements a deep pretty printer for Go data structures to aid in
debugging.
A quick overview of the additional features spew provides over the built-in
printing facilities for Go data types are as follows:
* Pointers are dereferenced and followed
* Circular data structures are detected and handled properly
* Custom Stringer/error interfaces are optionally invoked, including
on unexported types
* Custom types which only implement the Stringer/error interfaces via
a pointer receiver are optionally invoked when passing non-pointer
variables
* Byte arrays and slices are dumped like the hexdump -C command which
includes offsets, byte values in hex, and ASCII output (only when using
Dump style)
There are two different approaches spew allows for dumping Go data structures:
* Dump style which prints with newlines, customizable indentation,
and additional debug information such as types and all pointer addresses
used to indirect to the final value
* A custom Formatter interface that integrates cleanly with the standard fmt
package and replaces %v, %+v, %#v, and %#+v to provide inline printing
similar to the default %v while providing the additional functionality
outlined above and passing unsupported format verbs such as %x and %q
along to fmt
Quick Start
This section demonstrates how to quickly get started with spew. See the
sections below for further details on formatting and configuration options.
To dump a variable with full newlines, indentation, type, and pointer
information use Dump, Fdump, or Sdump:
spew.Dump(myVar1, myVar2, ...)
spew.Fdump(someWriter, myVar1, myVar2, ...)
str := spew.Sdump(myVar1, myVar2, ...)
Alternatively, if you would prefer to use format strings with a compacted inline
printing style, use the convenience wrappers Printf, Fprintf, etc with
%v (most compact), %+v (adds pointer addresses), %#v (adds types), or
%#+v (adds types and pointer addresses):
spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2)
spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4)
spew.Fprintf(someWriter, "myVar1: %v -- myVar2: %+v", myVar1, myVar2)
spew.Fprintf(someWriter, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4)
Configuration Options
Configuration of spew is handled by fields in the ConfigState type. For
convenience, all of the top-level functions use a global state available
via the spew.Config global.
It is also possible to create a ConfigState instance that provides methods
equivalent to the top-level functions. This allows concurrent configuration
options. See the ConfigState documentation for more details.
The following configuration options are available:
* Indent
String to use for each indentation level for Dump functions.
It is a single space by default. A popular alternative is "\t".
* MaxDepth
Maximum number of levels to descend into nested data structures.
There is no limit by default.
* DisableMethods
Disables invocation of error and Stringer interface methods.
Method invocation is enabled by default.
* DisablePointerMethods
Disables invocation of error and Stringer interface methods on types
which only accept pointer receivers from non-pointer variables.
Pointer method invocation is enabled by default.
* DisablePointerAddresses
DisablePointerAddresses specifies whether to disable the printing of
pointer addresses. This is useful when diffing data structures in tests.
* DisableCapacities
DisableCapacities specifies whether to disable the printing of
capacities for arrays, slices, maps and channels. This is useful when
diffing data structures in tests.
* ContinueOnMethod
Enables recursion into types after invoking error and Stringer interface
methods. Recursion after method invocation is disabled by default.
* SortKeys
Specifies map keys should be sorted before being printed. Use
this to have a more deterministic, diffable output. Note that
only native types (bool, int, uint, floats, uintptr and string)
and types which implement error or Stringer interfaces are
supported with other types sorted according to the
reflect.Value.String() output which guarantees display
stability. Natural map order is used by default.
* SpewKeys
Specifies that, as a last resort attempt, map keys should be
spewed to strings and sorted by those strings. This is only
considered if SortKeys is true.
Dump Usage
Simply call spew.Dump with a list of variables you want to dump:
spew.Dump(myVar1, myVar2, ...)
You may also call spew.Fdump if you would prefer to output to an arbitrary
io.Writer. For example, to dump to standard error:
spew.Fdump(os.Stderr, myVar1, myVar2, ...)
A third option is to call spew.Sdump to get the formatted output as a string:
str := spew.Sdump(myVar1, myVar2, ...)
Sample Dump Output
See the Dump example for details on the setup of the types and variables being
shown here.
(main.Foo) {
unexportedField: (*main.Bar)(0xf84002e210)({
flag: (main.Flag) flagTwo,
data: (uintptr) <nil>
}),
ExportedField: (map[interface {}]interface {}) (len=1) {
(string) (len=3) "one": (bool) true
}
}
Byte (and uint8) arrays and slices are displayed uniquely like the hexdump -C
command as shown.
([]uint8) (len=32 cap=32) {
00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 |............... |
00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 |!"#$%&'()*+,-./0|
00000020 31 32 |12|
}
Custom Formatter
Spew provides a custom formatter that implements the fmt.Formatter interface
so that it integrates cleanly with standard fmt package printing functions. The
formatter is useful for inline printing of smaller data types similar to the
standard %v format specifier.
The custom formatter only responds to the %v (most compact), %+v (adds pointer
addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb
combinations. Any other verbs such as %x and %q will be sent to the the
standard fmt package for formatting. In addition, the custom formatter ignores
the width and precision arguments (however they will still work on the format
specifiers not handled by the custom formatter).
Custom Formatter Usage
The simplest way to make use of the spew custom formatter is to call one of the
convenience functions such as spew.Printf, spew.Println, or spew.Printf. The
functions have syntax you are most likely already familiar with:
spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2)
spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4)
spew.Println(myVar, myVar2)
spew.Fprintf(os.Stderr, "myVar1: %v -- myVar2: %+v", myVar1, myVar2)
spew.Fprintf(os.Stderr, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4)
See the Index for the full list convenience functions.
Sample Formatter Output
Double pointer to a uint8:
%v: <**>5
%+v: <**>(0xf8400420d0->0xf8400420c8)5
%#v: (**uint8)5
%#+v: (**uint8)(0xf8400420d0->0xf8400420c8)5
Pointer to circular struct with a uint8 field and a pointer to itself:
%v: <*>{1 <*><shown>}
%+v: <*>(0xf84003e260){ui8:1 c:<*>(0xf84003e260)<shown>}
%#v: (*main.circular){ui8:(uint8)1 c:(*main.circular)<shown>}
%#+v: (*main.circular)(0xf84003e260){ui8:(uint8)1 c:(*main.circular)(0xf84003e260)<shown>}
See the Printf example for details on the setup of variables being shown
here.
Errors
Since it is possible for custom Stringer/error interfaces to panic, spew
detects them and handles them internally by printing the panic information
inline with the output. Since spew is intended to provide deep pretty printing
capabilities on structures, it intentionally does not return any errors.
*/
package spew
================================================
FILE: vendor/github.com/davecgh/go-spew/spew/dump.go
================================================
/*
* Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
package spew
import (
"bytes"
"encoding/hex"
"fmt"
"io"
"os"
"reflect"
"regexp"
"strconv"
"strings"
)
var (
// uint8Type is a reflect.Type representing a uint8. It is used to
// convert cgo types to uint8 slices for hexdumping.
uint8Type = reflect.TypeOf(uint8(0))
// cCharRE is a regular expression that matches a cgo char.
// It is used to detect character arrays to hexdump them.
cCharRE = regexp.MustCompile("^.*\\._Ctype_char$")
// cUnsignedCharRE is a regular expression that matches a cgo unsigned
// char. It is used to detect unsigned character arrays to hexdump
// them.
cUnsignedCharRE = regexp.MustCompile("^.*\\._Ctype_unsignedchar$")
// cUint8tCharRE is a regular expression that matches a cgo uint8_t.
// It is used to detect uint8_t arrays to hexdump them.
cUint8tCharRE = regexp.MustCompile("^.*\\._Ctype_uint8_t$")
)
// dumpState contains information about the state of a dump operation.
type dumpState struct {
w io.Writer
depth int
pointers map[uintptr]int
ignoreNextType bool
ignoreNextIndent bool
cs *ConfigState
}
// indent performs indentation according to the depth level and cs.Indent
// option.
func (d *dumpState) indent() {
if d.ignoreNextIndent {
d.ignoreNextIndent = false
return
}
d.w.Write(bytes.Repeat([]byte(d.cs.Indent), d.depth))
}
// unpackValue returns values inside of non-nil interfaces when possible.
// This is useful for data types like structs, arrays, slices, and maps which
// can contain varying types packed inside an interface.
func (d *dumpState) unpackValue(v reflect.Value) reflect.Value {
if v.Kind() == reflect.Interface && !v.IsNil() {
v = v.Elem()
}
return v
}
// dumpPtr handles formatting of pointers by indirecting them as necessary.
func (d *dumpState) dumpPtr(v reflect.Value) {
// Remove pointers at or below the current depth from map used to detect
// circular refs.
for k, depth := range d.pointers {
if depth >= d.depth {
delete(d.pointers, k)
}
}
// Keep list of all dereferenced pointers to show later.
pointerChain := make([]uintptr, 0)
// Figure out how many levels of indirection there are by dereferencing
// pointers and unpacking interfaces down the chain while detecting circular
// references.
nilFound := false
cycleFound := false
indirects := 0
ve := v
for ve.Kind() == reflect.Ptr {
if ve.IsNil() {
nilFound = true
break
}
indirects++
addr := ve.Pointer()
pointerChain = append(pointerChain, addr)
if pd, ok := d.pointers[addr]; ok && pd < d.depth {
cycleFound = true
indirects--
break
}
d.pointers[addr] = d.depth
ve = ve.Elem()
if ve.Kind() == reflect.Interface {
if ve.IsNil() {
nilFound = true
break
}
ve = ve.Elem()
}
}
// Display type information.
d.w.Write(openParenBytes)
d.w.Write(bytes.Repeat(asteriskBytes, indirects))
d.w.Write([]byte(ve.Type().String()))
d.w.Write(closeParenBytes)
// Display pointer information.
if !d.cs.DisablePointerAddresses && len(pointerChain) > 0 {
d.w.Write(openParenBytes)
for i, addr := range pointerChain {
if i > 0 {
d.w.Write(pointerChainBytes)
}
printHexPtr(d.w, addr)
}
d.w.Write(closeParenBytes)
}
// Display dereferenced value.
d.w.Write(openParenBytes)
switch {
case nilFound == true:
d.w.Write(nilAngleBytes)
case cycleFound == true:
d.w.Write(circularBytes)
default:
d.ignoreNextType = true
d.dump(ve)
}
d.w.Write(closeParenBytes)
}
// dumpSlice handles formatting of arrays and slices. Byte (uint8 under
// reflection) arrays and slices are dumped in hexdump -C fashion.
func (d *dumpState) dumpSlice(v reflect.Value) {
// Determine whether this type should be hex dumped or not. Also,
// for types which should be hexdumped, try to use the underlying data
// first, then fall back to trying to convert them to a uint8 slice.
var buf []uint8
doConvert := false
doHexDump := false
numEntries := v.Len()
if numEntries > 0 {
vt := v.Index(0).Type()
vts := vt.String()
switch {
// C types that need to be converted.
case cCharRE.MatchString(vts):
fallthrough
case cUnsignedCharRE.MatchString(vts):
fallthrough
case cUint8tCharRE.MatchString(vts):
doConvert = true
// Try to use existing uint8 slices and fall back to converting
// and copying if that fails.
case vt.Kind() == reflect.Uint8:
// We need an addressable interface to convert the type
// to a byte slice. However, the reflect package won't
// give us an interface on certain things like
// unexported struct fields in order to enforce
// visibility rules. We use unsafe, when available, to
// bypass these restrictions since this package does not
// mutate the values.
vs := v
if !vs.CanInterface() || !vs.CanAddr() {
vs = unsafeReflectValue(vs)
}
if !UnsafeDisabled {
vs = vs.Slice(0, numEntries)
// Use the existing uint8 slice if it can be
// type asserted.
iface := vs.Interface()
if slice, ok := iface.([]uint8); ok {
buf = slice
doHexDump = true
break
}
}
// The underlying data needs to be converted if it can't
// be type asserted to a uint8 slice.
doConvert = true
}
// Copy and convert the underlying type if needed.
if doConvert && vt.ConvertibleTo(uint8Type) {
// Convert and copy each element into a uint8 byte
// slice.
buf = make([]uint8, numEntries)
for i := 0; i < numEntries; i++ {
vv := v.Index(i)
buf[i] = uint8(vv.Convert(uint8Type).Uint())
}
doHexDump = true
}
}
// Hexdump the entire slice as needed.
if doHexDump {
indent := strings.Repeat(d.cs.Indent, d.depth)
str := indent + hex.Dump(buf)
str = strings.Replace(str, "\n", "\n"+indent, -1)
str = strings.TrimRight(str, d.cs.Indent)
d.w.Write([]byte(str))
return
}
// Recursively call dump for each item.
for i := 0; i < numEntries; i++ {
d.dump(d.unpackValue(v.Index(i)))
if i < (numEntries - 1) {
d.w.Write(commaNewlineBytes)
} else {
d.w.Write(newlineBytes)
}
}
}
// dump is the main workhorse for dumping a value. It uses the passed reflect
// value to figure out what kind of object we are dealing with and formats it
// appropriately. It is a recursive function, however circular data structures
// are detected and handled properly.
func (d *dumpState) dump(v reflect.Value) {
// Handle invalid reflect values immediately.
kind := v.Kind()
if kind == reflect.Invalid {
d.w.Write(invalidAngleBytes)
return
}
// Handle pointers specially.
if kind == reflect.Ptr {
d.indent()
d.dumpPtr(v)
return
}
// Print type information unless already handled elsewhere.
if !d.ignoreNextType {
d.indent()
d.w.Write(openParenBytes)
d.w.Write([]byte(v.Type().String()))
d.w.Write(closeParenBytes)
d.w.Write(spaceBytes)
}
d.ignoreNextType = false
// Display length and capacity if the built-in len and cap functions
// work with the value's kind and the len/cap itself is non-zero.
valueLen, valueCap := 0, 0
switch v.Kind() {
case reflect.Array, reflect.Slice, reflect.Chan:
valueLen, valueCap = v.Len(), v.Cap()
case reflect.Map, reflect.String:
valueLen = v.Len()
}
if valueLen != 0 || !d.cs.DisableCapacities && valueCap != 0 {
d.w.Write(openParenBytes)
if valueLen != 0 {
d.w.Write(lenEqualsBytes)
printInt(d.w, int64(valueLen), 10)
}
if !d.cs.DisableCapacities && valueCap != 0 {
if valueLen != 0 {
d.w.Write(spaceBytes)
}
d.w.Write(capEqualsBytes)
printInt(d.w, int64(valueCap), 10)
}
d.w.Write(closeParenBytes)
d.w.Write(spaceBytes)
}
// Call Stringer/error interfaces if they exist and the handle methods flag
// is enabled
if !d.cs.DisableMethods {
if (kind != reflect.Invalid) && (kind != reflect.Interface) {
if handled := handleMethods(d.cs, d.w, v); handled {
return
}
}
}
switch kind {
case reflect.Invalid:
// Do nothing. We should never get here since invalid has already
// been handled above.
case reflect.Bool:
printBool(d.w, v.Bool())
case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:
printInt(d.w, v.Int(), 10)
case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:
printUint(d.w, v.Uint(), 10)
case reflect.Float32:
printFloat(d.w, v.Float(), 32)
case reflect.Float64:
printFloat(d.w, v.Float(), 64)
case reflect.Complex64:
printComplex(d.w, v.Complex(), 32)
case reflect.Complex128:
printComplex(d.w, v.Complex(), 64)
case reflect.Slice:
if v.IsNil() {
d.w.Write(nilAngleBytes)
break
}
fallthrough
case reflect.Array:
d.w.Write(openBraceNewlineBytes)
d.depth++
if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) {
d.indent()
d.w.Write(maxNewlineBytes)
} else {
d.dumpSlice(v)
}
d.depth--
d.indent()
d.w.Write(closeBraceBytes)
case reflect.String:
d.w.Write([]byte(strconv.Quote(v.String())))
case reflect.Interface:
// The only time we should get here is for nil interfaces due to
// unpackValue calls.
if v.IsNil() {
d.w.Write(nilAngleBytes)
}
case reflect.Ptr:
// Do nothing. We should never get here since pointers have already
// been handled above.
case reflect.Map:
// nil maps should be indicated as different than empty maps
if v.IsNil() {
d.w.Write(nilAngleBytes)
break
}
d.w.Write(openBraceNewlineBytes)
d.depth++
if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) {
d.indent()
d.w.Write(maxNewlineBytes)
} else {
numEntries := v.Len()
keys := v.MapKeys()
if d.cs.SortKeys {
sortValues(keys, d.cs)
}
for i, key := range keys {
d.dump(d.unpackValue(key))
d.w.Write(colonSpaceBytes)
d.ignoreNextIndent = true
d.dump(d.unpackValue(v.MapIndex(key)))
if i < (numEntries - 1) {
d.w.Write(commaNewlineBytes)
} else {
d.w.Write(newlineBytes)
}
}
}
d.depth--
d.indent()
d.w.Write(closeBraceBytes)
case reflect.Struct:
d.w.Write(openBraceNewlineBytes)
d.depth++
if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) {
d.indent()
d.w.Write(maxNewlineBytes)
} else {
vt := v.Type()
numFields := v.NumField()
for i := 0; i < numFields; i++ {
d.indent()
vtf := vt.Field(i)
d.w.Write([]byte(vtf.Name))
d.w.Write(colonSpaceBytes)
d.ignoreNextIndent = true
d.dump(d.unpackValue(v.Field(i)))
if i < (numFields - 1) {
d.w.Write(commaNewlineBytes)
} else {
d.w.Write(newlineBytes)
}
}
}
d.depth--
d.indent()
d.w.Write(closeBraceBytes)
case reflect.Uintptr:
printHexPtr(d.w, uintptr(v.Uint()))
case reflect.UnsafePointer, reflect.Chan, reflect.Func:
printHexPtr(d.w, v.Pointer())
// There were not any other types at the time this code was written, but
// fall back to letting the default fmt package handle it in case any new
// types are added.
default:
if v.CanInterface() {
fmt.Fprintf(d.w, "%v", v.Interface())
} else {
fmt.Fprintf(d.w, "%v", v.String())
}
}
}
// fdump is a helper function to consolidate the logic from the various public
// methods which take varying writers and config states.
func fdump(cs *ConfigState, w io.Writer, a ...interface{}) {
for _, arg := range a {
if arg == nil {
w.Write(interfaceBytes)
w.Write(spaceBytes)
w.Write(nilAngleBytes)
w.Write(newlineBytes)
continue
}
d := dumpState{w: w, cs: cs}
d.pointers = make(map[uintptr]int)
d.dump(reflect.ValueOf(arg))
d.w.Write(newlineBytes)
}
}
// Fdump formats and displays the passed arguments to io.Writer w. It formats
// exactly the same as Dump.
func Fdump(w io.Writer, a ...interface{}) {
fdump(&Config, w, a...)
}
// Sdump returns a string with the passed arguments formatted exactly the same
// as Dump.
func Sdump(a ...interface{}) string {
var buf bytes.Buffer
fdump(&Config, &buf, a...)
return buf.String()
}
/*
Dump displays the passed parameters to standard out with newlines, customizable
indentation, and additional debug information such as complete types and all
pointer addresses used to indirect to the final value. It provides the
following features over the built-in printing facilities provided by the fmt
package:
* Pointers are dereferenced and followed
* Circular data structures are detected and handled properly
* Custom Stringer/error interfaces are optionally invoked, including
on unexported types
* Custom types which only implement the Stringer/error interfaces via
a pointer receiver are optionally invoked when passing non-pointer
variables
* Byte arrays and slices are dumped like the hexdump -C command which
includes offsets, byte values in hex, and ASCII output
The configuration options are controlled by an exported package global,
spew.Config. See ConfigState for options documentation.
See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to
get the formatted result as a string.
*/
func Dump(a ...interface{}) {
fdump(&Config, os.Stdout, a...)
}
================================================
FILE: vendor/github.com/davecgh/go-spew/spew/dump_test.go
================================================
/*
* Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
Test Summary:
NOTE: For each test, a nil pointer, a single pointer and double pointer to the
base test element are also tested to ensure proper indirection across all types.
- Max int8, int16, int32, int64, int
- Max uint8, uint16, uint32, uint64, uint
- Boolean true and false
- Standard complex64 and complex128
- Array containing standard ints
- Array containing type with custom formatter on pointer receiver only
- Array containing interfaces
- Array containing bytes
- Slice containing standard float32 values
- Slice containing type with custom formatter on pointer receiver only
- Slice containing interfaces
- Slice containing bytes
- Nil slice
- Standard string
- Nil interface
- Sub-interface
- Map with string keys and int vals
- Map with custom formatter type on pointer receiver only keys and vals
- Map with interface keys and values
- Map with nil interface value
- Struct with primitives
- Struct that contains another struct
- Struct that contains custom type with Stringer pointer interface via both
exported and unexported fields
- Struct that contains embedded struct and field to same struct
- Uintptr to 0 (null pointer)
- Uintptr address of real variable
- Unsafe.Pointer to 0 (null pointer)
- Unsafe.Pointer to address of real variable
- Nil channel
- Standard int channel
- Function with no params and no returns
- Function with param and no returns
- Function with multiple params and multiple returns
- Struct that is circular through self referencing
- Structs that are circular through cross referencing
- Structs that are indirectly circular
- Type that panics in its Stringer interface
*/
package spew_test
import (
"bytes"
"fmt"
"testing"
"unsafe"
"github.com/davecgh/go-spew/spew"
)
// dumpTest is used to describe a test to be performed against the Dump method.
type dumpTest struct {
in interface{}
wants []string
}
// dumpTests houses all of the tests to be performed against the Dump method.
var dumpTests = make([]dumpTest, 0)
// addDumpTest is a helper method to append the passed input and desired result
// to dumpTests
func addDumpTest(in interface{}, wants ...string) {
test := dumpTest{in, wants}
dumpTests = append(dumpTests, test)
}
func addIntDumpTests() {
// Max int8.
v := int8(127)
nv := (*int8)(nil)
pv := &v
vAddr := fmt.Sprintf("%p", pv)
pvAddr := fmt.Sprintf("%p", &pv)
vt := "int8"
vs := "127"
addDumpTest(v, "("+vt+") "+vs+"\n")
addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
addDumpTest(nv, "(*"+vt+")(<nil>)\n")
// Max int16.
v2 := int16(32767)
nv2 := (*int16)(nil)
pv2 := &v2
v2Addr := fmt.Sprintf("%p", pv2)
pv2Addr := fmt.Sprintf("%p", &pv2)
v2t := "int16"
v2s := "32767"
addDumpTest(v2, "("+v2t+") "+v2s+"\n")
addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
addDumpTest(nv2, "(*"+v2t+")(<nil>)\n")
// Max int32.
v3 := int32(2147483647)
nv3 := (*int32)(nil)
pv3 := &v3
v3Addr := fmt.Sprintf("%p", pv3)
pv3Addr := fmt.Sprintf("%p", &pv3)
v3t := "int32"
v3s := "2147483647"
addDumpTest(v3, "("+v3t+") "+v3s+"\n")
addDumpTest(pv3, "(*"+v3t+")("+v3Addr+")("+v3s+")\n")
addDumpTest(&pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")("+v3s+")\n")
addDumpTest(nv3, "(*"+v3t+")(<nil>)\n")
// Max int64.
v4 := int64(9223372036854775807)
nv4 := (*int64)(nil)
pv4 := &v4
v4Addr := fmt.Sprintf("%p", pv4)
pv4Addr := fmt.Sprintf("%p", &pv4)
v4t := "int64"
v4s := "9223372036854775807"
addDumpTest(v4, "("+v4t+") "+v4s+"\n")
addDumpTest(pv4, "(*"+v4t+")("+v4Addr+")("+v4s+")\n")
addDumpTest(&pv4, "(**"+v4t+")("+pv4Addr+"->"+v4Addr+")("+v4s+")\n")
addDumpTest(nv4, "(*"+v4t+")(<nil>)\n")
// Max int.
v5 := int(2147483647)
nv5 := (*int)(nil)
pv5 := &v5
v5Addr := fmt.Sprintf("%p", pv5)
pv5Addr := fmt.Sprintf("%p", &pv5)
v5t := "int"
v5s := "2147483647"
addDumpTest(v5, "("+v5t+") "+v5s+"\n")
addDumpTest(pv5, "(*"+v5t+")("+v5Addr+")("+v5s+")\n")
addDumpTest(&pv5, "(**"+v5t+")("+pv5Addr+"->"+v5Addr+")("+v5s+")\n")
addDumpTest(nv5, "(*"+v5t+")(<nil>)\n")
}
func addUintDumpTests() {
// Max uint8.
v := uint8(255)
nv := (*uint8)(nil)
pv := &v
vAddr := fmt.Sprintf("%p", pv)
pvAddr := fmt.Sprintf("%p", &pv)
vt := "uint8"
vs := "255"
addDumpTest(v, "("+vt+") "+vs+"\n")
addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
addDumpTest(nv, "(*"+vt+")(<nil>)\n")
// Max uint16.
v2 := uint16(65535)
nv2 := (*uint16)(nil)
pv2 := &v2
v2Addr := fmt.Sprintf("%p", pv2)
pv2Addr := fmt.Sprintf("%p", &pv2)
v2t := "uint16"
v2s := "65535"
addDumpTest(v2, "("+v2t+") "+v2s+"\n")
addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
addDumpTest(nv2, "(*"+v2t+")(<nil>)\n")
// Max uint32.
v3 := uint32(4294967295)
nv3 := (*uint32)(nil)
pv3 := &v3
v3Addr := fmt.Sprintf("%p", pv3)
pv3Addr := fmt.Sprintf("%p", &pv3)
v3t := "uint32"
v3s := "4294967295"
addDumpTest(v3, "("+v3t+") "+v3s+"\n")
addDumpTest(pv3, "(*"+v3t+")("+v3Addr+")("+v3s+")\n")
addDumpTest(&pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")("+v3s+")\n")
addDumpTest(nv3, "(*"+v3t+")(<nil>)\n")
// Max uint64.
v4 := uint64(18446744073709551615)
nv4 := (*uint64)(nil)
pv4 := &v4
v4Addr := fmt.Sprintf("%p", pv4)
pv4Addr := fmt.Sprintf("%p", &pv4)
v4t := "uint64"
v4s := "18446744073709551615"
addDumpTest(v4, "("+v4t+") "+v4s+"\n")
addDumpTest(pv4, "(*"+v4t+")("+v4Addr+")("+v4s+")\n")
addDumpTest(&pv4, "(**"+v4t+")("+pv4Addr+"->"+v4Addr+")("+v4s+")\n")
addDumpTest(nv4, "(*"+v4t+")(<nil>)\n")
// Max uint.
v5 := uint(4294967295)
nv5 := (*uint)(nil)
pv5 := &v5
v5Addr := fmt.Sprintf("%p", pv5)
pv5Addr := fmt.Sprintf("%p", &pv5)
v5t := "uint"
v5s := "4294967295"
addDumpTest(v5, "("+v5t+") "+v5s+"\n")
addDumpTest(pv5, "(*"+v5t+")("+v5Addr+")("+v5s+")\n")
addDumpTest(&pv5, "(**"+v5t+")("+pv5Addr+"->"+v5Addr+")("+v5s+")\n")
addDumpTest(nv5, "(*"+v5t+")(<nil>)\n")
}
func addBoolDumpTests() {
// Boolean true.
v := bool(true)
nv := (*bool)(nil)
pv := &v
vAddr := fmt.Sprintf("%p", pv)
pvAddr := fmt.Sprintf("%p", &pv)
vt := "bool"
vs := "true"
addDumpTest(v, "("+vt+") "+vs+"\n")
addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
addDumpTest(nv, "(*"+vt+")(<nil>)\n")
// Boolean false.
v2 := bool(false)
pv2 := &v2
v2Addr := fmt.Sprintf("%p", pv2)
pv2Addr := fmt.Sprintf("%p", &pv2)
v2t := "bool"
v2s := "false"
addDumpTest(v2, "("+v2t+") "+v2s+"\n")
addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
}
func addFloatDumpTests() {
// Standard float32.
v := float32(3.1415)
nv := (*float32)(nil)
pv := &v
vAddr := fmt.Sprintf("%p", pv)
pvAddr := fmt.Sprintf("%p", &pv)
vt := "float32"
vs := "3.1415"
addDumpTest(v, "("+vt+") "+vs+"\n")
addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
addDumpTest(nv, "(*"+vt+")(<nil>)\n")
// Standard float64.
v2 := float64(3.1415926)
nv2 := (*float64)(nil)
pv2 := &v2
v2Addr := fmt.Sprintf("%p", pv2)
pv2Addr := fmt.Sprintf("%p", &pv2)
v2t := "float64"
v2s := "3.1415926"
addDumpTest(v2, "("+v2t+") "+v2s+"\n")
addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
addDumpTest(nv2, "(*"+v2t+")(<nil>)\n")
}
func addComplexDumpTests() {
// Standard complex64.
v := complex(float32(6), -2)
nv := (*complex64)(nil)
pv := &v
vAddr := fmt.Sprintf("%p", pv)
pvAddr := fmt.Sprintf("%p", &pv)
vt := "complex64"
vs := "(6-2i)"
addDumpTest(v, "("+vt+") "+vs+"\n")
addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
addDumpTest(nv, "(*"+vt+")(<nil>)\n")
// Standard complex128.
v2 := complex(float64(-6), 2)
nv2 := (*complex128)(nil)
pv2 := &v2
v2Addr := fmt.Sprintf("%p", pv2)
pv2Addr := fmt.Sprintf("%p", &pv2)
v2t := "complex128"
v2s := "(-6+2i)"
addDumpTest(v2, "("+v2t+") "+v2s+"\n")
addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
addDumpTest(nv2, "(*"+v2t+")(<nil>)\n")
}
func addArrayDumpTests() {
// Array containing standard ints.
v := [3]int{1, 2, 3}
vLen := fmt.Sprintf("%d", len(v))
vCap := fmt.Sprintf("%d", cap(v))
nv := (*[3]int)(nil)
pv := &v
vAddr := fmt.Sprintf("%p", pv)
pvAddr := fmt.Sprintf("%p", &pv)
vt := "int"
vs := "(len=" + vLen + " cap=" + vCap + ") {\n (" + vt + ") 1,\n (" +
vt + ") 2,\n (" + vt + ") 3\n}"
addDumpTest(v, "([3]"+vt+") "+vs+"\n")
addDumpTest(pv, "(*[3]"+vt+")("+vAddr+")("+vs+")\n")
addDumpTest(&pv, "(**[3]"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
addDumpTest(nv, "(*[3]"+vt+")(<nil>)\n")
// Array containing type with custom formatter on pointer receiver only.
v2i0 := pstringer("1")
v2i1 := pstringer("2")
v2i2 := pstringer("3")
v2 := [3]pstringer{v2i0, v2i1, v2i2}
v2i0Len := fmt.Sprintf("%d", len(v2i0))
v2i1Len := fmt.Sprintf("%d", len(v2i1))
v2i2Len := fmt.Sprintf("%d", len(v2i2))
v2Len := fmt.Sprintf("%d", len(v2))
v2Cap := fmt.Sprintf("%d", cap(v2))
nv2 := (*[3]pstringer)(nil)
pv2 := &v2
v2Addr := fmt.Sprintf("%p", pv2)
pv2Addr := fmt.Sprintf("%p", &pv2)
v2t := "spew_test.pstringer"
v2sp := "(len=" + v2Len + " cap=" + v2Cap + ") {\n (" + v2t +
") (len=" + v2i0Len + ") stringer 1,\n (" + v2t +
") (len=" + v2i1Len + ") stringer 2,\n (" + v2t +
") (len=" + v2i2Len + ") " + "stringer 3\n}"
v2s := v2sp
if spew.UnsafeDisabled {
v2s = "(len=" + v2Len + " cap=" + v2Cap + ") {\n (" + v2t +
") (len=" + v2i0Len + ") \"1\",\n (" + v2t + ") (len=" +
v2i1Len + ") \"2\",\n (" + v2t + ") (len=" + v2i2Len +
") " + "\"3\"\n}"
}
addDumpTest(v2, "([3]"+v2t+") "+v2s+"\n")
addDumpTest(pv2, "(*[3]"+v2t+")("+v2Addr+")("+v2sp+")\n")
addDumpTest(&pv2, "(**[3]"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2sp+")\n")
addDumpTest(nv2, "(*[3]"+v2t+")(<nil>)\n")
// Array containing interfaces.
v3i0 := "one"
v3 := [3]interface{}{v3i0, int(2), uint(3)}
v3i0Len := fmt.Sprintf("%d", len(v3i0))
v3Len := fmt.Sprintf("%d", len(v3))
v3Cap := fmt.Sprintf("%d", cap(v3))
nv3 := (*[3]interface{})(nil)
pv3 := &v3
v3Addr := fmt.Sprintf("%p", pv3)
pv3Addr := fmt.Sprintf("%p", &pv3)
v3t := "[3]interface {}"
v3t2 := "string"
v3t3 := "int"
v3t4 := "uint"
v3s := "(len=" + v3Len + " cap=" + v3Cap + ") {\n (" + v3t2 + ") " +
"(len=" + v3i0Len + ") \"one\",\n (" + v3t3 + ") 2,\n (" +
v3t4 + ") 3\n}"
addDumpTest(v3, "("+v3t+") "+v3s+"\n")
addDumpTest(pv3, "(*"+v3t+")("+v3Addr+")("+v3s+")\n")
addDumpTest(&pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")("+v3s+")\n")
addDumpTest(nv3, "(*"+v3t+")(<nil>)\n")
// Array containing bytes.
v4 := [34]byte{
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
0x31, 0x32,
}
v4Len := fmt.Sprintf("%d", len(v4))
v4Cap := fmt.Sprintf("%d", cap(v4))
nv4 := (*[34]byte)(nil)
pv4 := &v4
v4Addr := fmt.Sprintf("%p", pv4)
pv4Addr := fmt.Sprintf("%p", &pv4)
v4t := "[34]uint8"
v4s := "(len=" + v4Len + " cap=" + v4Cap + ") " +
"{\n 00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20" +
" |............... |\n" +
" 00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30" +
" |!\"#$%&'()*+,-./0|\n" +
" 00000020 31 32 " +
" |12|\n}"
addDumpTest(v4, "("+v4t+") "+v4s+"\n")
addDumpTest(pv4, "(*"+v4t+")("+v4Addr+")("+v4s+")\n")
addDumpTest(&pv4, "(**"+v4t+")("+pv4Addr+"->"+v4Addr+")("+v4s+")\n")
addDumpTest(nv4, "(*"+v4t+")(<nil>)\n")
}
func addSliceDumpTests() {
// Slice containing standard float32 values.
v := []float32{3.14, 6.28, 12.56}
vLen := fmt.Sprintf("%d", len(v))
vCap := fmt.Sprintf("%d", cap(v))
nv := (*[]float32)(nil)
pv := &v
vAddr := fmt.Sprintf("%p", pv)
pvAddr := fmt.Sprintf("%p", &pv)
vt := "float32"
vs := "(len=" + vLen + " cap=" + vCap + ") {\n (" + vt + ") 3.14,\n (" +
vt + ") 6.28,\n (" + vt + ") 12.56\n}"
addDumpTest(v, "([]"+vt+") "+vs+"\n")
addDumpTest(pv, "(*[]"+vt+")("+vAddr+")("+vs+")\n")
addDumpTest(&pv, "(**[]"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
addDumpTest(nv, "(*[]"+vt+")(<nil>)\n")
// Slice containing type with custom formatter on pointer receiver only.
v2i0 := pstringer("1")
v2i1 := pstringer("2")
v2i2 := pstringer("3")
v2 := []pstringer{v2i0, v2i1, v2i2}
v2i0Len := fmt.Sprintf("%d", len(v2i0))
v2i1Len := fmt.Sprintf("%d", len(v2i1))
v2i2Len := fmt.Sprintf("%d", len(v2i2))
v2Len := fmt.Sprintf("%d", len(v2))
v2Cap := fmt.Sprintf("%d", cap(v2))
nv2 := (*[]pstringer)(nil)
pv2 := &v2
v2Addr := fmt.Sprintf("%p", pv2)
pv2Addr := fmt.Sprintf("%p", &pv2)
v2t := "spew_test.pstringer"
v2s := "(len=" + v2Len + " cap=" + v2Cap + ") {\n (" + v2t + ") (len=" +
v2i0Len + ") stringer 1,\n (" + v2t + ") (len=" + v2i1Len +
") stringer 2,\n (" + v2t + ") (len=" + v2i2Len + ") " +
"stringer 3\n}"
addDumpTest(v2, "([]"+v2t+") "+v2s+"\n")
addDumpTest(pv2, "(*[]"+v2t+")("+v2Addr+")("+v2s+")\n")
addDumpTest(&pv2, "(**[]"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
addDumpTest(nv2, "(*[]"+v2t+")(<nil>)\n")
// Slice containing interfaces.
v3i0 := "one"
v3 := []interface{}{v3i0, int(2), uint(3), nil}
v3i0Len := fmt.Sprintf("%d", len(v3i0))
v3Len := fmt.Sprintf("%d", len(v3))
v3Cap := fmt.Sprintf("%d", cap(v3))
nv3 := (*[]interface{})(nil)
pv3 := &v3
v3Addr := fmt.Sprintf("%p", pv3)
pv3Addr := fmt.Sprintf("%p", &pv3)
v3t := "[]interface {}"
v3t2 := "string"
v3t3 := "int"
v3t4 := "uint"
v3t5 := "interface {}"
v3s := "(len=" + v3Len + " cap=" + v3Cap + ") {\n (" + v3t2 + ") " +
"(len=" + v3i0Len + ") \"one\",\n (" + v3t3 + ") 2,\n (" +
v3t4 + ") 3,\n (" + v3t5 + ") <nil>\n}"
addDumpTest(v3, "("+v3t+") "+v3s+"\n")
addDumpTest(pv3, "(*"+v3t+")("+v3Addr+")("+v3s+")\n")
addDumpTest(&pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")("+v3s+")\n")
addDumpTest(nv3, "(*"+v3t+")(<nil>)\n")
// Slice containing bytes.
v4 := []byte{
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
0x31, 0x32,
}
v4Len := fmt.Sprintf("%d", len(v4))
v4Cap := fmt.Sprintf("%d", cap(v4))
nv4 := (*[]byte)(nil)
pv4 := &v4
v4Addr := fmt.Sprintf("%p", pv4)
pv4Addr := fmt.Sprintf("%p", &pv4)
v4t := "[]uint8"
v4s := "(len=" + v4Len + " cap=" + v4Cap + ") " +
"{\n 00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20" +
" |............... |\n" +
" 00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30" +
" |!\"#$%&'()*+,-./0|\n" +
" 00000020 31 32 " +
" |12|\n}"
addDumpTest(v4, "("+v4t+") "+v4s+"\n")
addDumpTest(pv4, "(*"+v4t+")("+v4Addr+")("+v4s+")\n")
addDumpTest(&pv4, "(**"+v4t+")("+pv4Addr+"->"+v4Addr+")("+v4s+")\n")
addDumpTest(nv4, "(*"+v4t+")(<nil>)\n")
// Nil slice.
v5 := []int(nil)
nv5 := (*[]int)(nil)
pv5 := &v5
v5Addr := fmt.Sprintf("%p", pv5)
pv5Addr := fmt.Sprintf("%p", &pv5)
v5t := "[]int"
v5s := "<nil>"
addDumpTest(v5, "("+v5t+") "+v5s+"\n")
addDumpTest(pv5, "(*"+v5t+")("+v5Addr+")("+v5s+")\n")
addDumpTest(&pv5, "(**"+v5t+")("+pv5Addr+"->"+v5Addr+")("+v5s+")\n")
addDumpTest(nv5, "(*"+v5t+")(<nil>)\n")
}
func addStringDumpTests() {
// Standard string.
v := "test"
vLen := fmt.Sprintf("%d", len(v))
nv := (*string)(nil)
pv := &v
vAddr := fmt.Sprintf("%p", pv)
pvAddr := fmt.Sprintf("%p", &pv)
vt := "string"
vs := "(len=" + vLen + ") \"test\""
addDumpTest(v, "("+vt+") "+vs+"\n")
addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
addDumpTest(nv, "(*"+vt+")(<nil>)\n")
}
func addInterfaceDumpTests() {
// Nil interface.
var v interface{}
nv := (*interface{})(nil)
pv := &v
vAddr := fmt.Sprintf("%p", pv)
pvAddr := fmt.Sprintf("%p", &pv)
vt := "interface {}"
vs := "<nil>"
addDumpTest(v, "("+vt+") "+vs+"\n")
addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
addDumpTest(nv, "(*"+vt+")(<nil>)\n")
// Sub-interface.
v2 := interface{}(uint16(65535))
pv2 := &v2
v2Addr := fmt.Sprintf("%p", pv2)
pv2Addr := fmt.Sprintf("%p", &pv2)
v2t := "uint16"
v2s := "65535"
addDumpTest(v2, "("+v2t+") "+v2s+"\n")
addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
}
func addMapDumpTests() {
// Map with string keys and int vals.
k := "one"
kk := "two"
m := map[string]int{k: 1, kk: 2}
klen := fmt.Sprintf("%d", len(k)) // not kLen to shut golint up
kkLen := fmt.Sprintf("%d", len(kk))
mLen := fmt.Sprintf("%d", len(m))
nilMap := map[string]int(nil)
nm := (*map[string]int)(nil)
pm := &m
mAddr := fmt.Sprintf("%p", pm)
pmAddr := fmt.Sprintf("%p", &pm)
mt := "map[string]int"
mt1 := "string"
mt2 := "int"
ms := "(len=" + mLen + ") {\n (" + mt1 + ") (len=" + klen + ") " +
"\"one\": (" + mt2 + ") 1,\n (" + mt1 + ") (len=" + kkLen +
") \"two\": (" + mt2 + ") 2\n}"
ms2 := "(len=" + mLen + ") {\n (" + mt1 + ") (len=" + kkLen + ") " +
"\"two\": (" + mt2 + ") 2,\n (" + mt1 + ") (len=" + klen +
") \"one\": (" + mt2 + ") 1\n}"
addDumpTest(m, "("+mt+") "+ms+"\n", "("+mt+") "+ms2+"\n")
addDumpTest(pm, "(*"+mt+")("+mAddr+")("+ms+")\n",
"(*"+mt+")("+mAddr+")("+ms2+")\n")
addDumpTest(&pm, "(**"+mt+")("+pmAddr+"->"+mAddr+")("+ms+")\n",
"(**"+mt+")("+pmAddr+"->"+mAddr+")("+ms2+")\n")
addDumpTest(nm, "(*"+mt+")(<nil>)\n")
addDumpTest(nilMap, "("+mt+") <nil>\n")
// Map with custom formatter type on pointer receiver only keys and vals.
k2 := pstringer("one")
v2 := pstringer("1")
m2 := map[pstringer]pstringer{k2: v2}
k2Len := fmt.Sprintf("%d", len(k2))
v2Len := fmt.Sprintf("%d", len(v2))
m2Len := fmt.Sprintf("%d", len(m2))
nilMap2 := map[pstringer]pstringer(nil)
nm2 := (*map[pstringer]pstringer)(nil)
pm2 := &m2
m2Addr := fmt.Sprintf("%p", pm2)
pm2Addr := fmt.Sprintf("%p", &pm2)
m2t := "map[spew_test.pstringer]spew_test.pstringer"
m2t1 := "spew_test.pstringer"
m2t2 := "spew_test.pstringer"
m2s := "(len=" + m2Len + ") {\n (" + m2t1 + ") (len=" + k2Len + ") " +
"stringer one: (" + m2t2 + ") (len=" + v2Len + ") stringer 1\n}"
if spew.UnsafeDisabled {
m2s = "(len=" + m2Len + ") {\n (" + m2t1 + ") (len=" + k2Len +
") " + "\"one\": (" + m2t2 + ") (len=" + v2Len +
") \"1\"\n}"
}
addDumpTest(m2, "("+m2t+") "+m2s+"\n")
addDumpTest(pm2, "(*"+m2t+")("+m2Addr+")("+m2s+")\n")
addDumpTest(&pm2, "(**"+m2t+")("+pm2Addr+"->"+m2Addr+")("+m2s+")\n")
addDumpTest(nm2, "(*"+m2t+")(<nil>)\n")
addDumpTest(nilMap2, "("+m2t+") <nil>\n")
// Map with interface keys and values.
k3 := "one"
k3Len := fmt.Sprintf("%d", len(k3))
m3 := map[interface{}]interface{}{k3: 1}
m3Len := fmt.Sprintf("%d", len(m3))
nilMap3 := map[interface{}]interface{}(nil)
nm3 := (*map[interface{}]interface{})(nil)
pm3 := &m3
m3Addr := fmt.Sprintf("%p", pm3)
pm3Addr := fmt.Sprintf("%p", &pm3)
m3t := "map[interface {}]interface {}"
m3t1 := "string"
m3t2 := "int"
m3s := "(len=" + m3Len + ") {\n (" + m3t1 + ") (len=" + k3Len + ") " +
"\"one\": (" + m3t2 + ") 1\n}"
addDumpTest(m3, "("+m3t+") "+m3s+"\n")
addDumpTest(pm3, "(*"+m3t+")("+m3Addr+")("+m3s+")\n")
addDumpTest(&pm3, "(**"+m3t+")("+pm3Addr+"->"+m3Addr+")("+m3s+")\n")
addDumpTest(nm3, "(*"+m3t+")(<nil>)\n")
addDumpTest(nilMap3, "("+m3t+") <nil>\n")
// Map with nil interface value.
k4 := "nil"
k4Len := fmt.Sprintf("%d", len(k4))
m4 := map[string]interface{}{k4: nil}
m4Len := fmt.Sprintf("%d", len(m4))
nilMap4 := map[string]interface{}(nil)
nm4 := (*map[string]interface{})(nil)
pm4 := &m4
m4Addr := fmt.Sprintf("%p", pm4)
pm4Addr := fmt.Sprintf("%p", &pm4)
m4t := "map[string]interface {}"
m4t1 := "string"
m4t2 := "interface {}"
m4s := "(len=" + m4Len + ") {\n (" + m4t1 + ") (len=" + k4Len + ")" +
" \"nil\": (" + m4t2 + ") <nil>\n}"
addDumpTest(m4, "("+m4t+") "+m4s+"\n")
addDumpTest(pm4, "(*"+m4t+")("+m4Addr+")("+m4s+")\n")
addDumpTest(&pm4, "(**"+m4t+")("+pm4Addr+"->"+m4Addr+")("+m4s+")\n")
addDumpTest(nm4, "(*"+m4t+")(<nil>)\n")
addDumpTest(nilMap4, "("+m4t+") <nil>\n")
}
func addStructDumpTests() {
// Struct with primitives.
type s1 struct {
a int8
b uint8
}
v := s1{127, 255}
nv := (*s1)(nil)
pv := &v
vAddr := fmt.Sprintf("%p", pv)
pvAddr := fmt.Sprintf("%p", &pv)
vt := "spew_test.s1"
vt2 := "int8"
vt3 := "uint8"
vs := "{\n a: (" + vt2 + ") 127,\n b: (" + vt3 + ") 255\n}"
addDumpTest(v, "("+vt+") "+vs+"\n")
addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
addDumpTest(nv, "(*"+vt+")(<nil>)\n")
// Struct that contains another struct.
type s2 struct {
s1 s1
b bool
}
v2 := s2{s1{127, 255}, true}
nv2 := (*s2)(nil)
pv2 := &v2
v2Addr := fmt.Sprintf("%p", pv2)
pv2Addr := fmt.Sprintf("%p", &pv2)
v2t := "spew_test.s2"
v2t2 := "spew_test.s1"
v2t3 := "int8"
v2t4 := "uint8"
v2t5 := "bool"
v2s := "{\n s1: (" + v2t2 + ") {\n a: (" + v2t3 + ") 127,\n b: (" +
v2t4 + ") 255\n },\n b: (" + v2t5 + ") true\n}"
addDumpTest(v2, "("+v2t+") "+v2s+"\n")
addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
addDumpTest(nv2, "(*"+v2t+")(<nil>)\n")
// Struct that contains custom type with Stringer pointer interface via both
// exported and unexported fields.
type s3 struct {
s pstringer
S pstringer
}
v3 := s3{"test", "test2"}
nv3 := (*s3)(nil)
pv3 := &v3
v3Addr := fmt.Sprintf("%p", pv3)
pv3Addr := fmt.Sprintf("%p", &pv3)
v3t := "spew_test.s3"
v3t2 := "spew_test.pstringer"
v3s := "{\n s: (" + v3t2 + ") (len=4) stringer test,\n S: (" + v3t2 +
") (len=5) stringer test2\n}"
v3sp := v3s
if spew.UnsafeDisabled {
v3s = "{\n s: (" + v3t2 + ") (len=4) \"test\",\n S: (" +
v3t2 + ") (len=5) \"test2\"\n}"
v3sp = "{\n s: (" + v3t2 + ") (len=4) \"test\",\n S: (" +
v3t2 + ") (len=5) stringer test2\n}"
}
addDumpTest(v3, "("+v3t+") "+v3s+"\n")
addDumpTest(pv3, "(*"+v3t+")("+v3Addr+")("+v3sp+")\n")
addDumpTest(&pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")("+v3sp+")\n")
addDumpTest(nv3, "(*"+v3t+")(<nil>)\n")
// Struct that contains embedded struct and field to same struct.
e := embed{"embedstr"}
eLen := fmt.Sprintf("%d", len("embedstr"))
v4 := embedwrap{embed: &e, e: &e}
nv4 := (*embedwrap)(nil)
pv4 := &v4
eAddr := fmt.Sprintf("%p", &e)
v4Addr := fmt.Sprintf("%p", pv4)
pv4Addr := fmt.Sprintf("%p", &pv4)
v4t := "spew_test.embedwrap"
v4t2 := "spew_test.embed"
v4t3 := "string"
v4s := "{\n embed: (*" + v4t2 + ")(" + eAddr + ")({\n a: (" + v4t3 +
") (len=" + eLen + ") \"embedstr\"\n }),\n e: (*" + v4t2 +
")(" + eAddr + ")({\n a: (" + v4t3 + ") (len=" + eLen + ")" +
" \"embedstr\"\n })\n}"
addDumpTest(v4, "("+v4t+") "+v4s+"\n")
addDumpTest(pv4, "(*"+v4t+")("+v4Addr+")("+v4s+")\n")
addDumpTest(&pv4, "(**"+v4t+")("+pv4Addr+"->"+v4Addr+")("+v4s+")\n")
addDumpTest(nv4, "(*"+v4t+")(<nil>)\n")
}
func addUintptrDumpTests() {
// Null pointer.
v := uintptr(0)
pv := &v
vAddr := fmt.Sprintf("%p", pv)
pvAddr := fmt.Sprintf("%p", &pv)
vt := "uintptr"
vs := "<nil>"
addDumpTest(v, "("+vt+") "+vs+"\n")
addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
// Address of real variable.
i := 1
v2 := uintptr(unsafe.Pointer(&i))
nv2 := (*uintptr)(nil)
pv2 := &v2
v2Addr := fmt.Sprintf("%p", pv2)
pv2Addr := fmt.Sprintf("%p", &pv2)
v2t := "uintptr"
v2s := fmt.Sprintf("%p", &i)
addDumpTest(v2, "("+v2t+") "+v2s+"\n")
addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
addDumpTest(nv2, "(*"+v2t+")(<nil>)\n")
}
func addUnsafePointerDumpTests() {
// Null pointer.
v := unsafe.Pointer(uintptr(0))
nv := (*unsafe.Pointer)(nil)
pv := &v
vAddr := fmt.Sprintf("%p", pv)
pvAddr := fmt.Sprintf("%p", &pv)
vt := "unsafe.Pointer"
vs := "<nil>"
addDumpTest(v, "("+vt+") "+vs+"\n")
addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
addDumpTest(nv, "(*"+vt+")(<nil>)\n")
// Address of real variable.
i := 1
v2 := unsafe.Pointer(&i)
pv2 := &v2
v2Addr := fmt.Sprintf("%p", pv2)
pv2Addr := fmt.Sprintf("%p", &pv2)
v2t := "unsafe.Pointer"
v2s := fmt.Sprintf("%p", &i)
addDumpTest(v2, "("+v2t+") "+v2s+"\n")
addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
addDumpTest(nv, "(*"+vt+")(<nil>)\n")
}
func addChanDumpTests() {
// Nil channel.
var v chan int
pv := &v
nv := (*chan int)(nil)
vAddr := fmt.Sprintf("%p", pv)
pvAddr := fmt.Sprintf("%p", &pv)
vt := "chan int"
vs := "<nil>"
addDumpTest(v, "("+vt+") "+vs+"\n")
addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
addDumpTest(nv, "(*"+vt+")(<nil>)\n")
// Real channel.
v2 := make(chan int)
pv2 := &v2
v2Addr := fmt.Sprintf("%p", pv2)
pv2Addr := fmt.Sprintf("%p", &pv2)
v2t := "chan int"
v2s := fmt.Sprintf("%p", v2)
addDumpTest(v2, "("+v2t+") "+v2s+"\n")
addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
}
func addFuncDumpTests() {
// Function with no params and no returns.
v := addIntDumpTests
nv := (*func())(nil)
pv := &v
vAddr := fmt.Sprintf("%p", pv)
pvAddr := fmt.Sprintf("%p", &pv)
vt := "func()"
vs := fmt.Sprintf("%p", v)
addDumpTest(v, "("+vt+") "+vs+"\n")
addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
addDumpTest(nv, "(*"+vt+")(<nil>)\n")
// Function with param and no returns.
v2 := TestDump
nv2 := (*func(*testing.T))(nil)
pv2 := &v2
v2Addr := fmt.Sprintf("%p", pv2)
pv2Addr := fmt.Sprintf("%p", &pv2)
v2t := "func(*testing.T)"
v2s := fmt.Sprintf("%p", v2)
addDumpTest(v2, "("+v2t+") "+v2s+"\n")
addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
addDumpTest(nv2, "(*"+v2t+")(<nil>)\n")
// Function with multiple params and multiple returns.
var v3 = func(i int, s string) (b bool, err error) {
return true, nil
}
nv3 := (*func(int, string) (bool, error))(nil)
pv3 := &v3
v3Addr := fmt.Sprintf("%p", pv3)
pv3Addr := fmt.Sprintf("%p", &pv3)
v3t := "func(int, string) (bool, error)"
v3s := fmt.Sprintf("%p", v3)
addDumpTest(v3, "("+v3t+") "+v3s+"\n")
addDumpTest(pv3, "(*"+v3t+")("+v3Addr+")("+v3s+")\n")
addDumpTest(&pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")("+v3s+")\n")
addDumpTest(nv3, "(*"+v3t+")(<nil>)\n")
}
func addCircularDumpTests() {
// Struct that is circular through self referencing.
type circular struct {
c *circular
}
v := circular{nil}
v.c = &v
pv := &v
vAddr := fmt.Sprintf("%p", pv)
pvAddr := fmt.Sprintf("%p", &pv)
vt := "spew_test.circular"
vs := "{\n c: (*" + vt + ")(" + vAddr + ")({\n c: (*" + vt + ")(" +
vAddr + ")(<already shown>)\n })\n}"
vs2 := "{\n c: (*" + vt + ")(" + vAddr + ")(<already shown>)\n}"
addDumpTest(v, "("+vt+") "+vs+"\n")
addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs2+")\n")
addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs2+")\n")
// Structs that are circular through cross referencing.
v2 := xref1{nil}
ts2 := xref2{&v2}
v2.ps2 = &ts2
pv2 := &v2
ts2Addr := fmt.Sprintf("%p", &ts2)
v2Addr := fmt.Sprintf("%p", pv2)
pv2Addr := fmt.Sprintf("%p", &pv2)
v2t := "spew_test.xref1"
v2t2 := "spew_test.xref2"
v2s := "{\n ps2: (*" + v2t2 + ")(" + ts2Addr + ")({\n ps1: (*" + v2t +
")(" + v2Addr + ")({\n ps2: (*" + v2t2 + ")(" + ts2Addr +
")(<already shown>)\n })\n })\n}"
v2s2 := "{\n ps2: (*" + v2t2 + ")(" + ts2Addr + ")({\n ps1: (*" + v2t +
")(" + v2Addr + ")(<already shown>)\n })\n}"
addDumpTest(v2, "("+v2t+") "+v2s+"\n")
addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s2+")\n")
addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s2+")\n")
// Structs that are indirectly circular.
v3 := indirCir1{nil}
tic2 := indirCir2{nil}
tic3 := indirCir3{&v3}
tic2.ps3 = &tic3
v3.ps2 = &tic2
pv3 := &v3
tic2Addr := fmt.Sprintf("%p", &tic2)
tic3Addr := fmt.Sprintf("%p", &tic3)
v3Addr := fmt.Sprintf("%p", pv3)
pv3Addr := fmt.Sprintf("%p", &pv3)
v3t := "spew_test.indirCir1"
v3t2 := "spew_test.indirCir2"
v3t3 := "spew_test.indirCir3"
v3s := "{\n ps2: (*" + v3t2 + ")(" + tic2Addr + ")({\n ps3: (*" + v3t3 +
")(" + tic3Addr + ")({\n ps1: (*" + v3t + ")(" + v3Addr +
")({\n ps2: (*" + v3t2 + ")(" + tic2Addr +
")(<already shown>)\n })\n })\n })\n}"
v3s2 := "{\n ps2: (*" + v3t2 + ")(" + tic2Addr + ")({\n ps3: (*" + v3t3 +
")(" + tic3Addr + ")({\n ps1: (*" + v3t + ")(" + v3Addr +
")(<already shown>)\n })\n })\n}"
addDumpTest(v3, "("+v3t+") "+v3s+"\n")
addDumpTest(pv3, "(*"+v3t+")("+v3Addr+")("+v3s2+")\n")
addDumpTest(&pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")("+v3s2+")\n")
}
func addPanicDumpTests() {
// Type that panics in its Stringer interface.
v := panicer(127)
nv := (*panicer)(nil)
pv := &v
vAddr := fmt.Sprintf("%p", pv)
pvAddr := fmt.Sprintf("%p", &pv)
vt := "spew_test.panicer"
vs := "(PANIC=test panic)127"
addDumpTest(v, "("+vt+") "+vs+"\n")
addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
addDumpTest(nv, "(*"+vt+")(<nil>)\n")
}
func addErrorDumpTests() {
// Type that has a custom Error interface.
v := customError(127)
nv := (*customError)(nil)
pv := &v
vAddr := fmt.Sprintf("%p", pv)
pvAddr := fmt.Sprintf("%p", &pv)
vt := "spew_test.customError"
vs := "error: 127"
addDumpTest(v, "("+vt+") "+vs+"\n")
addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
addDumpTest(nv, "(*"+vt+")(<nil>)\n")
}
// TestDump executes all of the tests described by dumpTests.
func TestDump(t *testing.T) {
// Setup tests.
addIntDumpTests()
addUintDumpTests()
addBoolDumpTests()
addFloatDumpTests()
addComplexDumpTests()
addArrayDumpTests()
addSliceDumpTests()
addStringDumpTests()
addInterfaceDumpTests()
addMapDumpTests()
addStructDumpTests()
addUintptrDumpTests()
addUnsafePointerDumpTests()
addChanDumpTests()
addFuncDumpTests()
addCircularDumpTests()
addPanicDumpTests()
addErrorDumpTests()
addCgoDumpTests()
t.Logf("Running %d tests", len(dumpTests))
for i, test := range dumpTests {
buf := new(bytes.Buffer)
spew.Fdump(buf, test.in)
s := buf.String()
if testFailed(s, test.wants) {
t.Errorf("Dump #%d\n got: %s %s", i, s, stringizeWants(test.wants))
continue
}
}
}
func TestDumpSortedKeys(t *testing.T) {
cfg := spew.ConfigState{SortKeys: true}
s := cfg.Sdump(map[int]string{1: "1", 3: "3", 2: "2"})
expected := "(map[int]string) (len=3) {\n(int) 1: (string) (len=1) " +
"\"1\",\n(int) 2: (string) (len=1) \"2\",\n(int) 3: (string) " +
"(len=1) \"3\"\n" +
"}\n"
if s != expected {
t.Errorf("Sorted keys mismatch:\n %v %v", s, expected)
}
s = cfg.Sdump(map[stringer]int{"1": 1, "3": 3, "2": 2})
expected = "(map[spew_test.stringer]int) (len=3) {\n" +
"(spew_test.stringer) (len=1) stringer 1: (int) 1,\n" +
"(spew_test.stringer) (len=1) stringer 2: (int) 2,\n" +
"(spew_test.stringer) (len=1) stringer 3: (int) 3\n" +
"}\n"
if s != expected {
t.Errorf("Sorted keys mismatch:\n %v %v", s, expected)
}
s = cfg.Sdump(map[pstringer]int{pstringer("1"): 1, pstringer("3"): 3, pstringer("2"): 2})
expected = "(map[spew_test.pstringer]int) (len=3) {\n" +
"(spew_test.pstringer) (len=1) stringer 1: (int) 1,\n" +
"(spew_test.pstringer) (len=1) stringer 2: (int) 2,\n" +
"(spew_test.pstringer) (len=1) stringer 3: (int) 3\n" +
"}\n"
if spew.UnsafeDisabled {
expected = "(map[spew_test.pstringer]int) (len=3) {\n" +
"(spew_test.pstringer) (len=1) \"1\": (int) 1,\n" +
"(spew_test.pstringer) (len=1) \"2\": (int) 2,\n" +
"(spew_test.pstringer) (len=1) \"3\": (int) 3\n" +
"}\n"
}
if s != expected {
t.Errorf("Sorted keys mismatch:\n %v %v", s, expected)
}
s = cfg.Sdump(map[customError]int{customError(1): 1, customError(3): 3, customError(2): 2})
expected = "(map[spew_test.customError]int) (len=3) {\n" +
"(spew_test.customError) error: 1: (int) 1,\n" +
"(spew_test.customError) error: 2: (int) 2,\n" +
"(spew_test.customError) error: 3: (int) 3\n" +
"}\n"
if s != expected {
t.Errorf("Sorted keys mismatch:\n %v %v", s, expected)
}
}
================================================
FILE: vendor/github.com/davecgh/go-spew/spew/dumpcgo_test.go
================================================
// Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
// NOTE: Due to the following build constraints, this file will only be compiled
// when both cgo is supported and "-tags testcgo" is added to the go test
// command line. This means the cgo tests are only added (and hence run) when
// specifially requested. This configuration is used because spew itself
// does not require cgo to run even though it does handle certain cgo types
// specially. Rather than forcing all clients to require cgo and an external
// C compiler just to run the tests, this scheme makes them optional.
// +build cgo,testcgo
package spew_test
import (
"fmt"
"github.com/davecgh/go-spew/spew/testdata"
)
func addCgoDumpTests() {
// C char pointer.
v := testdata.GetCgoCharPointer()
nv := testdata.GetCgoNullCharPointer()
pv := &v
vcAddr := fmt.Sprintf("%p", v)
vAddr := fmt.Sprintf("%p", pv)
pvAddr := fmt.Sprintf("%p", &pv)
vt := "*testdata._Ctype_char"
vs := "116"
addDumpTest(v, "("+vt+")("+vcAddr+")("+vs+")\n")
addDumpTest(pv, "(*"+vt+")("+vAddr+"->"+vcAddr+")("+vs+")\n")
addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+"->"+vcAddr+")("+vs+")\n")
addDumpTest(nv, "("+vt+")(<nil>)\n")
// C char array.
v2, v2l, v2c := testdata.GetCgoCharArray()
v2Len := fmt.Sprintf("%d", v2l)
v2Cap := fmt.Sprintf("%d", v2c)
v2t := "[6]testdata._Ctype_char"
v2s := "(len=" + v2Len + " cap=" + v2Cap + ") " +
"{\n 00000000 74 65 73 74 32 00 " +
" |test2.|\n}"
addDumpTest(v2, "("+v2t+") "+v2s+"\n")
// C unsigned char array.
v3, v3l, v3c := testdata.GetCgoUnsignedCharArray()
v3Len := fmt.Sprintf("%d", v3l)
v3Cap := fmt.Sprintf("%d", v3c)
v3t := "[6]testdata._Ctype_unsignedchar"
v3t2 := "[6]testdata._Ctype_uchar"
v3s := "(len=" + v3Len + " cap=" + v3Cap + ") " +
"{\n 00000000 74 65 73 74 33 00 " +
" |test3.|\n}"
addDumpTest(v3, "("+v3t+") "+v3s+"\n", "("+v3t2+") "+v3s+"\n")
// C signed char array.
v4, v4l, v4c := testdata.GetCgoSignedCharArray()
v4Len := fmt.Sprintf("%d", v4l)
v4Cap := fmt.Sprintf("%d", v4c)
v4t := "[6]testdata._Ctype_schar"
v4t2 := "testdata._Ctype_schar"
v4s := "(len=" + v4Len + " cap=" + v4Cap + ") " +
"{\n (" + v4t2 + ") 116,\n (" + v4t2 + ") 101,\n (" + v4t2 +
") 115,\n (" + v4t2 + ") 116,\n (" + v4t2 + ") 52,\n (" + v4t2 +
") 0\n}"
addDumpTest(v4, "("+v4t+") "+v4s+"\n")
// C uint8_t array.
v5, v5l, v5c := testdata.GetCgoUint8tArray()
v5Len := fmt.Sprintf("%d", v5l)
v5Cap := fmt.Sprintf("%d", v5c)
v5t := "[6]testdata._Ctype_uint8_t"
v5s := "(len=" + v5Len + " cap=" + v5Cap + ") " +
"{\n 00000000 74 65 73 74 35 00 " +
" |test5.|\n}"
addDumpTest(v5, "("+v5t+") "+v5s+"\n")
// C typedefed unsigned char array.
v6, v6l, v6c := testdata.GetCgoTypdefedUnsignedCharArray()
v6Len := fmt.Sprintf("%d", v6l)
v6Cap := fmt.Sprintf("%d", v6c)
v6t := "[6]testdata._Ctype_custom_uchar_t"
v6s := "(len=" + v6Len + " cap=" + v6Cap + ") " +
"{\n 00000000 74 65 73 74 36 00 " +
" |test6.|\n}"
addDumpTest(v6, "("+v6t+") "+v6s+"\n")
}
================================================
FILE: vendor/github.com/davecgh/go-spew/spew/dumpnocgo_test.go
================================================
// Copyright (c) 2013 Dave Collins <dave@davec.name>
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
// NOTE: Due to the following build constraints, this file will only be compiled
// when either cgo is not supported or "-tags testcgo" is not added to the go
// test command line. This file intentionally does not setup any cgo tests in
// this scenario.
// +build !cgo !testcgo
package spew_test
func addCgoDumpTests() {
// Don't add any tests for cgo since this file is only compiled when
// there should not be any cgo tests.
}
================================================
FILE: vendor/github.com/davecgh/go-spew/spew/example_test.go
================================================
/*
* Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
package spew_test
import (
"fmt"
"github.com/davecgh/go-spew/spew"
)
type Flag int
const (
flagOne Flag = iota
flagTwo
)
var flagStrings = map[Flag]string{
flagOne: "flagOne",
flagTwo: "flagTwo",
}
func (f Flag) String() string {
if s, ok := flagStrings[f]; ok {
return s
}
return fmt.Sprintf("Unknown flag (%d)", int(f))
}
type Bar struct {
data uintptr
}
type Foo struct {
unexportedField Bar
ExportedField map[interface{}]interface{}
}
// This example demonstrates how to use Dump to dump variables to stdout.
func ExampleDump() {
// The following package level declarations are assumed for this example:
/*
type Flag int
const (
flagOne Flag = iota
flagTwo
)
var flagStrings = map[Flag]string{
flagOne: "flagOne",
flagTwo: "flagTwo",
}
func (f Flag) String() string {
if s, ok := flagStrings[f]; ok {
return s
}
return fmt.Sprintf("Unknown flag (%d)", int(f))
}
type Bar struct {
data uintptr
}
type Foo struct {
unexportedField Bar
ExportedField map[interface{}]interface{}
}
*/
// Setup some sample data structures for the example.
bar := Bar{uintptr(0)}
s1 := Foo{bar, map[interface{}]interface{}{"one": true}}
f := Flag(5)
b := []byte{
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
0x31, 0x32,
}
// Dump!
spew.Dump(s1, f, b)
// Output:
// (spew_test.Foo) {
// unexportedField: (spew_test.Bar) {
// data: (uintptr) <nil>
// },
// ExportedField: (map[interface {}]interface {}) (len=1) {
// (string) (len=3) "one": (bool) true
// }
// }
// (spew_test.Flag) Unknown flag (5)
// ([]uint8) (len=34 cap=34) {
// 00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 |............... |
// 00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 |!"#$%&'()*+,-./0|
// 00000020 31 32 |12|
// }
//
}
// This example demonstrates how to use Printf to display a variable with a
// format string and inline formatting.
func ExamplePrintf() {
// Create a double pointer to a uint 8.
ui8 := uint8(5)
pui8 := &ui8
ppui8 := &pui8
// Create a circular data type.
type circular struct {
ui8 uint8
c *circular
}
c := circular{ui8: 1}
c.c = &c
// Print!
spew.Printf("ppui8: %v\n", ppui8)
spew.Printf("circular: %v\n", c)
// Output:
// ppui8: <**>5
// circular: {1 <*>{1 <*><shown>}}
}
// This example demonstrates how to use a ConfigState.
func ExampleConfigState() {
// Modify the indent level of the ConfigState only. The global
// configuration is not modified.
scs := spew.ConfigState{Indent: "\t"}
// Output using the ConfigState instance.
v := map[string]int{"one": 1}
scs.Printf("v: %v\n", v)
scs.Dump(v)
// Output:
// v: map[one:1]
// (map[string]int) (len=1) {
// (string) (len=3) "one": (int) 1
// }
}
// This example demonstrates how to use ConfigState.Dump to dump variables to
// stdout
func ExampleConfigState_Dump() {
// See the top-level Dump example for details on the types used in this
// example.
// Create two ConfigState instances with different indentation.
scs := spew.ConfigState{Indent: "\t"}
scs2 := spew.ConfigState{Indent: " "}
// Setup some sample data structures for the example.
bar := Bar{uintptr(0)}
s1 := Foo{bar, map[interface{}]interface{}{"one": true}}
// Dump using the ConfigState instances.
scs.Dump(s1)
scs2.Dump(s1)
// Output:
// (spew_test.Foo) {
// unexportedField: (spew_test.Bar) {
// data: (uintptr) <nil>
// },
// ExportedField: (map[interface {}]interface {}) (len=1) {
// (string) (len=3) "one": (bool) true
// }
// }
// (spew_test.Foo) {
// unexportedField: (spew_test.Bar) {
// data: (uintptr) <nil>
// },
// ExportedField: (map[interface {}]interface {}) (len=1) {
// (string) (len=3) "one": (bool) true
// }
// }
//
}
// This example demonstrates how to use ConfigState.Printf to display a variable
// with a format string and inline formatting.
func ExampleConfigState_Printf() {
// See the top-level Dump example for details on the types used in this
// example.
// Create two ConfigState instances and modify the method handling of the
// first ConfigState only.
scs := spew.NewDefaultConfig()
scs2 := spew.NewDefaultConfig()
scs.DisableMethods = true
// Alternatively
// scs := spew.ConfigState{Indent: " ", DisableMethods: true}
// scs2 := spew.ConfigState{Indent: " "}
// This is of type Flag which implements a Stringer and has raw value 1.
f := flagTwo
// Dump using the ConfigState instances.
scs.Printf("f: %v\n", f)
scs2.Printf("f: %v\n", f)
// Output:
// f: 1
// f: flagTwo
}
================================================
FILE: vendor/github.com/davecgh/go-spew/spew/format.go
================================================
/*
* Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
package spew
import (
"bytes"
"fmt"
"reflect"
"strconv"
"strings"
)
// supportedFlags is a list of all the character flags supported by fmt package.
const supportedFlags = "0-+# "
// formatState implements the fmt.Formatter interface and contains information
// about the state of a formatting operation. The NewFormatter function can
// be used to get a new Formatter which can be used directly as arguments
// in standard fmt package printing calls.
type formatState struct {
value interface{}
fs fmt.State
depth int
pointers map[uintptr]int
ignoreNextType bool
cs *ConfigState
}
// buildDefaultFormat recreates the original format string without precision
// and width information to pass in to fmt.Sprintf in the case of an
// unrecognized type. Unless new types are added to the language, this
// function won't ever be called.
func (f *formatState) buildDefaultFormat() (format string) {
buf := bytes.NewBuffer(percentBytes)
for _, flag := range supportedFlags {
if f.fs.Flag(int(flag)) {
buf.WriteRune(flag)
}
}
buf.WriteRune('v')
format = buf.String()
return format
}
// constructOrigFormat recreates the original format string including precision
// and width information to pass along to the standard fmt package. This allows
// automatic deferral of all format strings this package doesn't support.
func (f *formatState) constructOrigFormat(verb rune) (format string) {
buf := bytes.NewBuffer(percentBytes)
for _, flag := range supportedFlags {
if f.fs.Flag(int(flag)) {
buf.WriteRune(flag)
}
}
if width, ok := f.fs.Width(); ok {
buf.WriteString(strconv.Itoa(width))
}
if precision, ok := f.fs.Precision(); ok {
buf.Write(precisionBytes)
buf.WriteString(strconv.Itoa(precision))
}
buf.WriteRune(verb)
format = buf.String()
return format
}
// unpackValue returns values inside of non-nil interfaces when possible and
// ensures that types for values which have been unpacked from an interface
// are displayed when the show types flag is also set.
// This is useful for data types like structs, arrays, slices, and maps which
// can contain varying types packed inside an interface.
func (f *formatState) unpackValue(v reflect.Value) reflect.Value {
if v.Kind() == reflect.Interface {
f.ignoreNextType = false
if
gitextract_y5n2h024/ ├── .gitignore ├── .gitmodules ├── .travis.yml ├── Gopkg.toml ├── LICENSE ├── README.md ├── cmd/ │ └── morgoth/ │ └── main.go ├── counter/ │ ├── counter.go │ ├── lossy_counter.go │ └── lossy_counter_test.go ├── detector.go ├── fingerprint.go ├── fingerprinters/ │ ├── jsdiv/ │ │ ├── jsdiv.go │ │ └── jsdiv_test.go │ ├── kstest/ │ │ ├── kstest.go │ │ └── kstest_test.go │ └── sigma/ │ └── sigma.go ├── vendor/ │ └── github.com/ │ ├── beorn7/ │ │ └── perks/ │ │ ├── .gitignore │ │ ├── LICENSE │ │ ├── README.md │ │ └── quantile/ │ │ ├── bench_test.go │ │ ├── example_test.go │ │ ├── exampledata.txt │ │ ├── stream.go │ │ └── stream_test.go │ ├── davecgh/ │ │ └── go-spew/ │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── cov_report.sh │ │ ├── spew/ │ │ │ ├── bypass.go │ │ │ ├── bypasssafe.go │ │ │ ├── common.go │ │ │ ├── common_test.go │ │ │ ├── config.go │ │ │ ├── doc.go │ │ │ ├── dump.go │ │ │ ├── dump_test.go │ │ │ ├── dumpcgo_test.go │ │ │ ├── dumpnocgo_test.go │ │ │ ├── example_test.go │ │ │ ├── format.go │ │ │ ├── format_test.go │ │ │ ├── internal_test.go │ │ │ ├── internalunsafe_test.go │ │ │ ├── spew.go │ │ │ └── spew_test.go │ │ └── test_coverage.txt │ ├── golang/ │ │ └── protobuf/ │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── Make.protobuf │ │ ├── Makefile │ │ ├── README.md │ │ └── proto/ │ │ ├── Makefile │ │ ├── all_test.go │ │ ├── any_test.go │ │ ├── clone.go │ │ ├── clone_test.go │ │ ├── decode.go │ │ ├── decode_test.go │ │ ├── encode.go │ │ ├── encode_test.go │ │ ├── equal.go │ │ ├── equal_test.go │ │ ├── extensions.go │ │ ├── extensions_test.go │ │ ├── lib.go │ │ ├── map_test.go │ │ ├── message_set.go │ │ ├── message_set_test.go │ │ ├── pointer_reflect.go │ │ ├── pointer_unsafe.go │ │ ├── properties.go │ │ ├── proto3_test.go │ │ ├── size2_test.go │ │ ├── size_test.go │ │ ├── text.go │ │ ├── text_parser.go │ │ ├── text_parser_test.go │ │ └── text_test.go │ ├── influxdata/ │ │ ├── kapacitor/ │ │ │ ├── .dockerignore │ │ │ ├── .gitattributes │ │ │ ├── .gitignore │ │ │ ├── BLOB_STORE_DESIGN.md │ │ │ ├── CHANGELOG.md │ │ │ ├── CONTRIBUTING.md │ │ │ ├── DESIGN.md │ │ │ ├── Dockerfile_build_ubuntu32 │ │ │ ├── Dockerfile_build_ubuntu64 │ │ │ ├── Gopkg.toml │ │ │ ├── LICENSE │ │ │ ├── LICENSE_OF_DEPENDENCIES.md │ │ │ ├── README.md │ │ │ ├── alert.go │ │ │ ├── autoscale.go │ │ │ ├── batch.go │ │ │ ├── build.py │ │ │ ├── build.sh │ │ │ ├── circle-test.sh │ │ │ ├── circle.yml │ │ │ ├── combine.go │ │ │ ├── combine_test.go │ │ │ ├── default.go │ │ │ ├── delete.go │ │ │ ├── derivative.go │ │ │ ├── doc.go │ │ │ ├── edge.go │ │ │ ├── eval.go │ │ │ ├── expr.go │ │ │ ├── flatten.go │ │ │ ├── gobuild.sh │ │ │ ├── group_by.go │ │ │ ├── http_out.go │ │ │ ├── http_post.go │ │ │ ├── influxdb_out.go │ │ │ ├── influxql.gen.go │ │ │ ├── influxql.gen.go.tmpl │ │ │ ├── influxql.go │ │ │ ├── join.go │ │ │ ├── kapacitor_loopback.go │ │ │ ├── list-deps │ │ │ ├── log.go │ │ │ ├── metaclient.go │ │ │ ├── node.go │ │ │ ├── noop.go │ │ │ ├── output.go │ │ │ ├── query.go │ │ │ ├── query_test.go │ │ │ ├── replay.go │ │ │ ├── result.go │ │ │ ├── sample.go │ │ │ ├── shift.go │ │ │ ├── state_tracking.go │ │ │ ├── stats.go │ │ │ ├── stream.go │ │ │ ├── task.go │ │ │ ├── task_master.go │ │ │ ├── template.go │ │ │ ├── test.sh │ │ │ ├── tmpldata.json │ │ │ ├── udf/ │ │ │ │ ├── agent/ │ │ │ │ │ ├── README.md │ │ │ │ │ ├── agent.go │ │ │ │ │ ├── io.go │ │ │ │ │ ├── io_test.go │ │ │ │ │ ├── server.go │ │ │ │ │ ├── udf.pb.go │ │ │ │ │ └── udf.proto │ │ │ │ ├── server.go │ │ │ │ ├── server_test.go │ │ │ │ └── udf.go │ │ │ ├── udf.go │ │ │ ├── udf_test.go │ │ │ ├── union.go │ │ │ ├── update_tick_docs.sh │ │ │ ├── where.go │ │ │ ├── window.go │ │ │ └── window_test.go │ │ └── wlog/ │ │ ├── LICENSE │ │ ├── README.md │ │ └── writer.go │ ├── matttproud/ │ │ └── golang_protobuf_extensions/ │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── NOTICE │ │ ├── README.md │ │ └── pbutil/ │ │ ├── all_test.go │ │ ├── decode.go │ │ ├── decode_test.go │ │ ├── doc.go │ │ ├── encode.go │ │ ├── encode_test.go │ │ └── fixtures_test.go │ ├── pkg/ │ │ └── errors/ │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── appveyor.yml │ │ ├── bench_test.go │ │ ├── errors.go │ │ ├── errors_test.go │ │ ├── example_test.go │ │ ├── format_test.go │ │ ├── stack.go │ │ └── stack_test.go │ ├── pmezard/ │ │ └── go-difflib/ │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ └── difflib/ │ │ ├── difflib.go │ │ └── difflib_test.go │ ├── prometheus/ │ │ ├── client_golang/ │ │ │ ├── .gitignore │ │ │ ├── .travis.yml │ │ │ ├── CHANGELOG.md │ │ │ ├── CONTRIBUTING.md │ │ │ ├── LICENSE │ │ │ ├── MAINTAINERS.md │ │ │ ├── NOTICE │ │ │ ├── README.md │ │ │ ├── VERSION │ │ │ └── prometheus/ │ │ │ ├── .gitignore │ │ │ ├── README.md │ │ │ ├── benchmark_test.go │ │ │ ├── collector.go │ │ │ ├── counter.go │ │ │ ├── counter_test.go │ │ │ ├── desc.go │ │ │ ├── desc_test.go │ │ │ ├── doc.go │ │ │ ├── example_clustermanager_test.go │ │ │ ├── example_timer_complex_test.go │ │ │ ├── example_timer_gauge_test.go │ │ │ ├── example_timer_test.go │ │ │ ├── examples_test.go │ │ │ ├── expvar_collector.go │ │ │ ├── expvar_collector_test.go │ │ │ ├── fnv.go │ │ │ ├── gauge.go │ │ │ ├── gauge_test.go │ │ │ ├── go_collector.go │ │ │ ├── go_collector_test.go │ │ │ ├── histogram.go │ │ │ ├── histogram_test.go │ │ │ ├── http.go │ │ │ ├── http_test.go │ │ │ ├── labels.go │ │ │ ├── metric.go │ │ │ ├── metric_test.go │ │ │ ├── observer.go │ │ │ ├── process_collector.go │ │ │ ├── process_collector_test.go │ │ │ ├── promhttp/ │ │ │ │ ├── delegator.go │ │ │ │ ├── delegator_1_8.go │ │ │ │ ├── delegator_pre_1_8.go │ │ │ │ ├── http.go │ │ │ │ ├── http_test.go │ │ │ │ ├── instrument_client.go │ │ │ │ ├── instrument_client_1_8.go │ │ │ │ ├── instrument_client_1_8_test.go │ │ │ │ ├── instrument_server.go │ │ │ │ └── instrument_server_test.go │ │ │ ├── registry.go │ │ │ ├── registry_test.go │ │ │ ├── summary.go │ │ │ ├── summary_test.go │ │ │ ├── timer.go │ │ │ ├── timer_test.go │ │ │ ├── untyped.go │ │ │ ├── value.go │ │ │ ├── value_test.go │ │ │ ├── vec.go │ │ │ └── vec_test.go │ │ ├── client_model/ │ │ │ ├── .gitignore │ │ │ ├── CONTRIBUTING.md │ │ │ ├── LICENSE │ │ │ ├── MAINTAINERS.md │ │ │ ├── Makefile │ │ │ ├── NOTICE │ │ │ ├── README.md │ │ │ ├── go/ │ │ │ │ └── metrics.pb.go │ │ │ ├── metrics.proto │ │ │ ├── pom.xml │ │ │ └── setup.py │ │ ├── common/ │ │ │ ├── .travis.yml │ │ │ ├── CONTRIBUTING.md │ │ │ ├── LICENSE │ │ │ ├── MAINTAINERS.md │ │ │ ├── NOTICE │ │ │ ├── README.md │ │ │ ├── expfmt/ │ │ │ │ ├── bench_test.go │ │ │ │ ├── decode.go │ │ │ │ ├── decode_test.go │ │ │ │ ├── encode.go │ │ │ │ ├── expfmt.go │ │ │ │ ├── fuzz.go │ │ │ │ ├── text_create.go │ │ │ │ ├── text_create_test.go │ │ │ │ ├── text_parse.go │ │ │ │ └── text_parse_test.go │ │ │ ├── internal/ │ │ │ │ └── bitbucket.org/ │ │ │ │ └── ww/ │ │ │ │ └── goautoneg/ │ │ │ │ ├── README.txt │ │ │ │ ├── autoneg.go │ │ │ │ └── autoneg_test.go │ │ │ └── model/ │ │ │ ├── alert.go │ │ │ ├── alert_test.go │ │ │ ├── fingerprinting.go │ │ │ ├── fnv.go │ │ │ ├── labels.go │ │ │ ├── labels_test.go │ │ │ ├── labelset.go │ │ │ ├── metric.go │ │ │ ├── metric_test.go │ │ │ ├── model.go │ │ │ ├── signature.go │ │ │ ├── signature_test.go │ │ │ ├── silence.go │ │ │ ├── silence_test.go │ │ │ ├── time.go │ │ │ ├── time_test.go │ │ │ ├── value.go │ │ │ └── value_test.go │ │ └── procfs/ │ │ ├── .travis.yml │ │ ├── CONTRIBUTING.md │ │ ├── LICENSE │ │ ├── MAINTAINERS.md │ │ ├── Makefile │ │ ├── NOTICE │ │ ├── README.md │ │ ├── buddyinfo.go │ │ ├── buddyinfo_test.go │ │ ├── doc.go │ │ ├── fs.go │ │ ├── fs_test.go │ │ ├── ipvs.go │ │ ├── ipvs_test.go │ │ ├── mdstat.go │ │ ├── mdstat_test.go │ │ ├── mountstats.go │ │ ├── mountstats_test.go │ │ ├── proc.go │ │ ├── proc_io.go │ │ ├── proc_io_test.go │ │ ├── proc_limits.go │ │ ├── proc_limits_test.go │ │ ├── proc_stat.go │ │ ├── proc_stat_test.go │ │ ├── proc_test.go │ │ ├── stat.go │ │ ├── stat_test.go │ │ ├── ttar │ │ ├── xfrm.go │ │ ├── xfrm_test.go │ │ └── xfs/ │ │ ├── parse.go │ │ ├── parse_test.go │ │ └── xfs.go │ └── stretchr/ │ └── testify/ │ ├── .gitignore │ ├── .travis.yml │ ├── LICENCE.txt │ ├── LICENSE │ ├── README.md │ ├── assert/ │ │ ├── assertion_forward.go │ │ ├── assertion_forward.go.tmpl │ │ ├── assertions.go │ │ ├── assertions_test.go │ │ ├── doc.go │ │ ├── errors.go │ │ ├── forward_assertions.go │ │ ├── forward_assertions_test.go │ │ ├── http_assertions.go │ │ └── http_assertions_test.go │ ├── doc.go │ └── package_test.go └── window.go
Showing preview only (304K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (3443 symbols across 237 files)
FILE: cmd/morgoth/main.go
constant defaultMinSupport (line 26) | defaultMinSupport = 0.05
constant defaultErrorTolerance (line 27) | defaultErrorTolerance = 0.01
constant defaultConsensus (line 28) | defaultConsensus = 0.5
constant defaultMetricsBindAddr (line 29) | defaultMetricsBindAddr = ":6767"
constant defaultAnomalousField (line 30) | defaultAnomalousField = "anomalous"
function init (line 42) | func init() {
function main (line 46) | func main() {
type accepter (line 117) | type accepter struct
method Accept (line 123) | func (acc *accepter) Accept(conn net.Conn) {
type fingerprinterInfo (line 143) | type fingerprinterInfo struct
type createFingerprinterFunc (line 149) | type createFingerprinterFunc
type initFingerprinterFunc (line 152) | type initFingerprinterFunc
type Handler (line 210) | type Handler struct
method Close (line 246) | func (h *Handler) Close() {
method detectorName (line 253) | func (h *Handler) detectorName(group string) string {
method Info (line 258) | func (h *Handler) Info() (*agent.InfoResponse, error) {
method Init (line 282) | func (h *Handler) Init(r *agent.InitRequest) (*agent.InitResponse, err...
method Snapshot (line 354) | func (h *Handler) Snapshot() (*agent.SnapshotResponse, error) {
method Restore (line 359) | func (h *Handler) Restore(*agent.RestoreRequest) (*agent.RestoreRespon...
method BeginBatch (line 364) | func (h *Handler) BeginBatch(b *agent.BeginBatch) error {
method Point (line 372) | func (h *Handler) Point(p *agent.Point) error {
method EndBatch (line 390) | func (h *Handler) EndBatch(b *agent.EndBatch) error {
method createDetectorMetrics (line 442) | func (h *Handler) createDetectorMetrics(group string) *morgoth.Detecto...
method Stop (line 500) | func (h *Handler) Stop() {
method newFingerprinters (line 504) | func (h *Handler) newFingerprinters() []morgoth.Fingerprinter {
type fingerprinterCreator (line 230) | type fingerprinterCreator struct
function newHandler (line 235) | func newHandler(a *agent.Agent) *Handler {
FILE: counter/counter.go
type Counter (line 8) | type Counter interface
type Countable (line 14) | type Countable interface
type Metrics (line 18) | type Metrics struct
method Register (line 23) | func (m *Metrics) Register() error {
method Unregister (line 33) | func (m *Metrics) Unregister() {
FILE: counter/lossy_counter.go
type lossyCounter (line 11) | type lossyCounter struct
method Count (line 41) | func (self *lossyCounter) Count(countable Countable) float64 {
method prune (line 89) | func (self *lossyCounter) prune() {
type entry (line 23) | type entry struct
function NewLossyCounter (line 30) | func NewLossyCounter(metrics *Metrics, errorTolerance float64) *lossyCou...
FILE: counter/lossy_counter_test.go
type fp (line 12) | type fp struct
method IsMatch (line 16) | func (self *fp) IsMatch(other Countable) bool {
function TestLossyCounterShouldCountAllItems (line 37) | func TestLossyCounterShouldCountAllItems(t *testing.T) {
function TestLossyCounterShouldByLossy (line 55) | func TestLossyCounterShouldByLossy(t *testing.T) {
function BenchmarkCounting (line 81) | func BenchmarkCounting(b *testing.B) {
FILE: detector.go
type Detector (line 12) | type Detector struct
method IsAnomalous (line 94) | func (self *Detector) IsAnomalous(window *Window) (bool, float64) {
method Close (line 133) | func (self *Detector) Close() {
type DetectorMetrics (line 22) | type DetectorMetrics struct
method Register (line 29) | func (m *DetectorMetrics) Register() error {
method Unregister (line 46) | func (m *DetectorMetrics) Unregister() {
type fingerprinterCounter (line 56) | type fingerprinterCounter struct
function NewDetector (line 67) | func NewDetector(metrics *DetectorMetrics, consensus, minSupport, errorT...
FILE: fingerprint.go
type Fingerprint (line 5) | type Fingerprint interface
type Fingerprinter (line 9) | type Fingerprinter interface
FILE: fingerprinters/jsdiv/jsdiv.go
constant iterations (line 10) | iterations = 20
type histogram (line 12) | type histogram
type JSDiv (line 26) | type JSDiv struct
method Fingerprint (line 42) | func (self *JSDiv) Fingerprint(window *morgoth.Window) morgoth.Fingerp...
function New (line 33) | func New(min, max, binWidth, pValue float64) *JSDiv {
function calcHistogram (line 54) | func calcHistogram(xs []float64, binWidth float64) (hist histogram, coun...
type JSDivFingerprint (line 65) | type JSDivFingerprint struct
method IsMatch (line 74) | func (self *JSDivFingerprint) IsMatch(other counter.Countable) bool {
method calcSignificance (line 85) | func (self *JSDivFingerprint) calcSignificance(other *JSDivFingerprint...
function calcS (line 123) | func calcS(hist histogram) float64 {
function apporxIncompleteGamma (line 135) | func apporxIncompleteGamma(s, x float64) float64 {
FILE: fingerprinters/kstest/kstest.go
type KSTest (line 32) | type KSTest struct
method Fingerprint (line 42) | func (self *KSTest) Fingerprint(window *morgoth.Window) morgoth.Finger...
function New (line 36) | func New(confidence uint) *KSTest {
type KSTestFingerprint (line 49) | type KSTestFingerprint struct
method IsMatch (line 54) | func (self *KSTestFingerprint) IsMatch(other counter.Countable) bool {
method calcThreshold (line 71) | func (self *KSTestFingerprint) calcThreshold(othr *KSTestFingerprint) ...
function calcD (line 80) | func calcD(f1, f2 []float64) float64 {
FILE: fingerprinters/kstest/kstest_test.go
function TestCalcDShouldBe0 (line 10) | func TestCalcDShouldBe0(t *testing.T) {
function TestCalcDShouldBeSmall (line 24) | func TestCalcDShouldBeSmall(t *testing.T) {
function TestCalcDShouldBe1 (line 47) | func TestCalcDShouldBe1(t *testing.T) {
function BenchmarkCalcD (line 70) | func BenchmarkCalcD(b *testing.B) {
function BenchmarkIsMatch (line 82) | func BenchmarkIsMatch(b *testing.B) {
function BenchmarkFingerprint (line 111) | func BenchmarkFingerprint(b *testing.B) {
FILE: fingerprinters/sigma/sigma.go
type Sigma (line 12) | type Sigma struct
method Fingerprint (line 22) | func (self *Sigma) Fingerprint(window *morgoth.Window) morgoth.Fingerp...
function New (line 16) | func New(deviations float64) *Sigma {
function calcStats (line 30) | func calcStats(xs []float64) (mean, std float64) {
type SigmaFingerprint (line 45) | type SigmaFingerprint struct
method IsMatch (line 50) | func (self SigmaFingerprint) IsMatch(other counter.Countable) bool {
FILE: vendor/github.com/beorn7/perks/quantile/bench_test.go
function BenchmarkInsertTargeted (line 7) | func BenchmarkInsertTargeted(b *testing.B) {
function BenchmarkInsertTargetedSmallEpsilon (line 17) | func BenchmarkInsertTargetedSmallEpsilon(b *testing.B) {
function BenchmarkInsertBiased (line 25) | func BenchmarkInsertBiased(b *testing.B) {
function BenchmarkInsertBiasedSmallEpsilon (line 33) | func BenchmarkInsertBiasedSmallEpsilon(b *testing.B) {
function BenchmarkQuery (line 41) | func BenchmarkQuery(b *testing.B) {
function BenchmarkQuerySmallEpsilon (line 53) | func BenchmarkQuerySmallEpsilon(b *testing.B) {
FILE: vendor/github.com/beorn7/perks/quantile/example_test.go
function Example_simple (line 16) | func Example_simple() {
function Example_mergeMultipleStreams (line 41) | func Example_mergeMultipleStreams() {
function Example_window (line 67) | func Example_window() {
function sendStreamValues (line 91) | func sendStreamValues(ch chan float64) {
function flushToDB (line 95) | func flushToDB(t time.Time, samples quantile.Samples) {
function getDBQuerySamples (line 101) | func getDBQuerySamples(ch chan quantile.Samples) {}
function sendFloats (line 103) | func sendFloats(ch chan<- float64) {
FILE: vendor/github.com/beorn7/perks/quantile/stream.go
type Sample (line 24) | type Sample struct
type Samples (line 31) | type Samples
method Len (line 33) | func (a Samples) Len() int { return len(a) }
method Less (line 34) | func (a Samples) Less(i, j int) bool { return a[i].Value < a[j].Value }
method Swap (line 35) | func (a Samples) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
type invariant (line 37) | type invariant
function NewLowBiased (line 49) | func NewLowBiased(epsilon float64) *Stream {
function NewHighBiased (line 66) | func NewHighBiased(epsilon float64) *Stream {
function NewTargeted (line 80) | func NewTargeted(targets map[float64]float64) *Stream {
type Stream (line 101) | type Stream struct
method Insert (line 113) | func (s *Stream) Insert(v float64) {
method insert (line 117) | func (s *Stream) insert(sample Sample) {
method Query (line 128) | func (s *Stream) Query(q float64) float64 {
method Merge (line 152) | func (s *Stream) Merge(samples Samples) {
method Reset (line 158) | func (s *Stream) Reset() {
method Samples (line 164) | func (s *Stream) Samples() Samples {
method Count (line 174) | func (s *Stream) Count() int {
method flush (line 178) | func (s *Stream) flush() {
method maybeSort (line 184) | func (s *Stream) maybeSort() {
method flushed (line 191) | func (s *Stream) flushed() bool {
function newStream (line 107) | func newStream(ƒ invariant) *Stream {
type stream (line 195) | type stream struct
method reset (line 201) | func (s *stream) reset() {
method insert (line 206) | func (s *stream) insert(v float64) {
method merge (line 210) | func (s *stream) merge(samples Samples) {
method count (line 244) | func (s *stream) count() int {
method query (line 248) | func (s *stream) query(q float64) float64 {
method compress (line 263) | func (s *stream) compress() {
method samples (line 288) | func (s *stream) samples() Samples {
FILE: vendor/github.com/beorn7/perks/quantile/stream_test.go
constant RelativeEpsilon (line 29) | RelativeEpsilon = 0.01
function verifyPercsWithAbsoluteEpsilon (line 31) | func verifyPercsWithAbsoluteEpsilon(t *testing.T, a []float64, s *Stream) {
function verifyLowPercsWithRelativeEpsilon (line 54) | func verifyLowPercsWithRelativeEpsilon(t *testing.T, a []float64, s *Str...
function verifyHighPercsWithRelativeEpsilon (line 69) | func verifyHighPercsWithRelativeEpsilon(t *testing.T, a []float64, s *St...
function populateStream (line 84) | func populateStream(s *Stream) []float64 {
function TestTargetedQuery (line 98) | func TestTargetedQuery(t *testing.T) {
function TestTargetedQuerySmallSampleSize (line 105) | func TestTargetedQuerySmallSampleSize(t *testing.T) {
function TestLowBiasedQuery (line 129) | func TestLowBiasedQuery(t *testing.T) {
function TestHighBiasedQuery (line 136) | func TestHighBiasedQuery(t *testing.T) {
function BrokenTestTargetedMerge (line 144) | func BrokenTestTargetedMerge(t *testing.T) {
function BrokenTestLowBiasedMerge (line 155) | func BrokenTestLowBiasedMerge(t *testing.T) {
function BrokenTestHighBiasedMerge (line 166) | func BrokenTestHighBiasedMerge(t *testing.T) {
function TestUncompressed (line 176) | func TestUncompressed(t *testing.T) {
function TestUncompressedSamples (line 193) | func TestUncompressedSamples(t *testing.T) {
function TestUncompressedOne (line 203) | func TestUncompressedOne(t *testing.T) {
function TestDefaults (line 211) | func TestDefaults(t *testing.T) {
FILE: vendor/github.com/davecgh/go-spew/spew/bypass.go
constant UnsafeDisabled (line 31) | UnsafeDisabled = false
constant ptrSize (line 34) | ptrSize = unsafe.Sizeof((*byte)(nil))
function init (line 66) | func init() {
function unsafeReflectValue (line 122) | func unsafeReflectValue(v reflect.Value) (rv reflect.Value) {
FILE: vendor/github.com/davecgh/go-spew/spew/bypasssafe.go
constant UnsafeDisabled (line 28) | UnsafeDisabled = true
function unsafeReflectValue (line 36) | func unsafeReflectValue(v reflect.Value) reflect.Value {
FILE: vendor/github.com/davecgh/go-spew/spew/common.go
function catchPanic (line 72) | func catchPanic(w io.Writer, v reflect.Value) {
function handleMethods (line 85) | func handleMethods(cs *ConfigState, w io.Writer, v reflect.Value) (handl...
function printBool (line 144) | func printBool(w io.Writer, val bool) {
function printInt (line 153) | func printInt(w io.Writer, val int64, base int) {
function printUint (line 158) | func printUint(w io.Writer, val uint64, base int) {
function printFloat (line 164) | func printFloat(w io.Writer, val float64, precision int) {
function printComplex (line 170) | func printComplex(w io.Writer, c complex128, floatPrecision int) {
function printHexPtr (line 185) | func printHexPtr(w io.Writer, p uintptr) {
type valuesSorter (line 219) | type valuesSorter struct
method Len (line 279) | func (s *valuesSorter) Len() int {
method Swap (line 285) | func (s *valuesSorter) Swap(i, j int) {
method Less (line 326) | func (s *valuesSorter) Less(i, j int) bool {
function newValuesSorter (line 228) | func newValuesSorter(values []reflect.Value, cs *ConfigState) sort.Inter...
function canSortSimply (line 256) | func canSortSimply(kind reflect.Kind) bool {
function valueSortLess (line 295) | func valueSortLess(a, b reflect.Value) bool {
function sortValues (line 336) | func sortValues(values []reflect.Value, cs *ConfigState) {
FILE: vendor/github.com/davecgh/go-spew/spew/common_test.go
type stringer (line 28) | type stringer
method String (line 32) | func (s stringer) String() string {
type pstringer (line 37) | type pstringer
method String (line 41) | func (s *pstringer) String() string {
type xref1 (line 47) | type xref1 struct
type xref2 (line 50) | type xref2 struct
type indirCir1 (line 56) | type indirCir1 struct
type indirCir2 (line 59) | type indirCir2 struct
type indirCir3 (line 62) | type indirCir3 struct
type embed (line 67) | type embed struct
type embedwrap (line 72) | type embedwrap struct
type panicer (line 79) | type panicer
method String (line 81) | func (p panicer) String() string {
type customError (line 86) | type customError
method Error (line 88) | func (e customError) Error() string {
function stringizeWants (line 94) | func stringizeWants(wants []string) string {
function testFailed (line 108) | func testFailed(result string, wants []string) bool {
type sortableStruct (line 117) | type sortableStruct struct
method String (line 121) | func (ss sortableStruct) String() string {
type unsortableStruct (line 125) | type unsortableStruct struct
type sortTestCase (line 129) | type sortTestCase struct
function helpTestSortValues (line 134) | func helpTestSortValues(tests []sortTestCase, cs *spew.ConfigState, t *t...
function TestSortValues (line 159) | func TestSortValues(t *testing.T) {
function TestSortValuesWithMethods (line 233) | func TestSortValuesWithMethods(t *testing.T) {
function TestSortValuesWithSpew (line 268) | func TestSortValuesWithSpew(t *testing.T) {
FILE: vendor/github.com/davecgh/go-spew/spew/config.go
type ConfigState (line 37) | type ConfigState struct
method Errorf (line 115) | func (c *ConfigState) Errorf(format string, a ...interface{}) (err err...
method Fprint (line 127) | func (c *ConfigState) Fprint(w io.Writer, a ...interface{}) (n int, er...
method Fprintf (line 139) | func (c *ConfigState) Fprintf(w io.Writer, format string, a ...interfa...
method Fprintln (line 150) | func (c *ConfigState) Fprintln(w io.Writer, a ...interface{}) (n int, ...
method Print (line 162) | func (c *ConfigState) Print(a ...interface{}) (n int, err error) {
method Printf (line 174) | func (c *ConfigState) Printf(format string, a ...interface{}) (n int, ...
method Println (line 186) | func (c *ConfigState) Println(a ...interface{}) (n int, err error) {
method Sprint (line 197) | func (c *ConfigState) Sprint(a ...interface{}) string {
method Sprintf (line 208) | func (c *ConfigState) Sprintf(format string, a ...interface{}) string {
method Sprintln (line 219) | func (c *ConfigState) Sprintln(a ...interface{}) string {
method NewFormatter (line 240) | func (c *ConfigState) NewFormatter(v interface{}) fmt.Formatter {
method Fdump (line 246) | func (c *ConfigState) Fdump(w io.Writer, a ...interface{}) {
method Dump (line 273) | func (c *ConfigState) Dump(a ...interface{}) {
method Sdump (line 279) | func (c *ConfigState) Sdump(a ...interface{}) string {
method convertArgs (line 288) | func (c *ConfigState) convertArgs(args []interface{}) (formatters []in...
function NewDefaultConfig (line 304) | func NewDefaultConfig() *ConfigState {
FILE: vendor/github.com/davecgh/go-spew/spew/dump.go
type dumpState (line 51) | type dumpState struct
method indent (line 62) | func (d *dumpState) indent() {
method unpackValue (line 73) | func (d *dumpState) unpackValue(v reflect.Value) reflect.Value {
method dumpPtr (line 81) | func (d *dumpState) dumpPtr(v reflect.Value) {
method dumpSlice (line 161) | func (d *dumpState) dumpSlice(v reflect.Value) {
method dump (line 251) | func (d *dumpState) dump(v reflect.Value) {
function fdump (line 453) | func fdump(cs *ConfigState, w io.Writer, a ...interface{}) {
function Fdump (line 472) | func Fdump(w io.Writer, a ...interface{}) {
function Sdump (line 478) | func Sdump(a ...interface{}) string {
function Dump (line 507) | func Dump(a ...interface{}) {
FILE: vendor/github.com/davecgh/go-spew/spew/dump_test.go
type dumpTest (line 74) | type dumpTest struct
function addDumpTest (line 84) | func addDumpTest(in interface{}, wants ...string) {
function addIntDumpTests (line 89) | func addIntDumpTests() {
function addUintDumpTests (line 156) | func addUintDumpTests() {
function addBoolDumpTests (line 223) | func addBoolDumpTests() {
function addFloatDumpTests (line 249) | func addFloatDumpTests() {
function addComplexDumpTests (line 277) | func addComplexDumpTests() {
function addArrayDumpTests (line 305) | func addArrayDumpTests() {
function addSliceDumpTests (line 403) | func addSliceDumpTests() {
function addStringDumpTests (line 508) | func addStringDumpTests() {
function addInterfaceDumpTests (line 524) | func addInterfaceDumpTests() {
function addMapDumpTests (line 550) | func addMapDumpTests() {
function addStructDumpTests (line 651) | func addStructDumpTests() {
function addUintptrDumpTests (line 742) | func addUintptrDumpTests() {
function addUnsafePointerDumpTests (line 769) | func addUnsafePointerDumpTests() {
function addChanDumpTests (line 797) | func addChanDumpTests() {
function addFuncDumpTests (line 823) | func addFuncDumpTests() {
function addCircularDumpTests (line 866) | func addCircularDumpTests() {
function addPanicDumpTests (line 929) | func addPanicDumpTests() {
function addErrorDumpTests (line 944) | func addErrorDumpTests() {
function TestDump (line 960) | func TestDump(t *testing.T) {
function TestDumpSortedKeys (line 994) | func TestDumpSortedKeys(t *testing.T) {
FILE: vendor/github.com/davecgh/go-spew/spew/dumpcgo_test.go
function addCgoDumpTests (line 32) | func addCgoDumpTests() {
FILE: vendor/github.com/davecgh/go-spew/spew/dumpnocgo_test.go
function addCgoDumpTests (line 23) | func addCgoDumpTests() {
FILE: vendor/github.com/davecgh/go-spew/spew/example_test.go
type Flag (line 25) | type Flag
method String (line 37) | func (f Flag) String() string {
constant flagOne (line 28) | flagOne Flag = iota
constant flagTwo (line 29) | flagTwo
type Bar (line 44) | type Bar struct
type Foo (line 48) | type Foo struct
function ExampleDump (line 54) | func ExampleDump() {
function ExamplePrintf (line 121) | func ExamplePrintf() {
function ExampleConfigState (line 145) | func ExampleConfigState() {
function ExampleConfigState_Dump (line 164) | func ExampleConfigState_Dump() {
function ExampleConfigState_Printf (line 202) | func ExampleConfigState_Printf() {
FILE: vendor/github.com/davecgh/go-spew/spew/format.go
constant supportedFlags (line 28) | supportedFlags = "0-+# "
type formatState (line 34) | type formatState struct
method buildDefaultFormat (line 47) | func (f *formatState) buildDefaultFormat() (format string) {
method constructOrigFormat (line 65) | func (f *formatState) constructOrigFormat(verb rune) (format string) {
method unpackValue (line 94) | func (f *formatState) unpackValue(v reflect.Value) reflect.Value {
method formatPtr (line 105) | func (f *formatState) formatPtr(v reflect.Value) {
method format (line 201) | func (f *formatState) format(v reflect.Value) {
method Format (line 371) | func (f *formatState) Format(fs fmt.State, verb rune) {
function newFormatter (line 394) | func newFormatter(cs *ConfigState, v interface{}) fmt.Formatter {
function NewFormatter (line 417) | func NewFormatter(v interface{}) fmt.Formatter {
FILE: vendor/github.com/davecgh/go-spew/spew/format_test.go
type formatterTest (line 79) | type formatterTest struct
function addFormatterTest (line 90) | func addFormatterTest(format string, in interface{}, wants ...string) {
function addIntFormatterTests (line 95) | func addIntFormatterTests() {
function addUintFormatterTests (line 222) | func addUintFormatterTests() {
function addBoolFormatterTests (line 349) | func addBoolFormatterTests() {
function addFloatFormatterTests (line 396) | func addFloatFormatterTests() {
function addComplexFormatterTests (line 448) | func addComplexFormatterTests() {
function addArrayFormatterTests (line 500) | func addArrayFormatterTests() {
function addSliceFormatterTests (line 585) | func addSliceFormatterTests() {
function addStringFormatterTests (line 693) | func addStringFormatterTests() {
function addInterfaceFormatterTests (line 720) | func addInterfaceFormatterTests() {
function addMapFormatterTests (line 767) | func addMapFormatterTests() {
function addStructFormatterTests (line 886) | func addStructFormatterTests() {
function addUintptrFormatterTests (line 1036) | func addUintptrFormatterTests() {
function addUnsafePointerFormatterTests (line 1084) | func addUnsafePointerFormatterTests() {
function addChanFormatterTests (line 1132) | func addChanFormatterTests() {
function addFuncFormatterTests (line 1179) | func addFuncFormatterTests() {
function addCircularFormatterTests (line 1258) | func addCircularFormatterTests() {
function addPanicFormatterTests (line 1370) | func addPanicFormatterTests() {
function addErrorFormatterTests (line 1397) | func addErrorFormatterTests() {
function addPassthroughFormatterTests (line 1424) | func addPassthroughFormatterTests() {
function TestFormatter (line 1465) | func TestFormatter(t *testing.T) {
type testStruct (line 1500) | type testStruct struct
method String (line 1504) | func (ts testStruct) String() string {
type testStructP (line 1508) | type testStructP struct
method String (line 1512) | func (ts *testStructP) String() string {
function TestPrintSortedKeys (line 1516) | func TestPrintSortedKeys(t *testing.T) {
FILE: vendor/github.com/davecgh/go-spew/spew/internal_test.go
type dummyFmtState (line 34) | type dummyFmtState struct
method Flag (line 38) | func (dfs *dummyFmtState) Flag(f int) bool {
method Precision (line 45) | func (dfs *dummyFmtState) Precision() (int, bool) {
method Width (line 49) | func (dfs *dummyFmtState) Width() (int, bool) {
function TestInvalidReflectValue (line 57) | func TestInvalidReflectValue(t *testing.T) {
function SortValues (line 85) | func SortValues(values []reflect.Value, cs *ConfigState) {
FILE: vendor/github.com/davecgh/go-spew/spew/internalunsafe_test.go
function changeKind (line 40) | func changeKind(v *reflect.Value, readOnly bool) {
function TestAddedReflectValue (line 53) | func TestAddedReflectValue(t *testing.T) {
FILE: vendor/github.com/davecgh/go-spew/spew/spew.go
function Errorf (line 32) | func Errorf(format string, a ...interface{}) (err error) {
function Fprint (line 44) | func Fprint(w io.Writer, a ...interface{}) (n int, err error) {
function Fprintf (line 56) | func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err e...
function Fprintln (line 67) | func Fprintln(w io.Writer, a ...interface{}) (n int, err error) {
function Print (line 79) | func Print(a ...interface{}) (n int, err error) {
function Printf (line 91) | func Printf(format string, a ...interface{}) (n int, err error) {
function Println (line 103) | func Println(a ...interface{}) (n int, err error) {
function Sprint (line 114) | func Sprint(a ...interface{}) string {
function Sprintf (line 125) | func Sprintf(format string, a ...interface{}) string {
function Sprintln (line 136) | func Sprintln(a ...interface{}) string {
function convertArgs (line 142) | func convertArgs(args []interface{}) (formatters []interface{}) {
FILE: vendor/github.com/davecgh/go-spew/spew/spew_test.go
type spewFunc (line 31) | type spewFunc
method String (line 82) | func (f spewFunc) String() string {
constant fCSFdump (line 34) | fCSFdump spewFunc = iota
constant fCSFprint (line 35) | fCSFprint
constant fCSFprintf (line 36) | fCSFprintf
constant fCSFprintln (line 37) | fCSFprintln
constant fCSPrint (line 38) | fCSPrint
constant fCSPrintln (line 39) | fCSPrintln
constant fCSSdump (line 40) | fCSSdump
constant fCSSprint (line 41) | fCSSprint
constant fCSSprintf (line 42) | fCSSprintf
constant fCSSprintln (line 43) | fCSSprintln
constant fCSErrorf (line 44) | fCSErrorf
constant fCSNewFormatter (line 45) | fCSNewFormatter
constant fErrorf (line 46) | fErrorf
constant fFprint (line 47) | fFprint
constant fFprintln (line 48) | fFprintln
constant fPrint (line 49) | fPrint
constant fPrintln (line 50) | fPrintln
constant fSdump (line 51) | fSdump
constant fSprint (line 52) | fSprint
constant fSprintf (line 53) | fSprintf
constant fSprintln (line 54) | fSprintln
type spewTest (line 91) | type spewTest struct
function redirStdout (line 109) | func redirStdout(f func()) ([]byte, error) {
function initSpewTests (line 126) | func initSpewTests() {
function TestSpew (line 210) | func TestSpew(t *testing.T) {
FILE: vendor/github.com/golang/protobuf/proto/all_test.go
function old (line 53) | func old() *Buffer {
function equalbytes (line 61) | func equalbytes(b1, b2 []byte, t *testing.T) {
function initGoTestField (line 73) | func initGoTestField() *GoTestField {
function initGoTest_RequiredGroup (line 83) | func initGoTest_RequiredGroup() *GoTest_RequiredGroup {
function initGoTest_OptionalGroup (line 89) | func initGoTest_OptionalGroup() *GoTest_OptionalGroup {
function initGoTest_RepeatedGroup (line 95) | func initGoTest_RepeatedGroup() *GoTest_RepeatedGroup {
function initGoTest (line 101) | func initGoTest(setdefaults bool) *GoTest {
function fail (line 139) | func fail(msg string, b *bytes.Buffer, s string, t *testing.T) {
function hex (line 263) | func hex(c uint8) uint8 {
function equal (line 276) | func equal(b []byte, s string, t *testing.T) bool {
function overify (line 293) | func overify(t *testing.T, pb *GoTest, expected string) {
function TestNumericPrimitives (line 328) | func TestNumericPrimitives(t *testing.T) {
type fakeMarshaler (line 399) | type fakeMarshaler struct
method Marshal (line 404) | func (f *fakeMarshaler) Marshal() ([]byte, error) { return f.b, f.err }
method String (line 405) | func (f *fakeMarshaler) String() string { return fmt.Sprintf...
method ProtoMessage (line 406) | func (f *fakeMarshaler) ProtoMessage() {}
method Reset (line 407) | func (f *fakeMarshaler) Reset() {}
type msgWithFakeMarshaler (line 409) | type msgWithFakeMarshaler struct
method String (line 413) | func (m *msgWithFakeMarshaler) String() string { return CompactTextStr...
method ProtoMessage (line 414) | func (m *msgWithFakeMarshaler) ProtoMessage() {}
method Reset (line 415) | func (m *msgWithFakeMarshaler) Reset() {}
function TestMarshalerEncoding (line 418) | func TestMarshalerEncoding(t *testing.T) {
function TestBytesPrimitives (line 486) | func TestBytesPrimitives(t *testing.T) {
function TestStringPrimitives (line 500) | func TestStringPrimitives(t *testing.T) {
function TestRequiredBit (line 516) | func TestRequiredBit(t *testing.T) {
function checkInitialized (line 531) | func checkInitialized(pb *GoTest, t *testing.T) {
function TestReset (line 574) | func TestReset(t *testing.T) {
function TestEncodeDecode1 (line 595) | func TestEncodeDecode1(t *testing.T) {
function TestEncodeDecode2 (line 619) | func TestEncodeDecode2(t *testing.T) {
function TestEncodeDecode3 (line 657) | func TestEncodeDecode3(t *testing.T) {
function TestEncodeDecode4 (line 709) | func TestEncodeDecode4(t *testing.T) {
function TestEncodeDecode5 (line 784) | func TestEncodeDecode5(t *testing.T) {
function TestEncodeDecode6 (line 872) | func TestEncodeDecode6(t *testing.T) {
function TestEncodeDecodeBytes1 (line 927) | func TestEncodeDecodeBytes1(t *testing.T) {
function TestEncodeDecodeBytes2 (line 958) | func TestEncodeDecodeBytes2(t *testing.T) {
function TestSkippingUnrecognizedFields (line 980) | func TestSkippingUnrecognizedFields(t *testing.T) {
function TestSubmessageUnrecognizedFields (line 1032) | func TestSubmessageUnrecognizedFields(t *testing.T) {
function TestNegativeInt32 (line 1081) | func TestNegativeInt32(t *testing.T) {
function TestBigRepeated (line 1115) | func TestBigRepeated(t *testing.T) {
function TestTypeMismatch (line 1226) | func TestTypeMismatch(t *testing.T) {
function encodeDecode (line 1243) | func encodeDecode(t *testing.T, in, out Message, msg string) {
function TestPackedNonPackedDecoderSwitching (line 1253) | func TestPackedNonPackedDecoderSwitching(t *testing.T) {
function TestProto1RepeatedGroup (line 1272) | func TestProto1RepeatedGroup(t *testing.T) {
function TestEnum (line 1294) | func TestEnum(t *testing.T) {
function TestPrintingNilEnumFields (line 1312) | func TestPrintingNilEnumFields(t *testing.T) {
function TestRequiredFieldEnforcement (line 1318) | func TestRequiredFieldEnforcement(t *testing.T) {
function TestRequiredFieldEnforcementGroups (line 1340) | func TestRequiredFieldEnforcementGroups(t *testing.T) {
function TestTypedNilMarshal (line 1356) | func TestTypedNilMarshal(t *testing.T) {
type nonNillableInt (line 1374) | type nonNillableInt
method Marshal (line 1376) | func (nni nonNillableInt) Marshal() ([]byte, error) {
type NNIMessage (line 1380) | type NNIMessage struct
method Reset (line 1384) | func (*NNIMessage) Reset() {}
method String (line 1385) | func (*NNIMessage) String() string { return "" }
method ProtoMessage (line 1386) | func (*NNIMessage) ProtoMessage() {}
type nillableMessage (line 1389) | type nillableMessage struct
method Marshal (line 1393) | func (nm *nillableMessage) Marshal() ([]byte, error) {
type NMMessage (line 1397) | type NMMessage struct
method Reset (line 1401) | func (*NMMessage) Reset() {}
method String (line 1402) | func (*NMMessage) String() string { return "" }
method ProtoMessage (line 1403) | func (*NMMessage) ProtoMessage() {}
function TestNilMarshaler (line 1406) | func TestNilMarshaler(t *testing.T) {
function TestAllSetDefaults (line 1423) | func TestAllSetDefaults(t *testing.T) {
function TestSetDefaultsWithSetField (line 1455) | func TestSetDefaultsWithSetField(t *testing.T) {
function TestSetDefaultsWithSubMessage (line 1466) | func TestSetDefaultsWithSubMessage(t *testing.T) {
function TestSetDefaultsWithRepeatedSubMessage (line 1486) | func TestSetDefaultsWithRepeatedSubMessage(t *testing.T) {
function TestSetDefaultWithRepeatedNonMessage (line 1501) | func TestSetDefaultWithRepeatedNonMessage(t *testing.T) {
function TestMaximumTagNumber (line 1512) | func TestMaximumTagNumber(t *testing.T) {
function TestJSON (line 1529) | func TestJSON(t *testing.T) {
function TestBadWireType (line 1568) | func TestBadWireType(t *testing.T) {
function TestBytesWithInvalidLength (line 1578) | func TestBytesWithInvalidLength(t *testing.T) {
function TestLengthOverflow (line 1584) | func TestLengthOverflow(t *testing.T) {
function TestVarintOverflow (line 1590) | func TestVarintOverflow(t *testing.T) {
function TestUnmarshalFuzz (line 1598) | func TestUnmarshalFuzz(t *testing.T) {
function TestMergeMessages (line 1612) | func TestMergeMessages(t *testing.T) {
function TestExtensionMarshalOrder (line 1642) | func TestExtensionMarshalOrder(t *testing.T) {
function TestMessageSetMarshalOrder (line 1725) | func TestMessageSetMarshalOrder(t *testing.T) {
function TestUnmarshalMergesMessages (line 1762) | func TestUnmarshalMergesMessages(t *testing.T) {
function TestEncodingSizes (line 1805) | func TestEncodingSizes(t *testing.T) {
function TestRequiredNotSetError (line 1827) | func TestRequiredNotSetError(t *testing.T) {
function fuzzUnmarshal (line 1891) | func fuzzUnmarshal(t *testing.T, data []byte) {
function TestMapFieldMarshal (line 1904) | func TestMapFieldMarshal(t *testing.T) {
function TestMapFieldRoundTrips (line 1949) | func TestMapFieldRoundTrips(t *testing.T) {
function TestMapFieldWithNil (line 1984) | func TestMapFieldWithNil(t *testing.T) {
function TestMapFieldWithNilBytes (line 2005) | func TestMapFieldWithNilBytes(t *testing.T) {
function TestDecodeMapFieldMissingKey (line 2036) | func TestDecodeMapFieldMissingKey(t *testing.T) {
function TestDecodeMapFieldMissingValue (line 2053) | func TestDecodeMapFieldMissingValue(t *testing.T) {
function TestOneof (line 2070) | func TestOneof(t *testing.T) {
function TestInefficientPackedBool (line 2122) | func TestInefficientPackedBool(t *testing.T) {
function testMsg (line 2137) | func testMsg() *GoTest {
function bytesMsg (line 2149) | func bytesMsg() *GoTest {
function benchmarkMarshal (line 2159) | func benchmarkMarshal(b *testing.B, pb Message, marshal func(Message) ([...
function benchmarkBufferMarshal (line 2168) | func benchmarkBufferMarshal(b *testing.B, pb Message) {
function benchmarkSize (line 2177) | func benchmarkSize(b *testing.B, pb Message) {
function newOf (line 2184) | func newOf(pb Message) Message {
function benchmarkUnmarshal (line 2192) | func benchmarkUnmarshal(b *testing.B, pb Message, unmarshal func([]byte,...
function benchmarkBufferUnmarshal (line 2203) | func benchmarkBufferUnmarshal(b *testing.B, pb Message) {
function BenchmarkMarshal (line 2213) | func BenchmarkMarshal(b *testing.B) {
function BenchmarkBufferMarshal (line 2217) | func BenchmarkBufferMarshal(b *testing.B) {
function BenchmarkSize (line 2221) | func BenchmarkSize(b *testing.B) {
function BenchmarkUnmarshal (line 2225) | func BenchmarkUnmarshal(b *testing.B) {
function BenchmarkBufferUnmarshal (line 2229) | func BenchmarkBufferUnmarshal(b *testing.B) {
function BenchmarkMarshalBytes (line 2233) | func BenchmarkMarshalBytes(b *testing.B) {
function BenchmarkBufferMarshalBytes (line 2237) | func BenchmarkBufferMarshalBytes(b *testing.B) {
function BenchmarkSizeBytes (line 2241) | func BenchmarkSizeBytes(b *testing.B) {
function BenchmarkUnmarshalBytes (line 2245) | func BenchmarkUnmarshalBytes(b *testing.B) {
function BenchmarkBufferUnmarshalBytes (line 2249) | func BenchmarkBufferUnmarshalBytes(b *testing.B) {
function BenchmarkUnmarshalUnrecognizedFields (line 2253) | func BenchmarkUnmarshalUnrecognizedFields(b *testing.B) {
FILE: vendor/github.com/golang/protobuf/proto/any_test.go
function anyEqual (line 55) | func anyEqual(got, want proto.Message) bool {
type golden (line 65) | type golden struct
function makeGolden (line 72) | func makeGolden() []golden {
function TestMarshalGolden (line 210) | func TestMarshalGolden(t *testing.T) {
function TestUnmarshalGolden (line 221) | func TestUnmarshalGolden(t *testing.T) {
function TestMarshalUnknownAny (line 242) | func TestMarshalUnknownAny(t *testing.T) {
function TestAmbiguousAny (line 260) | func TestAmbiguousAny(t *testing.T) {
function TestUnmarshalOverwriteAny (line 272) | func TestUnmarshalOverwriteAny(t *testing.T) {
function TestUnmarshalAnyMixAndMatch (line 288) | func TestUnmarshalAnyMixAndMatch(t *testing.T) {
FILE: vendor/github.com/golang/protobuf/proto/clone.go
function Clone (line 44) | func Clone(pb Message) Message {
function Merge (line 60) | func Merge(dst, src Message) {
function mergeStruct (line 77) | func mergeStruct(out, in reflect.Value) {
function mergeAny (line 111) | func mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) {
function mergeExtension (line 214) | func mergeExtension(out, in map[int32]Extension) {
FILE: vendor/github.com/golang/protobuf/proto/clone_test.go
function init (line 63) | func init() {
function TestClone (line 72) | func TestClone(t *testing.T) {
function TestCloneNil (line 101) | func TestCloneNil(t *testing.T) {
function TestMerge (line 292) | func TestMerge(t *testing.T) {
FILE: vendor/github.com/golang/protobuf/proto/decode.go
function DecodeVarint (line 63) | func DecodeVarint(buf []byte) (x uint64, n int) {
method decodeVarintSlow (line 80) | func (p *Buffer) decodeVarintSlow() (x uint64, err error) {
method DecodeVarint (line 107) | func (p *Buffer) DecodeVarint() (x uint64, err error) {
method DecodeFixed64 (line 207) | func (p *Buffer) DecodeFixed64() (x uint64, err error) {
method DecodeFixed32 (line 230) | func (p *Buffer) DecodeFixed32() (x uint64, err error) {
method DecodeZigzag64 (line 249) | func (p *Buffer) DecodeZigzag64() (x uint64, err error) {
method DecodeZigzag32 (line 261) | func (p *Buffer) DecodeZigzag32() (x uint64, err error) {
method DecodeRawBytes (line 276) | func (p *Buffer) DecodeRawBytes(alloc bool) (buf []byte, err error) {
method DecodeStringBytes (line 306) | func (p *Buffer) DecodeStringBytes() (s string, err error) {
method skipAndSave (line 317) | func (o *Buffer) skipAndSave(t reflect.Type, tag, wire int, base structP...
method skip (line 344) | func (o *Buffer) skip(t reflect.Type, tag, wire int) error {
type Unmarshaler (line 385) | type Unmarshaler interface
function Unmarshal (line 396) | func Unmarshal(buf []byte, pb Message) error {
function UnmarshalMerge (line 407) | func UnmarshalMerge(buf []byte, pb Message) error {
method DecodeMessage (line 416) | func (p *Buffer) DecodeMessage(pb Message) error {
method DecodeGroup (line 425) | func (p *Buffer) DecodeGroup(pb Message) error {
method Unmarshal (line 439) | func (p *Buffer) Unmarshal(pb Message) error {
method unmarshalType (line 462) | func (o *Buffer) unmarshalType(st reflect.Type, prop *StructProperties, ...
constant boolPoolSize (line 586) | boolPoolSize = 16
constant uint32PoolSize (line 587) | uint32PoolSize = 8
constant uint64PoolSize (line 588) | uint64PoolSize = 4
method dec_bool (line 592) | func (o *Buffer) dec_bool(p *Properties, base structPointer) error {
method dec_proto3_bool (line 606) | func (o *Buffer) dec_proto3_bool(p *Properties, base structPointer) error {
method dec_int32 (line 616) | func (o *Buffer) dec_int32(p *Properties, base structPointer) error {
method dec_proto3_int32 (line 625) | func (o *Buffer) dec_proto3_int32(p *Properties, base structPointer) err...
method dec_int64 (line 635) | func (o *Buffer) dec_int64(p *Properties, base structPointer) error {
method dec_proto3_int64 (line 644) | func (o *Buffer) dec_proto3_int64(p *Properties, base structPointer) err...
method dec_string (line 654) | func (o *Buffer) dec_string(p *Properties, base structPointer) error {
method dec_proto3_string (line 663) | func (o *Buffer) dec_proto3_string(p *Properties, base structPointer) er...
method dec_slice_byte (line 673) | func (o *Buffer) dec_slice_byte(p *Properties, base structPointer) error {
method dec_slice_bool (line 683) | func (o *Buffer) dec_slice_bool(p *Properties, base structPointer) error {
method dec_slice_packed_bool (line 694) | func (o *Buffer) dec_slice_packed_bool(p *Properties, base structPointer...
method dec_slice_int32 (line 721) | func (o *Buffer) dec_slice_int32(p *Properties, base structPointer) error {
method dec_slice_packed_int32 (line 731) | func (o *Buffer) dec_slice_packed_int32(p *Properties, base structPointe...
method dec_slice_int64 (line 755) | func (o *Buffer) dec_slice_int64(p *Properties, base structPointer) error {
method dec_slice_packed_int64 (line 766) | func (o *Buffer) dec_slice_packed_int64(p *Properties, base structPointe...
method dec_slice_string (line 790) | func (o *Buffer) dec_slice_string(p *Properties, base structPointer) err...
method dec_slice_slice_byte (line 801) | func (o *Buffer) dec_slice_slice_byte(p *Properties, base structPointer)...
method dec_new_map (line 812) | func (o *Buffer) dec_new_map(p *Properties, base structPointer) error {
method dec_struct_group (line 885) | func (o *Buffer) dec_struct_group(p *Properties, base structPointer) err...
method dec_struct_message (line 896) | func (o *Buffer) dec_struct_message(p *Properties, base structPointer) (...
method dec_slice_struct_message (line 928) | func (o *Buffer) dec_slice_struct_message(p *Properties, base structPoin...
method dec_slice_struct_group (line 933) | func (o *Buffer) dec_slice_struct_group(p *Properties, base structPointe...
method dec_slice_struct (line 938) | func (o *Buffer) dec_slice_struct(p *Properties, is_group bool, base str...
FILE: vendor/github.com/golang/protobuf/proto/decode_test.go
function BenchmarkVarint32ArraySmall (line 51) | func BenchmarkVarint32ArraySmall(b *testing.B) {
function BenchmarkVarint32ArrayLarge (line 76) | func BenchmarkVarint32ArrayLarge(b *testing.B) {
function BenchmarkVarint64ArraySmall (line 101) | func BenchmarkVarint64ArraySmall(b *testing.B) {
function BenchmarkVarint64ArrayLarge (line 126) | func BenchmarkVarint64ArrayLarge(b *testing.B) {
function BenchmarkVarint64ArrayMixed (line 151) | func BenchmarkVarint64ArrayMixed(b *testing.B) {
function genInt32Dist (line 184) | func genInt32Dist(dist [7]int, count int) (dest []int32) {
function genUint64Dist (line 212) | func genUint64Dist(dist [11]int, count int) (dest []uint64) {
function BenchmarkDecodeEmpty (line 247) | func BenchmarkDecodeEmpty(b *testing.B) {
FILE: vendor/github.com/golang/protobuf/proto/encode.go
type RequiredNotSetError (line 54) | type RequiredNotSetError struct
method Error (line 58) | func (e *RequiredNotSetError) Error() string {
constant maxVarintBytes (line 83) | maxVarintBytes = 10
constant maxMarshalSize (line 87) | maxMarshalSize = 1<<31 - 1
function EncodeVarint (line 95) | func EncodeVarint(x uint64) []byte {
method EncodeVarint (line 111) | func (p *Buffer) EncodeVarint(x uint64) error {
function SizeVarint (line 121) | func SizeVarint(x uint64) int {
function sizeVarint (line 125) | func sizeVarint(x uint64) (n int) {
method EncodeFixed64 (line 139) | func (p *Buffer) EncodeFixed64(x uint64) error {
function sizeFixed64 (line 152) | func sizeFixed64(x uint64) int {
method EncodeFixed32 (line 159) | func (p *Buffer) EncodeFixed32(x uint64) error {
function sizeFixed32 (line 168) | func sizeFixed32(x uint64) int {
method EncodeZigzag64 (line 175) | func (p *Buffer) EncodeZigzag64(x uint64) error {
function sizeZigzag64 (line 180) | func sizeZigzag64(x uint64) int {
method EncodeZigzag32 (line 187) | func (p *Buffer) EncodeZigzag32(x uint64) error {
function sizeZigzag32 (line 192) | func sizeZigzag32(x uint64) int {
method EncodeRawBytes (line 199) | func (p *Buffer) EncodeRawBytes(b []byte) error {
function sizeRawBytes (line 205) | func sizeRawBytes(b []byte) int {
method EncodeStringBytes (line 212) | func (p *Buffer) EncodeStringBytes(s string) error {
function sizeStringBytes (line 218) | func sizeStringBytes(s string) int {
type Marshaler (line 224) | type Marshaler interface
function Marshal (line 230) | func Marshal(pb Message) ([]byte, error) {
method EncodeMessage (line 246) | func (p *Buffer) EncodeMessage(pb Message) error {
method Marshal (line 261) | func (p *Buffer) Marshal(pb Message) error {
function Size (line 288) | func Size(pb Message) (n int) {
method enc_bool (line 314) | func (o *Buffer) enc_bool(p *Properties, base structPointer) error {
method enc_proto3_bool (line 328) | func (o *Buffer) enc_proto3_bool(p *Properties, base structPointer) error {
function size_bool (line 338) | func size_bool(p *Properties, base structPointer) int {
function size_proto3_bool (line 346) | func size_proto3_bool(p *Properties, base structPointer) int {
method enc_int32 (line 355) | func (o *Buffer) enc_int32(p *Properties, base structPointer) error {
method enc_proto3_int32 (line 366) | func (o *Buffer) enc_proto3_int32(p *Properties, base structPointer) err...
function size_int32 (line 377) | func size_int32(p *Properties, base structPointer) (n int) {
function size_proto3_int32 (line 388) | func size_proto3_int32(p *Properties, base structPointer) (n int) {
method enc_uint32 (line 401) | func (o *Buffer) enc_uint32(p *Properties, base structPointer) error {
method enc_proto3_uint32 (line 412) | func (o *Buffer) enc_proto3_uint32(p *Properties, base structPointer) er...
function size_uint32 (line 423) | func size_uint32(p *Properties, base structPointer) (n int) {
function size_proto3_uint32 (line 434) | func size_proto3_uint32(p *Properties, base structPointer) (n int) {
method enc_int64 (line 446) | func (o *Buffer) enc_int64(p *Properties, base structPointer) error {
method enc_proto3_int64 (line 457) | func (o *Buffer) enc_proto3_int64(p *Properties, base structPointer) err...
function size_int64 (line 468) | func size_int64(p *Properties, base structPointer) (n int) {
function size_proto3_int64 (line 479) | func size_proto3_int64(p *Properties, base structPointer) (n int) {
method enc_string (line 491) | func (o *Buffer) enc_string(p *Properties, base structPointer) error {
method enc_proto3_string (line 502) | func (o *Buffer) enc_proto3_string(p *Properties, base structPointer) er...
function size_string (line 512) | func size_string(p *Properties, base structPointer) (n int) {
function size_proto3_string (line 523) | func size_proto3_string(p *Properties, base structPointer) (n int) {
function isNil (line 534) | func isNil(v reflect.Value) bool {
method enc_struct_message (line 543) | func (o *Buffer) enc_struct_message(p *Properties, base structPointer) e...
function size_struct_message (line 566) | func size_struct_message(p *Properties, base structPointer) int {
method enc_struct_group (line 588) | func (o *Buffer) enc_struct_group(p *Properties, base structPointer) err...
function size_struct_group (line 604) | func size_struct_group(p *Properties, base structPointer) (n int) {
method enc_slice_bool (line 617) | func (o *Buffer) enc_slice_bool(p *Properties, base structPointer) error {
function size_slice_bool (line 634) | func size_slice_bool(p *Properties, base structPointer) int {
method enc_slice_packed_bool (line 644) | func (o *Buffer) enc_slice_packed_bool(p *Properties, base structPointer...
function size_slice_packed_bool (line 662) | func size_slice_packed_bool(p *Properties, base structPointer) (n int) {
method enc_slice_byte (line 675) | func (o *Buffer) enc_slice_byte(p *Properties, base structPointer) error {
method enc_proto3_slice_byte (line 685) | func (o *Buffer) enc_proto3_slice_byte(p *Properties, base structPointer...
function size_slice_byte (line 695) | func size_slice_byte(p *Properties, base structPointer) (n int) {
function size_proto3_slice_byte (line 705) | func size_proto3_slice_byte(p *Properties, base structPointer) (n int) {
method enc_slice_int32 (line 716) | func (o *Buffer) enc_slice_int32(p *Properties, base structPointer) error {
function size_slice_int32 (line 730) | func size_slice_int32(p *Properties, base structPointer) (n int) {
method enc_slice_packed_int32 (line 745) | func (o *Buffer) enc_slice_packed_int32(p *Properties, base structPointe...
function size_slice_packed_int32 (line 764) | func size_slice_packed_int32(p *Properties, base structPointer) (n int) {
method enc_slice_uint32 (line 784) | func (o *Buffer) enc_slice_uint32(p *Properties, base structPointer) err...
function size_slice_uint32 (line 798) | func size_slice_uint32(p *Properties, base structPointer) (n int) {
method enc_slice_packed_uint32 (line 814) | func (o *Buffer) enc_slice_packed_uint32(p *Properties, base structPoint...
function size_slice_packed_uint32 (line 832) | func size_slice_packed_uint32(p *Properties, base structPointer) (n int) {
method enc_slice_int64 (line 850) | func (o *Buffer) enc_slice_int64(p *Properties, base structPointer) error {
function size_slice_int64 (line 863) | func size_slice_int64(p *Properties, base structPointer) (n int) {
method enc_slice_packed_int64 (line 877) | func (o *Buffer) enc_slice_packed_int64(p *Properties, base structPointe...
function size_slice_packed_int64 (line 895) | func size_slice_packed_int64(p *Properties, base structPointer) (n int) {
method enc_slice_slice_byte (line 913) | func (o *Buffer) enc_slice_slice_byte(p *Properties, base structPointer)...
function size_slice_slice_byte (line 926) | func size_slice_slice_byte(p *Properties, base structPointer) (n int) {
method enc_slice_string (line 940) | func (o *Buffer) enc_slice_string(p *Properties, base structPointer) err...
function size_slice_string (line 950) | func size_slice_string(p *Properties, base structPointer) (n int) {
method enc_slice_struct_message (line 961) | func (o *Buffer) enc_slice_struct_message(p *Properties, base structPoin...
function size_slice_struct_message (line 996) | func size_slice_struct_message(p *Properties, base structPointer) (n int) {
method enc_slice_struct_group (line 1022) | func (o *Buffer) enc_slice_struct_group(p *Properties, base structPointe...
function size_slice_struct_group (line 1049) | func size_slice_struct_group(p *Properties, base structPointer) (n int) {
method enc_map (line 1067) | func (o *Buffer) enc_map(p *Properties, base structPointer) error {
method enc_exts (line 1076) | func (o *Buffer) enc_exts(p *Properties, base structPointer) error {
method enc_map_body (line 1093) | func (o *Buffer) enc_map_body(v map[int32]Extension) error {
function size_map (line 1115) | func size_map(p *Properties, base structPointer) int {
function size_exts (line 1120) | func size_exts(p *Properties, base structPointer) int {
method enc_new_map (line 1126) | func (o *Buffer) enc_new_map(p *Properties, base structPointer) error {
function size_new_map (line 1172) | func size_new_map(p *Properties, base structPointer) int {
function mapEncodeScratch (line 1195) | func mapEncodeScratch(mapType reflect.Type) (keycopy, valcopy reflect.Va...
method enc_struct (line 1227) | func (o *Buffer) enc_struct(prop *StructProperties, base structPointer) ...
function size_struct (line 1278) | func size_struct(prop *StructProperties, base structPointer) (n int) {
method enc_len_struct (line 1304) | func (o *Buffer) enc_len_struct(prop *StructProperties, base structPoint...
method enc_len_thing (line 1309) | func (o *Buffer) enc_len_thing(enc func() error, state *errorState) error {
type errorState (line 1338) | type errorState struct
method shouldContinue (line 1349) | func (s *errorState) shouldContinue(err error, prop *Properties) bool {
FILE: vendor/github.com/golang/protobuf/proto/encode_test.go
function BenchmarkAny (line 51) | func BenchmarkAny(b *testing.B) {
function BenchmarkEmpy (line 77) | func BenchmarkEmpy(b *testing.B) {
FILE: vendor/github.com/golang/protobuf/proto/equal.go
function Equal (line 72) | func Equal(a, b Message) bool {
function equalStruct (line 96) | func equalStruct(v1, v2 reflect.Value) bool {
function equalAny (line 158) | func equalAny(v1, v2 reflect.Value, prop *Properties) bool {
function equalExtensions (line 245) | func equalExtensions(base reflect.Type, x1, x2 XXX_InternalExtensions) b...
function equalExtMap (line 251) | func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool {
FILE: vendor/github.com/golang/protobuf/proto/equal_test.go
function init (line 53) | func init() {
function TestEqual (line 218) | func TestEqual(t *testing.T) {
FILE: vendor/github.com/golang/protobuf/proto/extensions.go
type ExtensionRange (line 51) | type ExtensionRange struct
type extendableProto (line 57) | type extendableProto interface
type extendableProtoV1 (line 66) | type extendableProtoV1 interface
type extensionAdapter (line 73) | type extensionAdapter struct
method extensionsWrite (line 77) | func (e extensionAdapter) extensionsWrite() map[int32]Extension {
method extensionsRead (line 81) | func (e extensionAdapter) extensionsRead() (map[int32]Extension, sync....
type notLocker (line 86) | type notLocker struct
method Lock (line 88) | func (n notLocker) Lock() {}
method Unlock (line 89) | func (n notLocker) Unlock() {}
function extendable (line 94) | func extendable(p interface{}) (extendableProto, bool) {
type XXX_InternalExtensions (line 111) | type XXX_InternalExtensions struct
method extensionsWrite (line 126) | func (e *XXX_InternalExtensions) extensionsWrite() map[int32]Extension {
method extensionsRead (line 139) | func (e *XXX_InternalExtensions) extensionsRead() (map[int32]Extension...
type ExtensionDesc (line 151) | type ExtensionDesc struct
method repeated (line 160) | func (ed *ExtensionDesc) repeated() bool {
type Extension (line 166) | type Extension struct
function SetRawExtension (line 181) | func SetRawExtension(base Message, id int32, b []byte) {
function isExtensionField (line 191) | func isExtensionField(pb extendableProto, field int32) bool {
function checkExtensionTypes (line 201) | func checkExtensionTypes(pb extendableProto, extension *ExtensionDesc) e...
type extPropKey (line 218) | type extPropKey struct
function extensionProperties (line 230) | func extensionProperties(ed *ExtensionDesc) *Properties {
function encodeExtensions (line 254) | func encodeExtensions(e *XXX_InternalExtensions) error {
function encodeExtensionsMap (line 265) | func encodeExtensionsMap(m map[int32]Extension) error {
function extensionsSize (line 293) | func extensionsSize(e *XXX_InternalExtensions) (n int) {
function extensionsMapSize (line 303) | func extensionsMapSize(m map[int32]Extension) (n int) {
function HasExtension (line 328) | func HasExtension(pb Message, extension *ExtensionDesc) bool {
function ClearExtension (line 345) | func ClearExtension(pb Message, extension *ExtensionDesc) {
function GetExtension (line 357) | func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, er...
function defaultExtensionValue (line 407) | func defaultExtensionValue(extension *ExtensionDesc) (interface{}, error) {
function decodeExtension (line 441) | func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, e...
function GetExtensions (line 475) | func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interf...
function ExtensionDescs (line 496) | func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) {
function SetExtension (line 525) | func SetExtension(pb Message, extension *ExtensionDesc, value interface{...
function ClearAllExtensions (line 552) | func ClearAllExtensions(pb Message) {
function RegisterExtension (line 569) | func RegisterExtension(desc *ExtensionDesc) {
function RegisteredExtensions (line 585) | func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc {
FILE: vendor/github.com/golang/protobuf/proto/extensions_test.go
function TestGetExtensionsWithMissingExtensions (line 46) | func TestGetExtensionsWithMissingExtensions(t *testing.T) {
function TestExtensionDescsWithMissingExtensions (line 67) | func TestExtensionDescsWithMissingExtensions(t *testing.T) {
type ExtensionDescSlice (line 109) | type ExtensionDescSlice
method Len (line 111) | func (s ExtensionDescSlice) Len() int { return len(s) }
method Less (line 112) | func (s ExtensionDescSlice) Less(i, j int) bool { return s[i].Field < ...
method Swap (line 113) | func (s ExtensionDescSlice) Swap(i, j int) { s[i], s[j] = s[j], s...
function sortExtDescs (line 115) | func sortExtDescs(s []*proto.ExtensionDesc) {
function TestGetExtensionStability (line 119) | func TestGetExtensionStability(t *testing.T) {
function TestGetExtensionDefaults (line 153) | func TestGetExtensionDefaults(t *testing.T) {
function TestExtensionsRoundTrip (line 290) | func TestExtensionsRoundTrip(t *testing.T) {
function TestNilExtension (line 333) | func TestNilExtension(t *testing.T) {
function TestMarshalUnmarshalRepeatedExtension (line 349) | func TestMarshalUnmarshalRepeatedExtension(t *testing.T) {
function TestUnmarshalRepeatingNonRepeatedExtension (line 411) | func TestUnmarshalRepeatingNonRepeatedExtension(t *testing.T) {
function TestClearAllExtensions (line 486) | func TestClearAllExtensions(t *testing.T) {
function TestMarshalRace (line 511) | func TestMarshalRace(t *testing.T) {
FILE: vendor/github.com/golang/protobuf/proto/lib.go
type Message (line 277) | type Message interface
type Stats (line 285) | type Stats struct
constant collectStats (line 296) | collectStats = false
function GetStats (line 301) | func GetStats() Stats { return stats }
type Buffer (line 308) | type Buffer struct
method Reset (line 331) | func (p *Buffer) Reset() {
method SetBuf (line 338) | func (p *Buffer) SetBuf(s []byte) {
method Bytes (line 344) | func (p *Buffer) Bytes() []byte { return p.buf }
method DebugPrint (line 446) | func (p *Buffer) DebugPrint(s string, b []byte) {
function NewBuffer (line 326) | func NewBuffer(e []byte) *Buffer {
function Bool (line 352) | func Bool(v bool) *bool {
function Int32 (line 358) | func Int32(v int32) *int32 {
function Int (line 365) | func Int(v int) *int32 {
function Int64 (line 373) | func Int64(v int64) *int64 {
function Float32 (line 379) | func Float32(v float32) *float32 {
function Float64 (line 385) | func Float64(v float64) *float64 {
function Uint32 (line 391) | func Uint32(v uint32) *uint32 {
function Uint64 (line 397) | func Uint64(v uint64) *uint64 {
function String (line 403) | func String(v string) *string {
function EnumName (line 409) | func EnumName(m map[int32]string, v int32) string {
function UnmarshalJSONEnum (line 423) | func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string)...
function SetDefaults (line 551) | func SetDefaults(pb Message) {
function setDefaults (line 556) | func setDefaults(v reflect.Value, recur, zeros bool) {
type defaultMessage (line 698) | type defaultMessage struct
type scalarField (line 703) | type scalarField struct
function buildDefaultMessage (line 710) | func buildDefaultMessage(t reflect.Type) (dm defaultMessage) {
function fieldDefault (line 739) | func fieldDefault(ft reflect.Type, prop *Properties) (sf *scalarField, n...
function mapKeys (line 839) | func mapKeys(vs []reflect.Value) sort.Interface {
type mapKeySorter (line 863) | type mapKeySorter struct
method Len (line 868) | func (s mapKeySorter) Len() int { return len(s.vs) }
method Swap (line 869) | func (s mapKeySorter) Swap(i, j int) { s.vs[i], s.vs[j] = s.vs[j], s.v...
method Less (line 870) | func (s mapKeySorter) Less(i, j int) bool {
function isProto3Zero (line 875) | func isProto3Zero(v reflect.Value) bool {
constant ProtoPackageIsVersion2 (line 893) | ProtoPackageIsVersion2 = true
constant ProtoPackageIsVersion1 (line 897) | ProtoPackageIsVersion1 = true
FILE: vendor/github.com/golang/protobuf/proto/map_test.go
function marshalled (line 11) | func marshalled() []byte {
function BenchmarkConcurrentMapUnmarshal (line 25) | func BenchmarkConcurrentMapUnmarshal(b *testing.B) {
function BenchmarkSequentialMapUnmarshal (line 37) | func BenchmarkSequentialMapUnmarshal(b *testing.B) {
FILE: vendor/github.com/golang/protobuf/proto/message_set.go
type _MessageSet_Item (line 62) | type _MessageSet_Item struct
type messageSet (line 67) | type messageSet struct
method find (line 82) | func (ms *messageSet) find(pb Message) *_MessageSet_Item {
method Has (line 96) | func (ms *messageSet) Has(pb Message) bool {
method Unmarshal (line 103) | func (ms *messageSet) Unmarshal(pb Message) error {
method Marshal (line 113) | func (ms *messageSet) Marshal(pb Message) error {
method Reset (line 137) | func (ms *messageSet) Reset() { *ms = messageSet{} }
method String (line 138) | func (ms *messageSet) String() string { return CompactTextString(ms) }
method ProtoMessage (line 139) | func (*messageSet) ProtoMessage() {}
type messageTypeIder (line 78) | type messageTypeIder interface
function skipVarint (line 143) | func skipVarint(buf []byte) []byte {
function MarshalMessageSet (line 152) | func MarshalMessageSet(exts interface{}) ([]byte, error) {
function UnmarshalMessageSet (line 193) | func UnmarshalMessageSet(buf []byte, exts interface{}) error {
function MarshalMessageSetJSON (line 234) | func MarshalMessageSetJSON(exts interface{}) ([]byte, error) {
function UnmarshalMessageSetJSON (line 286) | func UnmarshalMessageSetJSON(buf []byte, exts interface{}) error {
type messageSetDesc (line 300) | type messageSetDesc struct
function RegisterMessageSetType (line 306) | func RegisterMessageSetType(m Message, fieldNum int32, name string) {
FILE: vendor/github.com/golang/protobuf/proto/message_set_test.go
function TestUnmarshalMessageSetWithDuplicate (line 39) | func TestUnmarshalMessageSetWithDuplicate(t *testing.T) {
FILE: vendor/github.com/golang/protobuf/proto/pointer_reflect.go
type structPointer (line 46) | type structPointer struct
function toStructPointer (line 52) | func toStructPointer(v reflect.Value) structPointer {
function structPointer_IsNil (line 57) | func structPointer_IsNil(p structPointer) bool {
function structPointer_Interface (line 62) | func structPointer_Interface(p structPointer, _ reflect.Type) interface{} {
type field (line 69) | type field
method IsValid (line 80) | func (f field) IsValid() bool { return f != nil }
function toField (line 72) | func toField(f *reflect.StructField) field {
function structPointer_field (line 83) | func structPointer_field(p structPointer, f field) reflect.Value {
function structPointer_ifield (line 98) | func structPointer_ifield(p structPointer, f field) interface{} {
function structPointer_Bytes (line 103) | func structPointer_Bytes(p structPointer, f field) *[]byte {
function structPointer_BytesSlice (line 108) | func structPointer_BytesSlice(p structPointer, f field) *[][]byte {
function structPointer_Bool (line 113) | func structPointer_Bool(p structPointer, f field) **bool {
function structPointer_BoolVal (line 118) | func structPointer_BoolVal(p structPointer, f field) *bool {
function structPointer_BoolSlice (line 123) | func structPointer_BoolSlice(p structPointer, f field) *[]bool {
function structPointer_String (line 128) | func structPointer_String(p structPointer, f field) **string {
function structPointer_StringVal (line 133) | func structPointer_StringVal(p structPointer, f field) *string {
function structPointer_StringSlice (line 138) | func structPointer_StringSlice(p structPointer, f field) *[]string {
function structPointer_Extensions (line 143) | func structPointer_Extensions(p structPointer, f field) *XXX_InternalExt...
function structPointer_ExtMap (line 148) | func structPointer_ExtMap(p structPointer, f field) *map[int32]Extension {
function structPointer_NewAt (line 153) | func structPointer_NewAt(p structPointer, f field, typ reflect.Type) ref...
function structPointer_SetStructPointer (line 158) | func structPointer_SetStructPointer(p structPointer, f field, q structPo...
function structPointer_GetStructPointer (line 163) | func structPointer_GetStructPointer(p structPointer, f field) structPoin...
function structPointer_StructPointerSlice (line 168) | func structPointer_StructPointerSlice(p structPointer, f field) structPo...
type structPointerSlice (line 174) | type structPointerSlice struct
method Len (line 178) | func (p structPointerSlice) Len() int { return p.v.Le...
method Index (line 179) | func (p structPointerSlice) Index(i int) structPointer { return struct...
method Append (line 180) | func (p structPointerSlice) Append(q structPointer) {
type word32 (line 195) | type word32 struct
function word32_IsNil (line 200) | func word32_IsNil(p word32) bool {
function word32_Set (line 205) | func word32_Set(p word32, o *Buffer, x uint32) {
function word32_Get (line 240) | func word32_Get(p word32) uint32 {
function structPointer_Word32 (line 254) | func structPointer_Word32(p structPointer, f field) word32 {
type word32Val (line 260) | type word32Val struct
function word32Val_Set (line 265) | func word32Val_Set(p word32Val, x uint32) {
function word32Val_Get (line 283) | func word32Val_Get(p word32Val) uint32 {
function structPointer_Word32Val (line 297) | func structPointer_Word32Val(p structPointer, f field) word32Val {
type word32Slice (line 303) | type word32Slice struct
method Append (line 307) | func (p word32Slice) Append(x uint32) {
method Len (line 326) | func (p word32Slice) Len() int {
method Index (line 330) | func (p word32Slice) Index(i int) uint32 {
function structPointer_Word32Slice (line 344) | func structPointer_Word32Slice(p structPointer, f field) word32Slice {
type word64 (line 349) | type word64 struct
function word64_Set (line 353) | func word64_Set(p word64, o *Buffer, x uint64) {
function word64_IsNil (line 384) | func word64_IsNil(p word64) bool {
function word64_Get (line 388) | func word64_Get(p word64) uint64 {
function structPointer_Word64 (line 401) | func structPointer_Word64(p structPointer, f field) word64 {
type word64Val (line 406) | type word64Val struct
function word64Val_Set (line 410) | func word64Val_Set(p word64Val, o *Buffer, x uint64) {
function word64Val_Get (line 425) | func word64Val_Get(p word64Val) uint64 {
function structPointer_Word64Val (line 438) | func structPointer_Word64Val(p structPointer, f field) word64Val {
type word64Slice (line 442) | type word64Slice struct
method Append (line 446) | func (p word64Slice) Append(x uint64) {
method Len (line 465) | func (p word64Slice) Len() int {
method Index (line 469) | func (p word64Slice) Index(i int) uint64 {
function structPointer_Word64Slice (line 482) | func structPointer_Word64Slice(p structPointer, f field) word64Slice {
FILE: vendor/github.com/golang/protobuf/proto/pointer_unsafe.go
type structPointer (line 53) | type structPointer
function toStructPointer (line 56) | func toStructPointer(v reflect.Value) structPointer {
function structPointer_IsNil (line 61) | func structPointer_IsNil(p structPointer) bool {
function structPointer_Interface (line 67) | func structPointer_Interface(p structPointer, t reflect.Type) interface{} {
type field (line 73) | type field
method IsValid (line 84) | func (f field) IsValid() bool {
function toField (line 76) | func toField(f *reflect.StructField) field {
constant invalidField (line 81) | invalidField = ^field(0)
function structPointer_Bytes (line 89) | func structPointer_Bytes(p structPointer, f field) *[]byte {
function structPointer_BytesSlice (line 94) | func structPointer_BytesSlice(p structPointer, f field) *[][]byte {
function structPointer_Bool (line 99) | func structPointer_Bool(p structPointer, f field) **bool {
function structPointer_BoolVal (line 104) | func structPointer_BoolVal(p structPointer, f field) *bool {
function structPointer_BoolSlice (line 109) | func structPointer_BoolSlice(p structPointer, f field) *[]bool {
function structPointer_String (line 114) | func structPointer_String(p structPointer, f field) **string {
function structPointer_StringVal (line 119) | func structPointer_StringVal(p structPointer, f field) *string {
function structPointer_StringSlice (line 124) | func structPointer_StringSlice(p structPointer, f field) *[]string {
function structPointer_Extensions (line 129) | func structPointer_Extensions(p structPointer, f field) *XXX_InternalExt...
function structPointer_ExtMap (line 133) | func structPointer_ExtMap(p structPointer, f field) *map[int32]Extension {
function structPointer_NewAt (line 138) | func structPointer_NewAt(p structPointer, f field, typ reflect.Type) ref...
function structPointer_SetStructPointer (line 143) | func structPointer_SetStructPointer(p structPointer, f field, q structPo...
function structPointer_GetStructPointer (line 148) | func structPointer_GetStructPointer(p structPointer, f field) structPoin...
function structPointer_StructPointerSlice (line 153) | func structPointer_StructPointerSlice(p structPointer, f field) *structP...
type structPointerSlice (line 158) | type structPointerSlice
method Len (line 160) | func (v *structPointerSlice) Len() int { return len(*...
method Index (line 161) | func (v *structPointerSlice) Index(i int) structPointer { return (*v)[...
method Append (line 162) | func (v *structPointerSlice) Append(p structPointer) { *v = append(...
type word32 (line 165) | type word32
function word32_IsNil (line 168) | func word32_IsNil(p word32) bool {
function word32_Set (line 173) | func word32_Set(p word32, o *Buffer, x uint32) {
function word32_Get (line 183) | func word32_Get(p word32) uint32 {
function structPointer_Word32 (line 188) | func structPointer_Word32(p structPointer, f field) word32 {
type word32Val (line 193) | type word32Val
function word32Val_Set (line 196) | func word32Val_Set(p word32Val, x uint32) {
function word32Val_Get (line 201) | func word32Val_Get(p word32Val) uint32 {
function structPointer_Word32Val (line 206) | func structPointer_Word32Val(p structPointer, f field) word32Val {
type word32Slice (line 211) | type word32Slice
method Append (line 213) | func (v *word32Slice) Append(x uint32) { *v = append(*v, x) }
method Len (line 214) | func (v *word32Slice) Len() int { return len(*v) }
method Index (line 215) | func (v *word32Slice) Index(i int) uint32 { return (*v)[i] }
function structPointer_Word32Slice (line 218) | func structPointer_Word32Slice(p structPointer, f field) *word32Slice {
type word64 (line 223) | type word64
function word64_Set (line 225) | func word64_Set(p word64, o *Buffer, x uint64) {
function word64_IsNil (line 234) | func word64_IsNil(p word64) bool {
function word64_Get (line 238) | func word64_Get(p word64) uint64 {
function structPointer_Word64 (line 242) | func structPointer_Word64(p structPointer, f field) word64 {
type word64Val (line 247) | type word64Val
function word64Val_Set (line 249) | func word64Val_Set(p word64Val, o *Buffer, x uint64) {
function word64Val_Get (line 253) | func word64Val_Get(p word64Val) uint64 {
function structPointer_Word64Val (line 257) | func structPointer_Word64Val(p structPointer, f field) word64Val {
type word64Slice (line 262) | type word64Slice
method Append (line 264) | func (v *word64Slice) Append(x uint64) { *v = append(*v, x) }
method Len (line 265) | func (v *word64Slice) Len() int { return len(*v) }
method Index (line 266) | func (v *word64Slice) Index(i int) uint64 { return (*v)[i] }
function structPointer_Word64Slice (line 268) | func structPointer_Word64Slice(p structPointer, f field) *word64Slice {
FILE: vendor/github.com/golang/protobuf/proto/properties.go
constant debug (line 49) | debug bool = false
constant WireVarint (line 53) | WireVarint = 0
constant WireFixed64 (line 54) | WireFixed64 = 1
constant WireBytes (line 55) | WireBytes = 2
constant WireStartGroup (line 56) | WireStartGroup = 3
constant WireEndGroup (line 57) | WireEndGroup = 4
constant WireFixed32 (line 58) | WireFixed32 = 5
constant startSize (line 61) | startSize = 10
type encoder (line 66) | type encoder
type valueEncoder (line 69) | type valueEncoder
type sizer (line 74) | type sizer
type valueSizer (line 78) | type valueSizer
type decoder (line 83) | type decoder
type valueDecoder (line 86) | type valueDecoder
type oneofMarshaler (line 89) | type oneofMarshaler
type oneofUnmarshaler (line 92) | type oneofUnmarshaler
type oneofSizer (line 95) | type oneofSizer
type tagMap (line 100) | type tagMap struct
method get (line 109) | func (p *tagMap) get(t int) (int, bool) {
method put (line 121) | func (p *tagMap) put(t int, fi int) {
constant tagMapFastLimit (line 107) | tagMapFastLimit = 1024
type StructProperties (line 137) | type StructProperties struct
method Len (line 166) | func (sp *StructProperties) Len() int { return len(sp.order) }
method Less (line 167) | func (sp *StructProperties) Less(i, j int) bool {
method Swap (line 170) | func (sp *StructProperties) Swap(i, j int) { sp.order[i], sp.order[j] ...
type OneofProperties (line 157) | type OneofProperties struct
type Properties (line 173) | type Properties struct
method String (line 217) | func (p *Properties) String() string {
method Parse (line 253) | func (p *Properties) Parse(s string) {
method setEncAndDec (line 342) | func (p *Properties) setEncAndDec(typ reflect.Type, f *reflect.StructF...
method Init (line 616) | func (p *Properties) Init(typ reflect.Type, name, tag string, f *refle...
method init (line 620) | func (p *Properties) init(typ reflect.Type, name, tag string, f *refle...
function logNoSliceEnc (line 335) | func logNoSliceEnc(t1, t2 reflect.Type) {
function isMarshaler (line 594) | func isMarshaler(t reflect.Type) bool {
function isUnmarshaler (line 605) | func isUnmarshaler(t reflect.Type) bool {
function GetProperties (line 641) | func GetProperties(t reflect.Type) *StructProperties {
function getPropertiesLocked (line 665) | func getPropertiesLocked(t reflect.Type) *StructProperties {
function propByIndex (line 783) | func propByIndex(t reflect.Type, x []int) *Properties {
function getbase (line 793) | func getbase(pb Message) (t reflect.Type, b structPointer, err error) {
function RegisterEnum (line 813) | func RegisterEnum(typeName string, unusedNameMap map[int32]string, value...
function EnumValueMap (line 822) | func EnumValueMap(enumType string) map[string]int32 {
function RegisterType (line 835) | func RegisterType(x Message, name string) {
function MessageName (line 847) | func MessageName(x Message) string {
function MessageType (line 858) | func MessageType(name string) reflect.Type { return protoTypes[name] }
function RegisterFile (line 867) | func RegisterFile(filename string, fileDescriptor []byte) {
function FileDescriptor (line 872) | func FileDescriptor(filename string) []byte { return protoFiles[filename] }
FILE: vendor/github.com/golang/protobuf/proto/proto3_test.go
function TestProto3ZeroValues (line 42) | func TestProto3ZeroValues(t *testing.T) {
function TestRoundTripProto3 (line 62) | func TestRoundTripProto3(t *testing.T) {
function TestGettersForBasicTypesExist (line 96) | func TestGettersForBasicTypesExist(t *testing.T) {
function TestProto3SetDefaults (line 106) | func TestProto3SetDefaults(t *testing.T) {
FILE: vendor/github.com/golang/protobuf/proto/size2_test.go
function TestVarintSize (line 42) | func TestVarintSize(t *testing.T) {
FILE: vendor/github.com/golang/protobuf/proto/size_test.go
function init (line 49) | func init() {
function TestSize (line 151) | func TestSize(t *testing.T) {
FILE: vendor/github.com/golang/protobuf/proto/text.go
type writer (line 65) | type writer interface
type textWriter (line 71) | type textWriter struct
method WriteString (line 78) | func (w *textWriter) WriteString(s string) (n int, err error) {
method Write (line 92) | func (w *textWriter) Write(p []byte) (n int, err error) {
method WriteByte (line 141) | func (w *textWriter) WriteByte(c byte) error {
method indent (line 153) | func (w *textWriter) indent() { w.ind++ }
method unindent (line 155) | func (w *textWriter) unindent() {
method writeIndent (line 763) | func (w *textWriter) writeIndent() {
function writeName (line 163) | func writeName(w *textWriter, props *Properties) error {
type raw (line 174) | type raw interface
function requiresQuotes (line 178) | func requiresQuotes(u string) bool {
function isAny (line 198) | func isAny(sv reflect.Value) bool {
function writeRaw (line 468) | func writeRaw(w *textWriter, b []byte) error {
function isprint (line 561) | func isprint(c byte) bool {
function writeString (line 570) | func writeString(w *textWriter, s string) error {
function writeUnknownStruct (line 606) | func writeUnknownStruct(w *textWriter, data []byte) (err error) {
function writeUnknownInt (line 673) | func writeUnknownInt(w *textWriter, x uint64, err error) error {
type int32Slice (line 682) | type int32Slice
method Len (line 684) | func (s int32Slice) Len() int { return len(s) }
method Less (line 685) | func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] }
method Swap (line 686) | func (s int32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
type TextMarshaler (line 780) | type TextMarshaler struct
method writeProto3Any (line 213) | func (tm *TextMarshaler) writeProto3Any(w *textWriter, sv reflect.Valu...
method writeStruct (line 259) | func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) ...
method writeAny (line 489) | func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, prop...
method writeExtensions (line 690) | func (tm *TextMarshaler) writeExtensions(w *textWriter, pv reflect.Val...
method writeExtension (line 745) | func (tm *TextMarshaler) writeExtension(w *textWriter, name string, pb...
method Marshal (line 787) | func (tm *TextMarshaler) Marshal(w io.Writer, pb Message) error {
method Text (line 830) | func (tm *TextMarshaler) Text(pb Message) string {
function MarshalText (line 845) | func MarshalText(w io.Writer, pb Message) error { return defaultTextMars...
function MarshalTextString (line 848) | func MarshalTextString(pb Message) string { return defaultTextMarshaler....
function CompactText (line 851) | func CompactText(w io.Writer, pb Message) error { return compactTextMars...
function CompactTextString (line 854) | func CompactTextString(pb Message) string { return compactTextMarshaler....
FILE: vendor/github.com/golang/protobuf/proto/text_parser.go
constant anyRepeatedlyUnpacked (line 48) | anyRepeatedlyUnpacked = "Any message unpacked multiple times, or %q alre...
type ParseError (line 50) | type ParseError struct
method Error (line 56) | func (p *ParseError) Error() string {
type token (line 64) | type token struct
method String (line 72) | func (t *token) String() string {
type textParser (line 79) | type textParser struct
method errorf (line 95) | func (p *textParser) errorf(format string, a ...interface{}) *ParseErr...
method skipWhitespace (line 133) | func (p *textParser) skipWhitespace() {
method advance (line 157) | func (p *textParser) advance() {
method back (line 336) | func (p *textParser) back() { p.backed = true }
method next (line 339) | func (p *textParser) next() *token {
method consumeToken (line 369) | func (p *textParser) consumeToken(s string) error {
method missingRequiredFieldError (line 382) | func (p *textParser) missingRequiredFieldError(sv reflect.Value) *Requ...
method checkForColon (line 409) | func (p *textParser) checkForColon(props *Properties, typ reflect.Type...
method readStruct (line 449) | func (p *textParser) readStruct(sv reflect.Value, terminator string) e...
method consumeExtName (line 708) | func (p *textParser) consumeExtName() (string, error) {
method consumeOptionalSeparator (line 737) | func (p *textParser) consumeOptionalSeparator() error {
method readAny (line 748) | func (p *textParser) readAny(v reflect.Value, props *Properties) error {
function newTextParser (line 87) | func newTextParser(s string) *textParser {
function isIdentOrNumberChar (line 103) | func isIdentOrNumberChar(c byte) bool {
function isWhitespace (line 117) | func isWhitespace(c byte) bool {
function isQuote (line 125) | func isQuote(c byte) bool {
function unquoteC (line 212) | func unquoteC(s string, quote rune) (string, error) {
function unescape (line 255) | func unescape(s string) (ch string, tail string, err error) {
function unhex (line 322) | func unhex(b byte) (v byte, ok bool) {
function structFieldByName (line 399) | func structFieldByName(sprops *StructProperties, name string) (int, *Pro...
function UnmarshalText (line 884) | func UnmarshalText(s string, pb Message) error {
FILE: vendor/github.com/golang/protobuf/proto/text_parser_test.go
type UnmarshalTextTest (line 44) | type UnmarshalTextTest struct
function buildExtStructTest (line 50) | func buildExtStructTest(text string) UnmarshalTextTest {
function buildExtDataTest (line 60) | func buildExtDataTest(text string) UnmarshalTextTest {
function buildExtRepStringTest (line 69) | func buildExtRepStringTest(text string) UnmarshalTextTest {
function TestUnmarshalText (line 529) | func TestUnmarshalText(t *testing.T) {
function TestUnmarshalTextCustomMessage (line 556) | func TestUnmarshalTextCustomMessage(t *testing.T) {
function TestRepeatedEnum (line 567) | func TestRepeatedEnum(t *testing.T) {
function TestProto3TextParsing (line 580) | func TestProto3TextParsing(t *testing.T) {
function TestMapParsing (line 595) | func TestMapParsing(t *testing.T) {
function TestOneofParsing (line 628) | func TestOneofParsing(t *testing.T) {
function init (line 653) | func init() {
function BenchmarkUnmarshalText (line 667) | func BenchmarkUnmarshalText(b *testing.B) {
FILE: vendor/github.com/golang/protobuf/proto/text_test.go
type textMessage (line 50) | type textMessage struct
method MarshalText (line 53) | func (*textMessage) MarshalText() ([]byte, error) {
method UnmarshalText (line 57) | func (*textMessage) UnmarshalText(bytes []byte) error {
method Reset (line 64) | func (*textMessage) Reset() {}
method String (line 65) | func (*textMessage) String() string { return "" }
method ProtoMessage (line 66) | func (*textMessage) ProtoMessage() {}
function newTestMessage (line 68) | func newTestMessage() *pb.MyMessage {
constant text (line 126) | text = `count: 42
function TestMarshalText (line 166) | func TestMarshalText(t *testing.T) {
function TestMarshalTextCustomMessage (line 177) | func TestMarshalTextCustomMessage(t *testing.T) {
function TestMarshalTextNil (line 187) | func TestMarshalTextNil(t *testing.T) {
function TestMarshalTextUnknownEnum (line 201) | func TestMarshalTextUnknownEnum(t *testing.T) {
function TestTextOneof (line 211) | func TestTextOneof(t *testing.T) {
function BenchmarkMarshalTextBuffered (line 235) | func BenchmarkMarshalTextBuffered(b *testing.B) {
function BenchmarkMarshalTextUnbuffered (line 244) | func BenchmarkMarshalTextUnbuffered(b *testing.B) {
function compact (line 252) | func compact(src string) string {
function TestCompactText (line 299) | func TestCompactText(t *testing.T) {
function TestStringEscaping (line 306) | func TestStringEscaping(t *testing.T) {
type limitedWriter (line 356) | type limitedWriter struct
method Write (line 363) | func (w *limitedWriter) Write(p []byte) (n int, err error) {
function TestMarshalTextFailing (line 375) | func TestMarshalTextFailing(t *testing.T) {
function TestFloats (line 393) | func TestFloats(t *testing.T) {
function TestRepeatedNilText (line 414) | func TestRepeatedNilText(t *testing.T) {
function TestProto3Text (line 435) | func TestProto3Text(t *testing.T) {
FILE: vendor/github.com/influxdata/kapacitor/alert.go
constant statsAlertsTriggered (line 38) | statsAlertsTriggered = "alerts_triggered"
constant statsOKsTriggered (line 39) | statsOKsTriggered = "oks_triggered"
constant statsInfosTriggered (line 40) | statsInfosTriggered = "infos_triggered"
constant statsWarnsTriggered (line 41) | statsWarnsTriggered = "warns_triggered"
constant statsCritsTriggered (line 42) | statsCritsTriggered = "crits_triggered"
constant statsEventsDropped (line 43) | statsEventsDropped = "events_dropped"
constant weightDiff (line 47) | weightDiff = 1.5
constant maxWeight (line 50) | maxWeight = 1.2
type AlertNode (line 52) | type AlertNode struct
method runAlert (line 463) | func (n *AlertNode) runAlert([]byte) error {
method NewGroup (line 516) | func (n *AlertNode) NewGroup(group edge.GroupInfo, first edge.PointMet...
method restoreEventState (line 534) | func (n *AlertNode) restoreEventState(id string, t time.Time) *alertSt...
method newAlertState (line 546) | func (n *AlertNode) newAlertState() *alertState {
method restoreEvent (line 554) | func (n *AlertNode) restoreEvent(id string) (alert.Level, time.Time) {
method hasAnonTopic (line 604) | func (n *AlertNode) hasAnonTopic() bool {
method hasTopic (line 607) | func (n *AlertNode) hasTopic() bool {
method handleEvent (line 611) | func (n *AlertNode) handleEvent(event alert.Event) {
method determineLevel (line 648) | func (n *AlertNode) determineLevel(p edge.FieldsTagsTimeGetter, curren...
method findFirstMatchLevel (line 666) | func (n *AlertNode) findFirstMatchLevel(start alert.Level, stop alert....
method event (line 686) | func (n *AlertNode) event(
method serverInfo (line 1055) | func (n *AlertNode) serverInfo() serverInfo {
method renderID (line 1063) | func (n *AlertNode) renderID(name string, group models.GroupID, tags m...
method renderMessageAndDetails (line 1088) | func (n *AlertNode) renderMessageAndDetails(id, name string, t time.Ti...
function newAlertNode (line 78) | func newAlertNode(et *ExecutingTask, n *pipeline.AlertNode, l *log.Logge...
function deleteAlertHook (line 598) | func deleteAlertHook(anonTopic string) deleteHook {
type alertState (line 722) | type alertState struct
method BeginBatch (line 741) | func (a *alertState) BeginBatch(begin edge.BeginBatchMessage) (edge.Me...
method BatchPoint (line 745) | func (a *alertState) BatchPoint(bp edge.BatchPointMessage) (edge.Messa...
method EndBatch (line 749) | func (a *alertState) EndBatch(end edge.EndBatchMessage) (edge.Message,...
method BufferedBatch (line 753) | func (a *alertState) BufferedBatch(b edge.BufferedBatchMessage) (edge....
method Point (line 845) | func (a *alertState) Point(p edge.PointMessage) (edge.Message, error) {
method augmentTagsWithEventState (line 892) | func (a *alertState) augmentTagsWithEventState(p edge.TagSetter, event...
method augmentFieldsWithEventState (line 905) | func (a *alertState) augmentFieldsWithEventState(p edge.FieldSetter, e...
method Barrier (line 924) | func (a *alertState) Barrier(b edge.BarrierMessage) (edge.Message, err...
method DeleteGroup (line 927) | func (a *alertState) DeleteGroup(d edge.DeleteGroupMessage) (edge.Mess...
method duration (line 932) | func (a *alertState) duration() time.Duration {
method triggered (line 937) | func (a *alertState) triggered(t time.Time) {
method addEvent (line 951) | func (a *alertState) addEvent(t time.Time, level alert.Level) {
method currentLevel (line 964) | func (a *alertState) currentLevel() alert.Level {
method percentChange (line 969) | func (a *alertState) percentChange() float64 {
method updateFlapping (line 993) | func (a *alertState) updateFlapping() {
method updateExpired (line 1005) | func (a *alertState) updateExpired(t time.Time) {
type serverInfo (line 1009) | type serverInfo struct
type idInfo (line 1016) | type idInfo struct
type messageInfo (line 1033) | type messageInfo struct
type detailsInfo (line 1049) | type detailsInfo struct
FILE: vendor/github.com/influxdata/kapacitor/autoscale.go
constant statsAutoscaleIncreaseEventsCount (line 20) | statsAutoscaleIncreaseEventsCount = "increase_events"
constant statsAutoscaleDecreaseEventsCount (line 21) | statsAutoscaleDecreaseEventsCount = "decrease_events"
constant statsAutoscaleCooldownDropsCount (line 22) | statsAutoscaleCooldownDropsCount = "cooldown_drops"
type resourceID (line 25) | type resourceID interface
type autoscaler (line 29) | type autoscaler interface
type resourceState (line 36) | type resourceState struct
type event (line 42) | type event struct
type AutoscaleNode (line 48) | type AutoscaleNode struct
method runAutoscale (line 109) | func (n *AutoscaleNode) runAutoscale([]byte) error {
method NewGroup (line 126) | func (n *AutoscaleNode) NewGroup(group edge.GroupInfo, first edge.Poin...
method newGroup (line 133) | func (n *AutoscaleNode) newGroup() *autoscaleGroup {
method handlePoint (line 182) | func (n *AutoscaleNode) handlePoint(streamName string, dims models.Dim...
method applyEvent (line 286) | func (n *AutoscaleNode) applyEvent(e event) error {
method evalExpr (line 292) | func (n *AutoscaleNode) evalExpr(
function newAutoscaleNode (line 72) | func newAutoscaleNode(
type autoscaleGroup (line 140) | type autoscaleGroup struct
method BeginBatch (line 148) | func (g *autoscaleGroup) BeginBatch(begin edge.BeginBatchMessage) (edg...
method BatchPoint (line 153) | func (g *autoscaleGroup) BatchPoint(bp edge.BatchPointMessage) (edge.M...
method EndBatch (line 162) | func (g *autoscaleGroup) EndBatch(end edge.EndBatchMessage) (edge.Mess...
method Point (line 166) | func (g *autoscaleGroup) Point(p edge.PointMessage) (edge.Message, err...
method Barrier (line 175) | func (g *autoscaleGroup) Barrier(b edge.BarrierMessage) (edge.Message,...
method DeleteGroup (line 178) | func (g *autoscaleGroup) DeleteGroup(d edge.DeleteGroupMessage) (edge....
type k8sAutoscaler (line 321) | type k8sAutoscaler struct
method ResourceIDFromTags (line 379) | func (a *k8sAutoscaler) ResourceIDFromTags(tags models.Tags) (resource...
method getScale (line 407) | func (a *k8sAutoscaler) getScale(kid k8sResourceID) (*k8s.Scale, error) {
method Replicas (line 413) | func (a *k8sAutoscaler) Replicas(id resourceID) (int, error) {
method SetReplicas (line 422) | func (a *k8sAutoscaler) SetReplicas(id resourceID, replicas int) error {
method SetResourceIDOnTags (line 436) | func (a *k8sAutoscaler) SetResourceIDOnTags(id resourceID, tags models...
function newK8sAutoscaleNode (line 336) | func newK8sAutoscaleNode(et *ExecutingTask, n *pipeline.K8sAutoscaleNode...
type k8sResourceID (line 365) | type k8sResourceID struct
method ID (line 371) | func (id k8sResourceID) ID() string {
method String (line 375) | func (id k8sResourceID) String() string {
type swarmAutoscaler (line 453) | type swarmAutoscaler struct
method ResourceIDFromTags (line 496) | func (a *swarmAutoscaler) ResourceIDFromTags(tags models.Tags) (resour...
method Replicas (line 516) | func (a *swarmAutoscaler) Replicas(id resourceID) (int, error) {
method SetReplicas (line 526) | func (a *swarmAutoscaler) SetReplicas(id resourceID, replicas int) err...
method SetResourceIDOnTags (line 537) | func (a *swarmAutoscaler) SetResourceIDOnTags(id resourceID, tags mode...
function newSwarmAutoscaleNode (line 461) | func newSwarmAutoscaleNode(et *ExecutingTask, n *pipeline.SwarmAutoscale...
type swarmResourceID (line 490) | type swarmResourceID
method ID (line 492) | func (id swarmResourceID) ID() string {
FILE: vendor/github.com/influxdata/kapacitor/batch.go
constant statsBatchesQueried (line 20) | statsBatchesQueried = "batches_queried"
constant statsPointsQueried (line 21) | statsPointsQueried = "points_queried"
type BatchNode (line 24) | type BatchNode struct
method linkChild (line 38) | func (n *BatchNode) linkChild(c Node) error {
method addParentEdge (line 52) | func (n *BatchNode) addParentEdge(in edge.StatsEdge) {
method start (line 58) | func (n *BatchNode) start([]byte) {
method Wait (line 61) | func (n *BatchNode) Wait() error {
method DBRPs (line 67) | func (n *BatchNode) DBRPs() ([]DBRP, error) {
method Count (line 79) | func (n *BatchNode) Count() int {
method Start (line 83) | func (n *BatchNode) Start() {
method Abort (line 89) | func (n *BatchNode) Abort() {
method Queries (line 101) | func (n *BatchNode) Queries(start, stop time.Time) ([]BatchQueries, er...
method edot (line 120) | func (n *BatchNode) edot(*bytes.Buffer, bool) {}
method collectedCount (line 122) | func (n *BatchNode) collectedCount() (count int64) {
function newBatchNode (line 30) | func newBatchNode(et *ExecutingTask, n *pipeline.BatchNode, l *log.Logge...
type BatchQueries (line 95) | type BatchQueries struct
type QueryNode (line 129) | type QueryNode struct
method GroupByMeasurement (line 209) | func (n *QueryNode) GroupByMeasurement() bool {
method DBRPs (line 215) | func (n *QueryNode) DBRPs() ([]DBRP, error) {
method Start (line 219) | func (n *QueryNode) Start() {
method Abort (line 228) | func (n *QueryNode) Abort() {
method Cluster (line 232) | func (n *QueryNode) Cluster() string {
method Queries (line 236) | func (n *QueryNode) Queries(start, stop time.Time) ([]*Query, error) {
method doQuery (line 267) | func (n *QueryNode) doQuery(in edge.Edge) error {
method runBatch (line 341) | func (n *QueryNode) runBatch([]byte) error {
method stopBatch (line 386) | func (n *QueryNode) stopBatch() {
function newQueryNode (line 144) | func newQueryNode(et *ExecutingTask, n *pipeline.QueryNode, l *log.Logge...
type ticker (line 393) | type ticker interface
type timeTicker (line 400) | type timeTicker struct
method Start (line 422) | func (t *timeTicker) Start() <-chan time.Time {
method Stop (line 460) | func (t *timeTicker) Stop() {
method Next (line 472) | func (t *timeTicker) Next(now time.Time) time.Time {
function newTimeTicker (line 410) | func newTimeTicker(every time.Duration, align bool) *timeTicker {
type cronTicker (line 480) | type cronTicker struct
method Start (line 499) | func (c *cronTicker) Start() <-chan time.Time {
method Stop (line 518) | func (c *cronTicker) Stop() {
method Next (line 523) | func (c *cronTicker) Next(now time.Time) time.Time {
function newCronTicker (line 487) | func newCronTicker(cronExpr string) (*cronTicker, error) {
FILE: vendor/github.com/influxdata/kapacitor/build.py
function print_banner (line 104) | def print_banner():
function create_package_fs (line 118) | def create_package_fs(build_root):
function package_scripts (line 132) | def package_scripts(build_root, config_only=False):
function run_generate (line 150) | def run_generate():
function go_get (line 167) | def go_get():
function check_nochanges (line 174) | def check_nochanges():
function run_tests (line 186) | def run_tests(race, parallel, timeout, no_vet):
function package_udfs (line 222) | def package_udfs(version, dist_dir):
function package_python_udf (line 230) | def package_python_udf(version, dist_dir):
function run (line 269) | def run(command, allow_failure=False, shell=False, printOutput=False):
function create_temp_dir (line 308) | def create_temp_dir(prefix = None):
function increment_minor_version (line 316) | def increment_minor_version(version):
function get_current_version_tag (line 330) | def get_current_version_tag():
function get_current_version (line 336) | def get_current_version():
function get_current_commit (line 350) | def get_current_commit(short=False):
function get_current_branch (line 361) | def get_current_branch():
function local_changes (line 368) | def local_changes():
function get_system_arch (line 376) | def get_system_arch():
function get_system_platform (line 389) | def get_system_platform():
function get_go_version (line 397) | def get_go_version():
function check_path_for (line 406) | def check_path_for(b):
function check_environ (line 418) | def check_environ(build_dir = None):
function check_prereqs (line 430) | def check_prereqs():
function upload_packages (line 440) | def upload_packages(packages, bucket_name=None, overwrite=False):
function go_list (line 483) | def go_list(vendor=False, relative=False):
function build (line 509) | def build(version=None,
function generate_md5_from_file (line 608) | def generate_md5_from_file(path):
function generate_sig_from_file (line 617) | def generate_sig_from_file(path):
function package (line 631) | def package(build_output, pkg_name, version, nightly=False, iteration=1,...
function main (line 779) | def main(args):
FILE: vendor/github.com/influxdata/kapacitor/combine.go
type CombineNode (line 15) | type CombineNode struct
method runCombine (line 48) | func (n *CombineNode) runCombine([]byte) error {
method NewGroup (line 57) | func (n *CombineNode) NewGroup(group edge.GroupInfo, first edge.PointM...
function newCombineNode (line 26) | func newCombineNode(et *ExecutingTask, n *pipeline.CombineNode, l *log.L...
type combineBuffer (line 72) | type combineBuffer struct
method BeginBatch (line 84) | func (b *combineBuffer) BeginBatch(begin edge.BeginBatchMessage) error {
method BatchPoint (line 96) | func (b *combineBuffer) BatchPoint(bp edge.BatchPointMessage) error {
method EndBatch (line 103) | func (b *combineBuffer) EndBatch(end edge.EndBatchMessage) error {
method Point (line 113) | func (b *combineBuffer) Point(p edge.PointMessage) error {
method addPoint (line 120) | func (b *combineBuffer) addPoint(p edge.FieldsTagsTimeSetter) error {
method Barrier (line 136) | func (b *combineBuffer) Barrier(barrier edge.BarrierMessage) error {
method DeleteGroup (line 139) | func (b *combineBuffer) DeleteGroup(d edge.DeleteGroupMessage) error {
method combine (line 144) | func (b *combineBuffer) combine() error {
method merge (line 214) | func (b *combineBuffer) merge(points []edge.FieldsTagsTimeSetter, dime...
type combination (line 235) | type combination struct
method Do (line 241) | func (c combination) Do(n, k int, f func(indices []int) error) error {
method Count (line 280) | func (c combination) Count(n, k int64) int64 {
FILE: vendor/github.com/influxdata/kapacitor/combine_test.go
function Test_Combination_Count (line 8) | func Test_Combination_Count(t *testing.T) {
function Test_Combination_Do (line 50) | func Test_Combination_Do(t *testing.T) {
FILE: vendor/github.com/influxdata/kapacitor/default.go
constant statsFieldsDefaulted (line 13) | statsFieldsDefaulted = "fields_defaulted"
constant statsTagsDefaulted (line 14) | statsTagsDefaulted = "tags_defaulted"
type DefaultNode (line 17) | type DefaultNode struct
method runDefault (line 37) | func (n *DefaultNode) runDefault(snapshot []byte) error {
method BeginBatch (line 51) | func (n *DefaultNode) BeginBatch(begin edge.BeginBatchMessage) (edge.M...
method BatchPoint (line 58) | func (n *DefaultNode) BatchPoint(bp edge.BatchPointMessage) (edge.Mess...
method EndBatch (line 66) | func (n *DefaultNode) EndBatch(end edge.EndBatchMessage) (edge.Message...
method Point (line 70) | func (n *DefaultNode) Point(p edge.PointMessage) (edge.Message, error) {
method Barrier (line 78) | func (n *DefaultNode) Barrier(b edge.BarrierMessage) (edge.Message, er...
method DeleteGroup (line 81) | func (n *DefaultNode) DeleteGroup(d edge.DeleteGroupMessage) (edge.Mes...
method setDefaults (line 85) | func (n *DefaultNode) setDefaults(fields models.Fields, tags models.Ta...
function newDefaultNode (line 26) | func newDefaultNode(et *ExecutingTask, n *pipeline.DefaultNode, l *log.L...
FILE: vendor/github.com/influxdata/kapacitor/delete.go
constant statsFieldsDeleted (line 13) | statsFieldsDeleted = "fields_deleted"
constant statsTagsDeleted (line 14) | statsTagsDeleted = "tags_deleted"
type DeleteNode (line 17) | type DeleteNode struct
method runDelete (line 45) | func (n *DeleteNode) runDelete(snapshot []byte) error {
method BeginBatch (line 58) | func (n *DeleteNode) BeginBatch(begin edge.BeginBatchMessage) (edge.Me...
method BatchPoint (line 65) | func (n *DeleteNode) BatchPoint(bp edge.BatchPointMessage) (edge.Messa...
method EndBatch (line 73) | func (n *DeleteNode) EndBatch(end edge.EndBatchMessage) (edge.Message,...
method Point (line 77) | func (n *DeleteNode) Point(p edge.PointMessage) (edge.Message, error) {
method Barrier (line 89) | func (n *DeleteNode) Barrier(b edge.BarrierMessage) (edge.Message, err...
method DeleteGroup (line 92) | func (n *DeleteNode) DeleteGroup(d edge.DeleteGroupMessage) (edge.Mess...
method checkForDeletedDimension (line 97) | func (n *DeleteNode) checkForDeletedDimension(dimensions models.Dimens...
method deleteDimensions (line 106) | func (n *DeleteNode) deleteDimensions(dims models.Dimensions) models.D...
method doDeletes (line 119) | func (n *DeleteNode) doDeletes(fields models.Fields, tags models.Tags)...
function newDeleteNode (line 28) | func newDeleteNode(et *ExecutingTask, n *pipeline.DeleteNode, l *log.Log...
FILE: vendor/github.com/influxdata/kapacitor/derivative.go
type DerivativeNode (line 12) | type DerivativeNode struct
method runDerivative (line 28) | func (n *DerivativeNode) runDerivative([]byte) error {
method NewGroup (line 37) | func (n *DerivativeNode) NewGroup(group edge.GroupInfo, first edge.Poi...
method newGroup (line 44) | func (n *DerivativeNode) newGroup() *derivativeGroup {
method derivative (line 124) | func (n *DerivativeNode) derivative(prev, curr models.Fields, prevTime...
function newDerivativeNode (line 18) | func newDerivativeNode(et *ExecutingTask, n *pipeline.DerivativeNode, l ...
type derivativeGroup (line 50) | type derivativeGroup struct
method BeginBatch (line 55) | func (g *derivativeGroup) BeginBatch(begin edge.BeginBatchMessage) (ed...
method BatchPoint (line 64) | func (g *derivativeGroup) BatchPoint(bp edge.BatchPointMessage) (edge....
method EndBatch (line 73) | func (g *derivativeGroup) EndBatch(end edge.EndBatchMessage) (edge.Mes...
method Point (line 77) | func (g *derivativeGroup) Point(p edge.PointMessage) (edge.Message, er...
method doDerivative (line 88) | func (g *derivativeGroup) doDerivative(p edge.FieldsTagsTimeGetter, n ...
method Barrier (line 114) | func (g *derivativeGroup) Barrier(b edge.BarrierMessage) (edge.Message...
method DeleteGroup (line 117) | func (g *derivativeGroup) DeleteGroup(d edge.DeleteGroupMessage) (edge...
function numToFloat (line 156) | func numToFloat(num interface{}) (float64, bool) {
FILE: vendor/github.com/influxdata/kapacitor/edge.go
constant statCollected (line 16) | statCollected = "collected"
constant statEmitted (line 17) | statEmitted = "emitted"
constant defaultEdgeBufferSize (line 19) | defaultEdgeBufferSize = 1000
type Edge (line 24) | type Edge struct
method Close (line 55) | func (e *Edge) Close() error {
function newEdge (line 35) | func newEdge(taskName, parentName, childName string, t pipeline.EdgeType...
FILE: vendor/github.com/influxdata/kapacitor/eval.go
type EvalNode (line 16) | type EvalNode struct
method runEval (line 66) | func (n *EvalNode) runEval(snapshot []byte) error {
method NewGroup (line 77) | func (n *EvalNode) NewGroup(group edge.GroupInfo, first edge.PointMeta...
method newGroup (line 84) | func (n *EvalNode) newGroup() *evalGroup {
method eval (line 95) | func (n *EvalNode) eval(expressions []stateful.Expression, p edge.Fiel...
function newEvalNode (line 28) | func newEvalNode(et *ExecutingTask, n *pipeline.EvalNode, l *log.Logger)...
type evalGroup (line 179) | type evalGroup struct
method BeginBatch (line 184) | func (g *evalGroup) BeginBatch(begin edge.BeginBatchMessage) (edge.Mes...
method BatchPoint (line 190) | func (g *evalGroup) BatchPoint(bp edge.BatchPointMessage) (edge.Messag...
method EndBatch (line 198) | func (g *evalGroup) EndBatch(end edge.EndBatchMessage) (edge.Message, ...
method Point (line 202) | func (g *evalGroup) Point(p edge.PointMessage) (edge.Message, error) {
method doEval (line 210) | func (g *evalGroup) doEval(p edge.FieldsTagsTimeSetter) bool {
method Barrier (line 223) | func (g *evalGroup) Barrier(b edge.BarrierMessage) (edge.Message, erro...
method DeleteGroup (line 226) | func (g *evalGroup) DeleteGroup(d edge.DeleteGroupMessage) (edge.Messa...
FILE: vendor/github.com/influxdata/kapacitor/expr.go
function EvalPredicate (line 12) | func EvalPredicate(se stateful.Expression, scopePool stateful.ScopePool,...
function fillScope (line 29) | func fillScope(vars *stateful.Scope, referenceVariables []string, p edge...
FILE: vendor/github.com/influxdata/kapacitor/flatten.go
type FlattenNode (line 14) | type FlattenNode struct
method runFlatten (line 34) | func (n *FlattenNode) runFlatten([]byte) error {
method NewGroup (line 43) | func (n *FlattenNode) NewGroup(group edge.GroupInfo, first edge.PointM...
method flatten (line 187) | func (n *FlattenNode) flatten(points []edge.FieldsTagsTimeGetter) (mod...
function newFlattenNode (line 22) | func newFlattenNode(et *ExecutingTask, n *pipeline.FlattenNode, l *log.L...
type flattenBuffer (line 53) | type flattenBuffer struct
method BeginBatch (line 61) | func (b *flattenBuffer) BeginBatch(begin edge.BeginBatchMessage) error {
method BatchPoint (line 79) | func (b *flattenBuffer) BatchPoint(bp edge.BatchPointMessage) error {
method emitBatchPoint (line 98) | func (b *flattenBuffer) emitBatchPoint(t time.Time, fields models.Fiel...
method EndBatch (line 111) | func (b *flattenBuffer) EndBatch(end edge.EndBatchMessage) error {
method Point (line 132) | func (b *flattenBuffer) Point(p edge.PointMessage) error {
method addPoint (line 162) | func (b *flattenBuffer) addPoint(p edge.FieldsTagsTimeGetter) (next ti...
method Barrier (line 180) | func (b *flattenBuffer) Barrier(barrier edge.BarrierMessage) error {
method DeleteGroup (line 183) | func (b *flattenBuffer) DeleteGroup(d edge.DeleteGroupMessage) error {
FILE: vendor/github.com/influxdata/kapacitor/group_by.go
type GroupByNode (line 16) | type GroupByNode struct
method runGroupBy (line 47) | func (n *GroupByNode) runGroupBy([]byte) error {
method Point (line 63) | func (n *GroupByNode) Point(p edge.PointMessage) error {
method BeginBatch (line 77) | func (n *GroupByNode) BeginBatch(begin edge.BeginBatchMessage) error {
method BatchPoint (line 90) | func (n *GroupByNode) BatchPoint(bp edge.BatchPointMessage) error {
method EndBatch (line 117) | func (n *GroupByNode) EndBatch(end edge.EndBatchMessage) error {
method Barrier (line 121) | func (n *GroupByNode) Barrier(b edge.BarrierMessage) error {
method DeleteGroup (line 130) | func (n *GroupByNode) DeleteGroup(d edge.DeleteGroupMessage) error {
method emit (line 136) | func (n *GroupByNode) emit(t time.Time) error {
function newGroupByNode (line 34) | func newGroupByNode(et *ExecutingTask, n *pipeline.GroupByNode, l *log.L...
function determineTagNames (line 161) | func determineTagNames(dimensions []interface{}, excluded []string) (all...
function filterExcludedTagNames (line 175) | func filterExcludedTagNames(tagNames, excluded []string) []string {
function computeTagNames (line 192) | func computeTagNames(tags models.Tags, allDimensions bool, tagNames, exc...
FILE: vendor/github.com/influxdata/kapacitor/http_out.go
type HTTPOutNode (line 16) | type HTTPOutNode struct
method Endpoint (line 41) | func (n *HTTPOutNode) Endpoint() string {
method runOut (line 45) | func (n *HTTPOutNode) runOut([]byte) error {
method updateResultWithRow (line 90) | func (n *HTTPOutNode) updateResultWithRow(idx int, row *models.Row) {
method stopOut (line 101) | func (n *HTTPOutNode) stopOut() {
method NewGroup (line 107) | func (n *HTTPOutNode) NewGroup(group edge.GroupInfo, first edge.PointM...
method newGroup (line 114) | func (n *HTTPOutNode) newGroup(groupID models.GroupID) *httpOutGroup {
method deleteGroup (line 128) | func (n *HTTPOutNode) deleteGroup(idx int) {
function newHTTPOutNode (line 29) | func newHTTPOutNode(et *ExecutingTask, n *pipeline.HTTPOutNode, l *log.L...
type httpOutGroup (line 139) | type httpOutGroup struct
method BeginBatch (line 146) | func (g *httpOutGroup) BeginBatch(begin edge.BeginBatchMessage) (edge....
method BatchPoint (line 150) | func (g *httpOutGroup) BatchPoint(bp edge.BatchPointMessage) (edge.Mes...
method EndBatch (line 154) | func (g *httpOutGroup) EndBatch(end edge.EndBatchMessage) (edge.Messag...
method BufferedBatch (line 158) | func (g *httpOutGroup) BufferedBatch(batch edge.BufferedBatchMessage) ...
method Point (line 164) | func (g *httpOutGroup) Point(p edge.PointMessage) (edge.Message, error) {
method Barrier (line 170) | func (g *httpOutGroup) Barrier(b edge.BarrierMessage) (edge.Message, e...
method DeleteGroup (line 173) | func (g *httpOutGroup) DeleteGroup(d edge.DeleteGroupMessage) (edge.Me...
FILE: vendor/github.com/influxdata/kapacitor/http_post.go
type HTTPPostNode (line 17) | type HTTPPostNode struct
method runPost (line 54) | func (n *HTTPPostNode) runPost([]byte) error {
method NewGroup (line 65) | func (n *HTTPPostNode) NewGroup(group edge.GroupInfo, first edge.Point...
method postRow (line 112) | func (n *HTTPPostNode) postRow(row *models.Row) {
function newHTTPPostNode (line 26) | func newHTTPPostNode(et *ExecutingTask, n *pipeline.HTTPPostNode, l *log...
type httpPostGroup (line 76) | type httpPostGroup struct
method BeginBatch (line 81) | func (g *httpPostGroup) BeginBatch(begin edge.BeginBatchMessage) (edge...
method BatchPoint (line 85) | func (g *httpPostGroup) BatchPoint(bp edge.BatchPointMessage) (edge.Me...
method EndBatch (line 89) | func (g *httpPostGroup) EndBatch(end edge.EndBatchMessage) (edge.Messa...
method BufferedBatch (line 93) | func (g *httpPostGroup) BufferedBatch(batch edge.BufferedBatchMessage)...
method Point (line 99) | func (g *httpPostGroup) Point(p edge.PointMessage) (edge.Message, erro...
method Barrier (line 105) | func (g *httpPostGroup) Barrier(b edge.BarrierMessage) (edge.Message, ...
method DeleteGroup (line 108) | func (g *httpPostGroup) DeleteGroup(d edge.DeleteGroupMessage) (edge.M...
FILE: vendor/github.com/influxdata/kapacitor/influxdb_out.go
constant statsInfluxDBPointsWritten (line 18) | statsInfluxDBPointsWritten = "points_written"
constant statsInfluxDBWriteErrors (line 19) | statsInfluxDBWriteErrors = "write_errors"
type InfluxDBOutNode (line 22) | type InfluxDBOutNode struct
method runOut (line 53) | func (n *InfluxDBOutNode) runOut([]byte) error {
method BeginBatch (line 100) | func (n *InfluxDBOutNode) BeginBatch(begin edge.BeginBatchMessage) (ed...
method BatchPoint (line 104) | func (n *InfluxDBOutNode) BatchPoint(bp edge.BatchPointMessage) (edge....
method EndBatch (line 108) | func (n *InfluxDBOutNode) EndBatch(end edge.EndBatchMessage) (edge.Mes...
method BufferedBatch (line 112) | func (n *InfluxDBOutNode) BufferedBatch(batch edge.BufferedBatchMessag...
method Point (line 117) | func (n *InfluxDBOutNode) Point(p edge.PointMessage) (edge.Message, er...
method Barrier (line 139) | func (n *InfluxDBOutNode) Barrier(b edge.BarrierMessage) (edge.Message...
method DeleteGroup (line 142) | func (n *InfluxDBOutNode) DeleteGroup(d edge.DeleteGroupMessage) (edge...
method stopOut (line 146) | func (n *InfluxDBOutNode) stopOut() {
method write (line 151) | func (n *InfluxDBOutNode) write(db, rp string, batch edge.BufferedBatc...
function newInfluxDBOutNode (line 33) | func newInfluxDBOutNode(et *ExecutingTask, n *pipeline.InfluxDBOutNode, ...
type writeBuffer (line 194) | type writeBuffer struct
method enqueue (line 229) | func (w *writeBuffer) enqueue(bpc influxdb.BatchPointsConfig, points [...
method start (line 240) | func (w *writeBuffer) start() {
method flush (line 245) | func (w *writeBuffer) flush() {
method abort (line 250) | func (w *writeBuffer) abort() {
method run (line 255) | func (w *writeBuffer) run() {
method writeAll (line 297) | func (w *writeBuffer) writeAll() {
method write (line 308) | func (w *writeBuffer) write(bp influxdb.BatchPoints) error {
type queueEntry (line 211) | type queueEntry struct
function newWriteBuffer (line 216) | func newWriteBuffer(size int, flushInterval time.Duration, cli influxdb....
FILE: vendor/github.com/influxdata/kapacitor/influxql.gen.go
function convertFloatPoint (line 20) | func convertFloatPoint(
type floatPointAggregator (line 53) | type floatPointAggregator struct
method AggregatePoint (line 71) | func (a *floatPointAggregator) AggregatePoint(name string, p edge.Fiel...
function floatPopulateAuxFieldsAndTags (line 60) | func floatPopulateAuxFieldsAndTags(ap *influxql.FloatPoint, fieldsAndTag...
type floatPointEmitter (line 80) | type floatPointEmitter struct
method EmitPoint (line 87) | func (e *floatPointEmitter) EmitPoint() (edge.PointMessage, error) {
method EmitBatch (line 128) | func (e *floatPointEmitter) EmitBatch() edge.BufferedBatchMessage {
function convertIntegerPoint (line 178) | func convertIntegerPoint(
type integerPointAggregator (line 211) | type integerPointAggregator struct
method AggregatePoint (line 229) | func (a *integerPointAggregator) AggregatePoint(name string, p edge.Fi...
function integerPopulateAuxFieldsAndTags (line 218) | func integerPopulateAuxFieldsAndTags(ap *influxql.IntegerPoint, fieldsAn...
type integerPointEmitter (line 238) | type integerPointEmitter struct
method EmitPoint (line 245) | func (e *integerPointEmitter) EmitPoint() (edge.PointMessage, error) {
method EmitBatch (line 286) | func (e *integerPointEmitter) EmitBatch() edge.BufferedBatchMessage {
function convertStringPoint (line 336) | func convertStringPoint(
type stringPointAggregator (line 369) | type stringPointAggregator struct
method AggregatePoint (line 387) | func (a *stringPointAggregator) AggregatePoint(name string, p edge.Fie...
function stringPopulateAuxFieldsAndTags (line 376) | func stringPopulateAuxFieldsAndTags(ap *influxql.StringPoint, fieldsAndT...
type stringPointEmitter (line 396) | type stringPointEmitter struct
method EmitPoint (line 403) | func (e *stringPointEmitter) EmitPoint() (edge.PointMessage, error) {
method EmitBatch (line 444) | func (e *stringPointEmitter) EmitBatch() edge.BufferedBatchMessage {
function convertBooleanPoint (line 494) | func convertBooleanPoint(
type booleanPointAggregator (line 527) | type booleanPointAggregator struct
method AggregatePoint (line 545) | func (a *booleanPointAggregator) AggregatePoint(name string, p edge.Fi...
function booleanPopulateAuxFieldsAndTags (line 534) | func booleanPopulateAuxFieldsAndTags(ap *influxql.BooleanPoint, fieldsAn...
type booleanPointEmitter (line 554) | type booleanPointEmitter struct
method EmitPoint (line 561) | func (e *booleanPointEmitter) EmitPoint() (edge.PointMessage, error) {
method EmitBatch (line 602) | func (e *booleanPointEmitter) EmitBatch() edge.BufferedBatchMessage {
type floatReduceContext (line 653) | type floatReduceContext struct
type floatIntegerReduceContext (line 659) | type floatIntegerReduceContext struct
type floatStringReduceContext (line 665) | type floatStringReduceContext struct
type floatBooleanReduceContext (line 671) | type floatBooleanReduceContext struct
type integerFloatReduceContext (line 677) | type integerFloatReduceContext struct
type integerReduceContext (line 683) | type integerReduceContext struct
type integerStringReduceContext (line 689) | type integerStringReduceContext struct
type integerBooleanReduceContext (line 695) | type integerBooleanReduceContext struct
type stringFloatReduceContext (line 701) | type stringFloatReduceContext struct
type stringIntegerReduceContext (line 707) | type stringIntegerReduceContext struct
type stringReduceContext (line 713) | type stringReduceContext struct
type stringBooleanReduceContext (line 719) | type stringBooleanReduceContext struct
type booleanFloatReduceContext (line 725) | type booleanFloatReduceContext struct
type booleanIntegerReduceContext (line 731) | type booleanIntegerReduceContext struct
type booleanStringReduceContext (line 737) | type booleanStringReduceContext struct
type booleanReduceContext (line 743) | type booleanReduceContext struct
function determineReduceContextCreateFn (line 748) | func determineReduceContextCreateFn(method string, kind reflect.Kind, rc...
FILE: vendor/github.com/influxdata/kapacitor/influxql.go
type createReduceContextFunc (line 18) | type createReduceContextFunc
type InfluxQLNode (line 20) | type InfluxQLNode struct
method runInfluxQL (line 55) | func (n *InfluxQLNode) runInfluxQL([]byte) error {
method NewGroup (line 64) | func (n *InfluxQLNode) NewGroup(group edge.GroupInfo, first edge.Point...
method newGroup (line 71) | func (n *InfluxQLNode) newGroup(first edge.PointMeta) edge.ForwardRece...
method getCreateFn (line 291) | func (n *InfluxQLNode) getCreateFn(kind reflect.Kind) (createReduceCon...
method emit (line 305) | func (n *InfluxQLNode) emit(context reduceContext) (edge.Message, erro...
function newInfluxQLNode (line 29) | func newInfluxQLNode(et *ExecutingTask, n *pipeline.InfluxQLNode, l *log...
type reduceContext (line 39) | type reduceContext interface
type baseReduceContext (line 45) | type baseReduceContext struct
type influxqlGroup (line 92) | type influxqlGroup struct
method BeginBatch (line 103) | func (g *influxqlGroup) BeginBatch(begin edge.BeginBatchMessage) (edge...
method BatchPoint (line 111) | func (g *influxqlGroup) BatchPoint(bp edge.BatchPointMessage) (edge.Me...
method EndBatch (line 127) | func (g *influxqlGroup) EndBatch(end edge.EndBatchMessage) (edge.Messa...
method Point (line 147) | func (g *influxqlGroup) Point(p edge.PointMessage) (edge.Message, erro...
method aggregatePoint (line 175) | func (g *influxqlGroup) aggregatePoint(p edge.PointMessage) {
method getFieldKind (line 190) | func (g *influxqlGroup) getFieldKind(fields models.Fields) (reflect.Ki...
method realizeReduceContextFromFields (line 198) | func (g *influxqlGroup) realizeReduceContextFromFields(fields models.F...
method realizeReduceContext (line 206) | func (g *influxqlGroup) realizeReduceContext(kind reflect.Kind) error {
method Barrier (line 215) | func (g *influxqlGroup) Barrier(b edge.BarrierMessage) (edge.Message, ...
method DeleteGroup (line 218) | func (g *influxqlGroup) DeleteGroup(d edge.DeleteGroupMessage) (edge.M...
type influxqlStreamingTransformGroup (line 222) | type influxqlStreamingTransformGroup struct
method BeginBatch (line 226) | func (g *influxqlStreamingTransformGroup) BeginBatch(begin edge.BeginB...
method BatchPoint (line 234) | func (g *influxqlStreamingTransformGroup) BatchPoint(bp edge.BatchPoin...
method EndBatch (line 259) | func (g *influxqlStreamingTransformGroup) EndBatch(end edge.EndBatchMe...
method Point (line 263) | func (g *influxqlStreamingTransformGroup) Point(p edge.PointMessage) (...
method Barrier (line 287) | func (g *influxqlStreamingTransformGroup) Barrier(b edge.BarrierMessag...
FILE: vendor/github.com/influxdata/kapacitor/join.go
type JoinNode (line 17) | type JoinNode struct
method runJoin (line 70) | func (n *JoinNode) runJoin([]byte) error {
method BufferedBatch (line 83) | func (n *JoinNode) BufferedBatch(src int, batch edge.BufferedBatchMess...
method Point (line 87) | func (n *JoinNode) Point(src int, p edge.PointMessage) error {
method Barrier (line 91) | func (n *JoinNode) Barrier(src int, b edge.BarrierMessage) error {
method Finish (line 95) | func (n *JoinNode) Finish() error {
method doMessage (line 114) | func (n *JoinNode) doMessage(src int, m messageMeta) error {
method matchPoints (line 132) | func (n *JoinNode) matchPoints(p srcPoint) {
method sendMatchPoint (line 250) | func (n *JoinNode) sendMatchPoint(specific, matched srcPoint) {
method sendSpecificPoint (line 272) | func (n *JoinNode) sendSpecificPoint(specific srcPoint) {
method getOrCreateGroup (line 278) | func (n *JoinNode) getOrCreateGroup(groupID models.GroupID) *joinGroup {
method newGroup (line 289) | func (n *JoinNode) newGroup(count int) *joinGroup {
function newJoinNode (line 39) | func newJoinNode(et *ExecutingTask, n *pipeline.JoinNode, l *log.Logger)...
type messageMeta (line 105) | type messageMeta interface
type srcPoint (line 109) | type srcPoint struct
type joinGroup (line 298) | type joinGroup struct
method Finish (line 306) | func (g *joinGroup) Finish() error {
method Collect (line 312) | func (g *joinGroup) Collect(src int, p timeMessage) error {
method newJoinset (line 355) | func (g *joinGroup) newJoinset(t time.Time) *joinset {
method emit (line 370) | func (g *joinGroup) emit(onlyReadySets bool) error {
method emitAll (line 399) | func (g *joinGroup) emitAll() error {
method emitJoinedSet (line 411) | func (g *joinGroup) emitJoinedSet(set *joinset) error {
type srcGroup (line 441) | type srcGroup struct
type joinset (line 447) | type joinset struct
method Ready (line 496) | func (js *joinset) Ready() bool {
method Has (line 500) | func (js *joinset) Has(i int) bool {
method Set (line 505) | func (js *joinset) Set(i int, v edge.Message) {
method First (line 514) | func (js *joinset) First() edge.Message {
method JoinIntoPoint (line 519) | func (js *joinset) JoinIntoPoint() (edge.PointMessage, error) {
method JoinIntoBatch (line 562) | func (js *joinset) JoinIntoBatch() (edge.BufferedBatchMessage, error) {
function newJoinset (line 468) | func newJoinset(
type durationVar (line 674) | type durationVar struct
method String (line 678) | func (d *durationVar) String() string {
FILE: vendor/github.com/influxdata/kapacitor/kapacitor_loopback.go
constant statsKapacitorLoopbackPointsWritten (line 14) | statsKapacitorLoopbackPointsWritten = "points_written"
type KapacitorLoopbackNode (line 17) | type KapacitorLoopbackNode struct
method runOut (line 41) | func (n *KapacitorLoopbackNode) runOut([]byte) error {
method Point (line 52) | func (n *KapacitorLoopbackNode) Point(p edge.PointMessage) error {
method BeginBatch (line 88) | func (n *KapacitorLoopbackNode) BeginBatch(begin edge.BeginBatchMessag...
method BatchPoint (line 93) | func (n *KapacitorLoopbackNode) BatchPoint(bp edge.BatchPointMessage) ...
method EndBatch (line 123) | func (n *KapacitorLoopbackNode) EndBatch(edge.EndBatchMessage) error {
method Barrier (line 126) | func (n *KapacitorLoopbackNode) Barrier(edge.BarrierMessage) error {
method DeleteGroup (line 129) | func (n *KapacitorLoopbackNode) DeleteGroup(edge.DeleteGroupMessage) e...
function newKapacitorLoopbackNode (line 26) | func newKapacitorLoopbackNode(et *ExecutingTask, n *pipeline.KapacitorLo...
FILE: vendor/github.com/influxdata/kapacitor/log.go
type LogNode (line 15) | type LogNode struct
method runLog (line 41) | func (n *LogNode) runLog([]byte) error {
method BeginBatch (line 53) | func (n *LogNode) BeginBatch(begin edge.BeginBatchMessage) (edge.Messa...
method BatchPoint (line 57) | func (n *LogNode) BatchPoint(bp edge.BatchPointMessage) (edge.Message,...
method EndBatch (line 61) | func (n *LogNode) EndBatch(end edge.EndBatchMessage) (edge.Message, er...
method BufferedBatch (line 65) | func (n *LogNode) BufferedBatch(batch edge.BufferedBatchMessage) (edge...
method Point (line 76) | func (n *LogNode) Point(p edge.PointMessage) (edge.Message, error) {
method Barrier (line 87) | func (n *LogNode) Barrier(b edge.BarrierMessage) (edge.Message, error) {
method DeleteGroup (line 90) | func (n *LogNode) DeleteGroup(d edge.DeleteGroupMessage) (edge.Message...
function newLogNode (line 26) | func newLogNode(et *ExecutingTask, n *pipeline.LogNode, l *log.Logger) (...
FILE: vendor/github.com/influxdata/kapacitor/metaclient.go
type NoopMetaClient (line 10) | type NoopMetaClient struct
method WaitForLeader (line 12) | func (m *NoopMetaClient) WaitForLeader(d time.Duration) error {
method CreateDatabase (line 15) | func (m *NoopMetaClient) CreateDatabase(name string) (*meta.DatabaseIn...
method CreateDatabaseWithRetentionPolicy (line 18) | func (m *NoopMetaClient) CreateDatabaseWithRetentionPolicy(name string...
method CreateRetentionPolicy (line 21) | func (m *NoopMetaClient) CreateRetentionPolicy(database string, rpi *m...
method Database (line 24) | func (m *NoopMetaClient) Database(name string) *meta.DatabaseInfo {
method RetentionPolicy (line 29) | func (m *NoopMetaClient) RetentionPolicy(database, name string) (*meta...
method Authenticate (line 32) | func (m *NoopMetaClient) Authenticate(username, password string) (ui *...
method Users (line 35) | func (m *NoopMetaClient) Users() ([]meta.UserInfo, error) {
FILE: vendor/github.com/influxdata/kapacitor/node.go
constant statErrorCount (line 23) | statErrorCount = "errors"
constant statCardinalityGauge (line 24) | statCardinalityGauge = "working_cardinality"
constant statAverageExecTime (line 25) | statAverageExecTime = "avg_exec_time_ns"
type Node (line 29) | type Node interface
type node (line 71) | type node struct
method addParentEdge (line 92) | func (n *node) addParentEdge(e edge.StatsEdge) {
method abortParentEdges (line 96) | func (n *node) abortParentEdges() {
method init (line 102) | func (n *node) init() {
method start (line 119) | func (n *node) start(snapshot []byte) {
method stop (line 145) | func (n *node) stop() {
method snapshot (line 153) | func (n *node) snapshot() (b []byte, err error) { return }
method restore (line 156) | func (n *node) restore([]byte) error { return nil }
method Wait (line 158) | func (n *node) Wait() error {
method addChild (line 168) | func (n *node) addChild(c Node) (edge.StatsEdge, error) {
method addParent (line 185) | func (n *node) addParent(p Node) {
method linkChild (line 189) | func (n *node) linkChild(c Node) error {
method closeChildEdges (line 204) | func (n *node) closeChildEdges() {
method edot (line 210) | func (n *node) edot(buf *bytes.Buffer, labels bool) {
method collectedCount (line 285) | func (n *node) collectedCount() (count int64) {
method emittedCount (line 293) | func (n *node) emittedCount() (count int64) {
method incrementErrorCount (line 301) | func (n *node) incrementErrorCount() {
method stats (line 305) | func (n *node) stats() map[string]interface{} {
method nodeStatsByGroup (line 331) | func (n *node) nodeStatsByGroup() (stats map[models.GroupID]nodeStats) {
type nodeStats (line 323) | type nodeStats struct
type MaxDuration (line 359) | type MaxDuration struct
method String (line 364) | func (v *MaxDuration) String() string {
method StringValue (line 368) | func (v *MaxDuration) StringValue() string {
method IntValue (line 372) | func (v *MaxDuration) IntValue() int64 {
method Set (line 378) | func (v *MaxDuration) Set(next int64) {
FILE: vendor/github.com/influxdata/kapacitor/noop.go
type NoOpNode (line 10) | type NoOpNode struct
method runNoOp (line 23) | func (n *NoOpNode) runNoOp([]byte) error {
function newNoOpNode (line 15) | func newNoOpNode(et *ExecutingTask, n *pipeline.NoOpNode, l *log.Logger)...
FILE: vendor/github.com/influxdata/kapacitor/output.go
type Output (line 4) | type Output interface
FILE: vendor/github.com/influxdata/kapacitor/query.go
type Query (line 12) | type Query struct
method DBRPs (line 73) | func (q *Query) DBRPs() ([]DBRP, error) {
method StartTime (line 89) | func (q *Query) StartTime() time.Time {
method StopTime (line 94) | func (q *Query) StopTime() time.Time {
method SetStartTime (line 99) | func (q *Query) SetStartTime(s time.Time) {
method SetStopTime (line 107) | func (q *Query) SetStopTime(s time.Time) {
method Clone (line 112) | func (q *Query) Clone() (*Query, error) {
method Dimensions (line 175) | func (q *Query) Dimensions(dims []interface{}) error {
method IsGroupedByTime (line 251) | func (q *Query) IsGroupedByTime() bool {
method AlignGroup (line 255) | func (q *Query) AlignGroup() {
method Fill (line 259) | func (q *Query) Fill(option influxql.FillOption, value interface{}) {
method String (line 264) | func (q *Query) String() string {
function NewQuery (line 21) | func NewQuery(queryString string) (*Query, error) {
type TimeDimension (line 268) | type TimeDimension struct
function groupByTime (line 273) | func groupByTime(length time.Duration, offset ...time.Duration) (TimeDim...
FILE: vendor/github.com/influxdata/kapacitor/query_test.go
function TestQuery_Clone (line 11) | func TestQuery_Clone(t *testing.T) {
function TestQuery_IsGroupedByTime (line 142) | func TestQuery_IsGroupedByTime(t *testing.T) {
FILE: vendor/github.com/influxdata/kapacitor/replay.go
function ReplayStreamFromChan (line 17) | func ReplayStreamFromChan(clck clock.Clock, points <-chan edge.PointMess...
function ReplayStreamFromIO (line 26) | func ReplayStreamFromIO(clck clock.Clock, data io.ReadCloser, collector ...
function replayStreamFromChan (line 49) | func replayStreamFromChan(clck clock.Clock, points <-chan edge.PointMess...
function readPointsFromIO (line 73) | func readPointsFromIO(data io.ReadCloser, points chan<- edge.PointMessag...
function ReplayBatchFromChan (line 113) | func ReplayBatchFromChan(clck clock.Clock, batches []<-chan edge.Buffere...
function ReplayBatchFromIO (line 142) | func ReplayBatchFromIO(clck clock.Clock, data []io.ReadCloser, collector...
function replayBatchFromChan (line 174) | func replayBatchFromChan(clck clock.Clock, batches <-chan edge.BufferedB...
function readBatchFromIO (line 225) | func readBatchFromIO(data io.ReadCloser, batches chan<- edge.BufferedBat...
function WritePointForRecording (line 243) | func WritePointForRecording(w io.Writer, p edge.PointMessage, precision ...
function WriteBatchForRecording (line 256) | func WriteBatchForRecording(w io.Writer, b edge.BufferedBatchMessage) er...
FILE: vendor/github.com/influxdata/kapacitor/result.go
type Result (line 13) | type Result
function ResultFromJSON (line 16) | func ResultFromJSON(in io.Reader) (r Result) {
function ConvertResultTimes (line 29) | func ConvertResultTimes(r *Result) {
FILE: vendor/github.com/influxdata/kapacitor/sample.go
type SampleNode (line 13) | type SampleNode struct
method runSample (line 36) | func (n *SampleNode) runSample([]byte) error {
method NewGroup (line 45) | func (n *SampleNode) NewGroup(group edge.GroupInfo, first edge.PointMe...
method newGroup (line 51) | func (n *SampleNode) newGroup() *sampleGroup {
method shouldKeep (line 97) | func (n *SampleNode) shouldKeep(count int64, t time.Time) bool {
function newSampleNode (line 22) | func newSampleNode(et *ExecutingTask, n *pipeline.SampleNode, l *log.Log...
type sampleGroup (line 57) | type sampleGroup struct
method BeginBatch (line 63) | func (g *sampleGroup) BeginBatch(begin edge.BeginBatchMessage) (edge.M...
method BatchPoint (line 68) | func (g *sampleGroup) BatchPoint(bp edge.BatchPointMessage) (edge.Mess...
method EndBatch (line 77) | func (g *sampleGroup) EndBatch(end edge.EndBatchMessage) (edge.Message...
method Point (line 81) | func (g *sampleGroup) Point(p edge.PointMessage) (edge.Message, error) {
method Barrier (line 90) | func (g *sampleGroup) Barrier(b edge.BarrierMessage) (edge.Message, er...
method DeleteGroup (line 93) | func (g *sampleGroup) DeleteGroup(d edge.DeleteGroupMessage) (edge.Mes...
FILE: vendor/github.com/influxdata/kapacitor/shift.go
type ShiftNode (line 12) | type ShiftNode struct
method runShift (line 33) | func (n *ShiftNode) runShift([]byte) error {
method doShift (line 44) | func (n *ShiftNode) doShift(t edge.TimeSetter) {
method BeginBatch (line 48) | func (n *ShiftNode) BeginBatch(begin edge.BeginBatchMessage) (edge.Mes...
method BatchPoint (line 54) | func (n *ShiftNode) BatchPoint(bp edge.BatchPointMessage) (edge.Messag...
method EndBatch (line 60) | func (n *ShiftNode) EndBatch(end edge.EndBatchMessage) (edge.Message, ...
method Point (line 64) | func (n *ShiftNode) Point(p edge.PointMessage) (edge.Message, error) {
method Barrier (line 70) | func (n *ShiftNode) Barrier(b edge.BarrierMessage) (edge.Message, erro...
method DeleteGroup (line 73) | func (n *ShiftNode) DeleteGroup(d edge.DeleteGroupMessage) (edge.Messa...
function newShiftNode (line 20) | func newShiftNode(et *ExecutingTask, n *pipeline.ShiftNode, l *log.Logge...
FILE: vendor/github.com/influxdata/kapacitor/state_tracking.go
type stateTracker (line 14) | type stateTracker interface
type stateTrackingGroup (line 19) | type stateTrackingGroup struct
method BeginBatch (line 63) | func (g *stateTrackingGroup) BeginBatch(begin edge.BeginBatchMessage) ...
method BatchPoint (line 68) | func (g *stateTrackingGroup) BatchPoint(bp edge.BatchPointMessage) (ed...
method EndBatch (line 79) | func (g *stateTrackingGroup) EndBatch(end edge.EndBatchMessage) (edge....
method Point (line 83) | func (g *stateTrackingGroup) Point(p edge.PointMessage) (edge.Message,...
method track (line 94) | func (g *stateTrackingGroup) track(p edge.FieldsTagsTimeSetter) error {
method Barrier (line 106) | func (g *stateTrackingGroup) Barrier(b edge.BarrierMessage) (edge.Mess...
method DeleteGroup (line 109) | func (g *stateTrackingGroup) DeleteGroup(d edge.DeleteGroupMessage) (e...
type StateTrackingNode (line 25) | type StateTrackingNode struct
method runStateTracking (line 35) | func (n *StateTrackingNode) runStateTracking(_ []byte) error {
method NewGroup (line 44) | func (n *StateTrackingNode) NewGroup(group edge.GroupInfo, first edge....
method newGroup (line 51) | func (n *StateTrackingNode) newGroup() *stateTrackingGroup {
type stateDurationTracker (line 113) | type stateDurationTracker struct
method reset (line 119) | func (sdt *stateDurationTracker) reset() {
method track (line 123) | func (sdt *stateDurationTracker) track(t time.Time, inState bool) inte...
function newStateDurationNode (line 135) | func newStateDurationNode(et *ExecutingTask, sd *pipeline.StateDurationN...
type stateCountTracker (line 155) | type stateCountTracker struct
method reset (line 159) | func (sct *stateCountTracker) reset() {
method track (line 163) | func (sct *stateCountTracker) track(t time.Time, inState bool) interfa...
function newStateCountNode (line 173) | func newStateCountNode(et *ExecutingTask, sc *pipeline.StateCountNode, l...
FILE: vendor/github.com/influxdata/kapacitor/stats.go
type StatsNode (line 13) | type StatsNode struct
method runStats (line 40) | func (n *StatsNode) runStats([]byte) error {
method emit (line 72) | func (n *StatsNode) emit(now time.Time) error {
method stopStats (line 102) | func (n *StatsNode) stopStats() {
function newStatsNode (line 23) | func newStatsNode(et *ExecutingTask, n *pipeline.StatsNode, l *log.Logge...
FILE: vendor/github.com/influxdata/kapacitor/stream.go
type StreamNode (line 15) | type StreamNode struct
method runSourceStream (line 30) | func (n *StreamNode) runSourceStream([]byte) error {
function newStreamNode (line 21) | func newStreamNode(et *ExecutingTask, n *pipeline.StreamNode, l *log.Log...
type FromNode (line 42) | type FromNode struct
method runStream (line 79) | func (n *FromNode) runStream([]byte) error {
method BeginBatch (line 89) | func (n *FromNode) BeginBatch(edge.BeginBatchMessage) (edge.Message, e...
method BatchPoint (line 92) | func (n *FromNode) BatchPoint(edge.BatchPointMessage) (edge.Message, e...
method EndBatch (line 95) | func (n *FromNode) EndBatch(edge.EndBatchMessage) (edge.Message, error) {
method Point (line 99) | func (n *FromNode) Point(p edge.PointMessage) (edge.Message, error) {
method Barrier (line 117) | func (n *FromNode) Barrier(b edge.BarrierMessage) (edge.Message, error) {
method DeleteGroup (line 120) | func (n *FromNode) DeleteGroup(d edge.DeleteGroupMessage) (edge.Messag...
method matches (line 124) | func (n *FromNode) matches(p edge.PointMessage) bool {
function newFromNode (line 55) | func newFromNode(et *ExecutingTask, n *pipeline.FromNode, l *log.Logger)...
FILE: vendor/github.com/influxdata/kapacitor/task.go
type TaskType (line 17) | type TaskType
method String (line 24) | func (t TaskType) String() string {
method MarshalText (line 35) | func (t TaskType) MarshalText() ([]byte, error) {
method UnmarshalText (line 39) | func (t *TaskType) UnmarshalText(text []byte) error {
constant StreamTask (line 20) | StreamTask TaskType = iota
constant BatchTask (line 21) | BatchTask
type DBRP (line 51) | type DBRP struct
method String (line 64) | func (d DBRP) String() string {
function CreateDBRPMap (line 56) | func CreateDBRPMap(dbrps []DBRP) map[DBRP]bool {
type Task (line 69) | type Task struct
method Dot (line 77) | func (t *Task) Dot() []byte {
method Measurements (line 82) | func (t *Task) Measurements() []string {
type ExecutingTask (line 100) | type ExecutingTask struct
method walk (line 135) | func (et *ExecutingTask) walk(f func(n Node) error) error {
method rwalk (line 146) | func (et *ExecutingTask) rwalk(f func(n Node) error) error {
method link (line 157) | func (et *ExecutingTask) link() error {
method start (line 192) | func (et *ExecutingTask) start(ins []edge.StatsEdge, snapshot *TaskSna...
method stop (line 231) | func (et *ExecutingTask) stop() (err error) {
method StartBatching (line 248) | func (et *ExecutingTask) StartBatching() error {
method BatchCount (line 265) | func (et *ExecutingTask) BatchCount() (int, error) {
method BatchQueries (line 275) | func (et *ExecutingTask) BatchQueries(start, stop time.Time) ([]BatchQ...
method checkDBRPs (line 290) | func (et *ExecutingTask) checkDBRPs(batcher *BatchNode) error {
method StopStats (line 305) | func (et *ExecutingTask) StopStats() {
method Wait (line 315) | func (et *ExecutingTask) Wait() error {
method GetOutput (line 322) | func (et *ExecutingTask) GetOutput(name string) (Output, error) {
method registerOutput (line 331) | func (et *ExecutingTask) registerOutput(name string, o Output) {
method ExecutionStats (line 340) | func (et *ExecutingTask) ExecutionStats() (ExecutionStats, error) {
method EDot (line 371) | func (et *ExecutingTask) EDot(labels bool) []byte {
method getThroughput (line 411) | func (et *ExecutingTask) getThroughput() float64 {
method calcThroughput (line 417) | func (et *ExecutingTask) calcThroughput() {
method createNode (line 444) | func (et *ExecutingTask) createNode(p pipeline.Node, l *log.Logger) (n...
method Snapshot (line 521) | func (et *ExecutingTask) Snapshot() (*TaskSnapshot, error) {
method runSnapshotter (line 539) | func (et *ExecutingTask) runSnapshotter() {
function NewExecutingTask (line 118) | func NewExecutingTask(tm *TaskMaster, t *Task) (*ExecutingTask, error) {
type ExecutionStats (line 335) | type ExecutionStats struct
type TaskSnapshot (line 517) | type TaskSnapshot struct
FILE: vendor/github.com/influxdata/kapacitor/task_master.go
constant statPointsReceived (line 43) | statPointsReceived = "points_received"
constant MainTaskMaster (line 44) | MainTaskMaster = "main"
type LogService (line 47) | type LogService interface
type UDFService (line 51) | type UDFService interface
type deleteHook (line 60) | type deleteHook
type TaskMaster (line 63) | type TaskMaster struct
method New (line 222) | func (tm *TaskMaster) New(id string) *TaskMaster {
method ID (line 250) | func (tm *TaskMaster) ID() string {
method Open (line 254) | func (tm *TaskMaster) Open() (err error) {
method StopTasks (line 271) | func (tm *TaskMaster) StopTasks() {
method Close (line 279) | func (tm *TaskMaster) Close() error {
method Drain (line 300) | func (tm *TaskMaster) Drain() {
method NewTemplate (line 311) | func (tm *TaskMaster) NewTemplate(
method NewTask (line 338) | func (tm *TaskMaster) NewTask(
method waitForForks (line 375) | func (tm *TaskMaster) waitForForks() {
method CreateTICKScope (line 399) | func (tm *TaskMaster) CreateTICKScope() *stateful.Scope {
method StartTask (line 429) | func (tm *TaskMaster) StartTask(t *Task) (*ExecutingTask, error) {
method BatchCollectors (line 482) | func (tm *TaskMaster) BatchCollectors(id string) []BatchCollector {
method StopTask (line 486) | func (tm *TaskMaster) StopTask(id string) error {
method DeleteTask (line 492) | func (tm *TaskMaster) DeleteTask(id string) error {
method stopTask (line 504) | func (tm *TaskMaster) stopTask(id string) (err error) {
method deleteTask (line 528) | func (tm *TaskMaster) deleteTask(id string) {
method registerDeleteHookForTask (line 535) | func (tm *TaskMaster) registerDeleteHookForTask(id string, hook delete...
method IsExecuting (line 541) | func (tm *TaskMaster) IsExecuting(id string) bool {
method ExecutionStats (line 548) | func (tm *TaskMaster) ExecutionStats(id string) (ExecutionStats, error) {
method ExecutingDot (line 559) | func (tm *TaskMaster) ExecutingDot(id string, labels bool) string {
method Stream (line 569) | func (tm *TaskMaster) Stream(name string) (StreamCollector, error) {
method stream (line 575) | func (tm *TaskMaster) stream(name string) (StreamCollector, error) {
method runForking (line 622) | func (tm *TaskMaster) runForking(in StreamEdge) {
method forkPoint (line 628) | func (tm *TaskMaster) forkPoint(p edge.PointMessage) {
method WritePoints (line 690) | func (tm *TaskMaster) WritePoints(database, retentionPolicy string, co...
method WriteKapacitorPoint (line 717) | func (tm *TaskMaster) WriteKapacitorPoint(p edge.PointMessage) error {
method NewFork (line 728) | func (tm *TaskMaster) NewFork(taskName string, dbrps []DBRP, measureme...
method newFork (line 753) | func (tm *TaskMaster) newFork(taskName string, dbrps []DBRP, measureme...
method DelFork (line 779) | func (tm *TaskMaster) DelFork(id string) {
method delFork (line 786) | func (tm *TaskMaster) delFork(id string) {
method SnapshotTask (line 814) | func (tm *TaskMaster) SnapshotTask(id string) (*TaskSnapshot, error) {
type forkKey (line 197) | type forkKey struct
function NewTaskMaster (line 204) | func NewTaskMaster(id string, info vars.Infoer, l LogService) *TaskMaster {
type StreamCollector (line 589) | type StreamCollector interface
type StreamEdge (line 594) | type StreamEdge interface
type streamEdge (line 600) | type streamEdge struct
method CollectPoint (line 604) | func (s *streamEdge) CollectPoint(p edge.PointMessage) error {
method EmitPoint (line 607) | func (s *streamEdge) EmitPoint() (edge.PointMessage, bool) {
method Close (line 618) | func (s *streamEdge) Close() error {
function forkKeys (line 734) | func forkKeys(dbrps []DBRP, measurements []string) []forkKey {
type noOpTimingService (line 825) | type noOpTimingService struct
method NewTimer (line 827) | func (noOpTimingService) NewTimer(timer.Setter) timer.Timer {
type TaskMasterLookup (line 831) | type TaskMasterLookup struct
method Get (line 842) | func (tml *TaskMasterLookup) Get(id string) *TaskMaster {
method Main (line 848) | func (tml *TaskMasterLookup) Main() *TaskMaster {
method Set (line 852) | func (tml *TaskMasterLookup) Set(tm *TaskMaster) {
method Delete (line 858) | func (tml *TaskMasterLookup) Delete(tm *TaskMaster) {
function NewTaskMasterLookup (line 836) | func NewTaskMasterLookup() *TaskMasterLookup {
type BatchCollector (line 864) | type BatchCollector interface
type batchCollector (line 869) | type batchCollector struct
method CollectBatch (line 873) | func (c *batchCollector) CollectBatch(batch edge.BufferedBatchMessage)...
method Close (line 876) | func (c *batchCollector) Close() error {
FILE: vendor/github.com/influxdata/kapacitor/template.go
type Template (line 8) | type Template struct
method Vars (line 13) | func (t *Template) Vars() map[string]tick.Var {
method Dot (line 17) | func (t *Template) Dot() string {
FILE: vendor/github.com/influxdata/kapacitor/udf.go
type UDFNode (line 22) | type UDFNode struct
method stopUDF (line 59) | func (n *UDFNode) stopUDF() {
method runUDF (line 70) | func (n *UDFNode) runUDF(snapshot []byte) (err error) {
method abortedCallback (line 134) | func (n *UDFNode) abortedCallback() {
method snapshot (line 140) | func (n *UDFNode) snapshot() ([]byte, error) {
function newUDFNode (line 34) | func newUDFNode(et *ExecutingTask, n *pipeline.UDFNode, l *log.Logger) (...
type UDFProcess (line 147) | type UDFProcess struct
method Open (line 189) | func (p *UDFProcess) Open() error {
method Close (line 256) | func (p *UDFProcess) Close() error {
method logStdErr (line 265) | func (p *UDFProcess) logStdErr() {
method Abort (line 273) | func (p *UDFProcess) Abort(err error) { p.server.Ab...
method Init (line 274) | func (p *UDFProcess) Init(options []*agent.Option) error { return p.se...
method Snapshot (line 275) | func (p *UDFProcess) Snapshot() ([]byte, error) { return p.se...
method Restore (line 276) | func (p *UDFProcess) Restore(snapshot []byte) error { return p.se...
method In (line 277) | func (p *UDFProcess) In() chan<- edge.Message { return p.se...
method Out (line 278) | func (p *UDFProcess) Out() <-chan edge.Message { return p.se...
method Info (line 279) | func (p *UDFProcess) Info() (udf.Info, error) { return p.se...
function NewUDFProcess (line 169) | func NewUDFProcess(
type UDFSocket (line 281) | type UDFSocket struct
method Open (line 317) | func (s *UDFSocket) Open() error {
method Close (line 339) | func (s *UDFSocket) Close() error {
method Abort (line 351) | func (s *UDFSocket) Abort(err error) { s.server.Abo...
method Init (line 352) | func (s *UDFSocket) Init(options []*agent.Option) error { return s.ser...
method Snapshot (line 353) | func (s *UDFSocket) Snapshot() ([]byte, error) { return s.ser...
method Restore (line 354) | func (s *UDFSocket) Restore(snapshot []byte) error { return s.ser...
method In (line 355) | func (s *UDFSocket) In() chan<- edge.Message { return s.ser...
method Out (line 356) | func (s *UDFSocket) Out() <-chan edge.Message { return s.ser...
method Info (line 357) | func (s *UDFSocket) Info() (udf.Info, error) { return s.ser...
type Socket (line 293) | type Socket interface
function NewUDFSocket (line 300) | func NewUDFSocket(
type socket (line 359) | type socket struct
method Open (line 370) | func (s *socket) Open() error {
method Close (line 392) | func (s *socket) Close() error {
method In (line 406) | func (s *socket) In() io.WriteCloser {
method Out (line 410) | func (s *socket) Out() io.Reader {
function NewSocketConn (line 364) | func NewSocketConn(path string) Socket {
type unixCloser (line 396) | type unixCloser struct
method Close (line 400) | func (u unixCloser) Close() error {
FILE: vendor/github.com/influxdata/kapacitor/udf/agent/agent.go
type Handler (line 20) | type Handler interface
type Agent (line 47) | type Agent struct
method Start (line 79) | func (a *Agent) Start() error {
method Wait (line 116) | func (a *Agent) Wait() error {
method readLoop (line 136) | func (a *Agent) readLoop() error {
method writeLoop (line 221) | func (a *Agent) writeLoop() error {
method forwardResponses (line 232) | func (a *Agent) forwardResponses() {
function New (line 67) | func New(in io.ReadCloser, out io.WriteCloser) *Agent {
FILE: vendor/github.com/influxdata/kapacitor/udf/agent/io.go
type ByteReadReader (line 20) | type ByteReadReader interface
function WriteMessage (line 26) | func WriteMessage(msg proto.Message, w io.Writer) error {
function ReadMessage (line 49) | func ReadMessage(buf *[]byte, r ByteReadReader, msg proto.Message) error {
FILE: vendor/github.com/influxdata/kapacitor/udf/agent/io_test.go
function TestMessage_ReadWrite (line 11) | func TestMessage_ReadWrite(t *testing.T) {
function TestMessage_ReadWriteMultiple (line 38) | func TestMessage_ReadWriteMultiple(t *testing.T) {
FILE: vendor/github.com/influxdata/kapacitor/udf/agent/server.go
type Server (line 12) | type Server struct
method Serve (line 39) | func (s *Server) Serve() error {
method Stop (line 53) | func (s *Server) Stop() {
method StopOnSignals (line 68) | func (s *Server) StopOnSignals(signals ...os.Signal) {
method run (line 89) | func (s *Server) run() error {
type Accepter (line 23) | type Accepter interface
function NewServer (line 30) | func NewServer(l net.Listener, a Accepter) *Server {
FILE: vendor/github.com/influxdata/kapacitor/udf/agent/udf.pb.go
constant _ (line 47) | _ = proto.ProtoPackageIsVersion2
type EdgeType (line 49) | type EdgeType
method String (line 65) | func (x EdgeType) String() string {
method EnumDescriptor (line 68) | func (EdgeType) EnumDescriptor() ([]byte, []int) { return fileDescript...
constant EdgeType_STREAM (line 52) | EdgeType_STREAM EdgeType = 0
constant EdgeType_BATCH (line 53) | EdgeType_BATCH EdgeType = 1
type ValueType (line 70) | type ValueType
method String (line 95) | func (x ValueType) String() string {
method EnumDescriptor (line 98) | func (ValueType) EnumDescriptor() ([]byte, []int) { return fileDescrip...
constant ValueType_BOOL (line 73) | ValueType_BOOL ValueType = 0
constant ValueType_INT (line 74) | ValueType_INT ValueType = 1
constant ValueType_DOUBLE (line 75) | ValueType_DOUBLE ValueType = 2
constant ValueType_STRING (line 76) | ValueType_STRING ValueType = 3
constant ValueType_DURATION (line 77) | ValueType_DURATION ValueType = 4
type InfoRequest (line 101) | type InfoRequest struct
method Reset (line 104) | func (m *InfoRequest) Reset() { *m = InfoRequest{} }
method String (line 105) | func (m *InfoRequest) String() string { return proto.Compac...
method ProtoMessage (line 106) | func (*InfoRequest) ProtoMessage() {}
method Descriptor (line 107) | func (*InfoRequest) Descriptor() ([]byte, []int) { return fileDescript...
type InfoResponse (line 109) | type InfoResponse struct
method Reset (line 115) | func (m *InfoResponse) Reset() { *m = InfoResponse{} }
method String (line 116) | func (m *InfoResponse) String() string { return proto.Compa...
method ProtoMessage (line 117) | func (*InfoResponse) ProtoMessage() {}
method Descriptor (line 118) | func (*InfoResponse) Descriptor() ([]byte, []int) { return fileDescrip...
method GetOptions (line 120) | func (m *InfoResponse) GetOptions() map[string]*OptionInfo {
type OptionInfo (line 127) | type OptionInfo struct
method Reset (line 131) | func (m *OptionInfo) Reset() { *m = OptionInfo{} }
method String (line 132) | func (m *OptionInfo) String() string { return proto.Compact...
method ProtoMessage (line 133) | func (*OptionInfo) ProtoMessage() {}
method Descriptor (line 134) | func (*OptionInfo) Descriptor() ([]byte, []int) { return fileDescripto...
type InitRequest (line 137) | type InitRequest struct
method Reset (line 143) | func (m *InitRequest) Reset() { *m = InitRequest{} }
method String (line 144) | func (m *InitRequest) String() string { return proto.Compac...
method ProtoMessage (line 145) | func (*InitRequest) ProtoMessage() {}
method Descriptor (line 146) | func (*InitRequest) Descriptor() ([]byte, []int) { return fileDescript...
method GetOptions (line 148) | func (m *InitRequest) GetOptions() []*Option {
type Option (line 155) | type Option struct
method Reset (line 160) | func (m *Option) Reset() { *m = Option{} }
method String (line 161) | func (m *Option) String() string { return proto.CompactText...
method ProtoMessage (line 162) | func (*Option) ProtoMessage() {}
method Descriptor (line 163) | func (*Option) Descriptor() ([]byte, []int) { return fileDescriptor0, ...
method GetValues (line 165) | func (m *Option) GetValues() []*OptionValue {
type OptionValue (line 172) | type OptionValue struct
method Reset (line 183) | func (m *OptionValue) Reset() { *m = OptionValue{} }
method String (line 184) | func (m *OptionValue) String() string { return proto.Compac...
method ProtoMessage (line 185) | func (*OptionValue) ProtoMessage() {}
method Descriptor (line 186) | func (*OptionValue) Descriptor() ([]byte, []int) { return fileDescript...
method GetValue (line 214) | func (m *OptionValue) GetValue() isOptionValue_Value {
method GetBoolValue (line 221) | func (m *OptionValue) GetBoolValue() bool {
method GetIntValue (line 228) | func (m *OptionValue) GetIntValue() int64 {
method GetDoubleValue (line 235) | func (m *OptionValue) GetDoubleValue() float64 {
method GetStringValue (line 242) | func (m *OptionValue) GetStringValue() string {
method GetDurationValue (line 249) | func (m *OptionValue) GetDurationValue() int64 {
method XXX_OneofFuncs (line 257) | func (*OptionValue) XXX_OneofFuncs() (func(msg proto.Message, b *proto...
type isOptionValue_Value (line 188) | type isOptionValue_Value interface
type OptionValue_BoolValue (line 192) | type OptionValue_BoolValue struct
method isOptionValue_Value (line 208) | func (*OptionValue_BoolValue) isOptionValue_Value() {}
type OptionValue_IntValue (line 195) | type OptionValue_IntValue struct
method isOptionValue_Value (line 209) | func (*OptionValue_IntValue) isOptionValue_Value() {}
type OptionValue_DoubleValue (line 198) | type OptionValue_DoubleValue struct
method isOptionValue_Value (line 210) | func (*OptionValue_DoubleValue) isOptionValue_Value() {}
type OptionValue_StringValue (line 201) | type OptionValue_StringValue struct
method isOptionValue_Value (line 211) | func (*OptionValue_StringValue) isOptionValue_Value() {}
type OptionValue_DurationValue (line 204) | type OptionValue_DurationValue struct
method isOptionValue_Value (line 212) | func (*OptionValue_DurationValue) isOptionValue_Value() {}
function _OptionValue_OneofMarshaler (line 267) | func _OptionValue_OneofMarshaler(msg proto.Message, b *proto.Buffer) err...
function _OptionValue_OneofUnmarshaler (line 297) | func _OptionValue_OneofUnmarshaler(msg proto.Message, tag, wire int, b *...
function _OptionValue_OneofSizer (line 340) | func _OptionValue_OneofSizer(msg proto.Message) (n int) {
type InitResponse (line 368) | type InitResponse struct
method Reset (line 373) | func (m *InitResponse) Reset() { *m = InitResponse{} }
method String (line 374) | func (m *InitResponse) String() string { return proto.Compa...
method ProtoMessage (line 375) | func (*InitResponse) ProtoMessage() {}
method Descriptor (line 376) | func (*InitResponse) Descriptor() ([]byte, []int) { return fileDescrip...
type SnapshotRequest (line 379) | type SnapshotRequest struct
method Reset (line 382) | func (m *SnapshotRequest) Reset() { *m = SnapshotRe...
method String (line 383) | func (m *SnapshotRequest) String() string { return proto.Co...
method ProtoMessage (line 384) | func (*SnapshotRequest) ProtoMessage() {}
method Descriptor (line 385) | func (*SnapshotRequest) Descriptor() ([]byte, []int) { return fileDesc...
type SnapshotResponse (line 388) | type SnapshotResponse struct
method Reset (line 392) | func (m *SnapshotResponse) Reset() { *m = SnapshotR...
method String (line 393) | func (m *SnapshotResponse) String() string { return proto.C...
method ProtoMessage (line 394) | func (*SnapshotResponse) ProtoMessage() {}
method Descriptor (line 395) | func (*SnapshotResponse) Descriptor() ([]byte, []int) { return fileDes...
type RestoreRequest (line 398) | type RestoreRequest struct
method Reset (line 402) | func (m *RestoreRequest) Reset() { *m = RestoreRequ...
method String (line 403) | func (m *RestoreRequest) String() string { return proto.Com...
method ProtoMessage (line 404) | func (*RestoreRequest) ProtoMessage() {}
method Descriptor (line 405) | func (*RestoreRequest) Descriptor() ([]byte, []int) { return fileDescr...
type RestoreResponse (line 408) | type RestoreResponse struct
method Reset (line 413) | func (m *RestoreResponse) Reset() { *m = RestoreRes...
method String (line 414) | func (m *RestoreResponse) String() string { return proto.Co...
method ProtoMessage (line 415) | func (*RestoreResponse) ProtoMessage() {}
method Descriptor (line 416) | func (*RestoreResponse) Descriptor() ([]byte, []int) { return fileDesc...
type KeepaliveRequest (line 419) | type KeepaliveRequest struct
method Reset (line 425) | func (m *KeepaliveRequest) Reset() { *m = Keepalive...
method String (line 426) | func (m *KeepaliveRequest) String() string { return proto.C...
method ProtoMessage (line 427) | func (*KeepaliveRequest) ProtoMessage() {}
method Descriptor (line 428) | func (*KeepaliveRequest) Descriptor() ([]byte, []int) { return fileDes...
type KeepaliveResponse (line 431) | type KeepaliveResponse struct
method Reset (line 437) | func (m *KeepaliveResponse) Reset() { *m = Keepaliv...
method String (line 438) | func (m *KeepaliveResponse) String() string { return proto....
method ProtoMessage (line 439) | func (*KeepaliveResponse) ProtoMessage() {}
method Descriptor (line 440) | func (*KeepaliveResponse) Descriptor() ([]byte, []int) { return fileDe...
type ErrorResponse (line 444) | type ErrorResponse struct
method Reset (line 448) | func (m *ErrorResponse) Reset() { *m = ErrorRespons...
method String (line 449) | func (m *ErrorResponse) String() string { return proto.Comp...
method ProtoMessage (line 450) | func (*ErrorResponse) ProtoMessage() {}
method Descriptor (line 451) | func (*ErrorResponse) Descriptor() ([]byte, []int) { return fileDescri...
type BeginBatch (line 465) | type BeginBatch struct
method Reset (line 473) | func (m *BeginBatch) Reset() { *m = BeginBatch{} }
method String (line 474) | func (m *BeginBatch) String() string { return proto.Compact...
method ProtoMessage (line 475) | func (*BeginBatch) ProtoMessage() {}
method Descriptor (line 476) | func (*BeginBatch) Descriptor() ([]byte, []int) { return fileDescripto...
method GetTags (line 478) | func (m *BeginBatch) GetTags() map[string]string {
type Point (line 487) | type Point struct
method Reset (line 502) | func (m *Point) Reset() { *m = Point{} }
method String (line 503) | func (m *Point) String() string { return proto.CompactTextS...
method ProtoMessage (line 504) | func (*Point) ProtoMessage() {}
method Descriptor (line 505) | func (*Point) Descriptor() ([]byte, []int) { return fileDescriptor0, [...
method GetTags (line 507) | func (m *Point) GetTags() map[string]string {
method GetFieldsDouble (line 514) | func (m *Point) GetFieldsDouble() map[string]float64 {
method GetFieldsInt (line 521) | func (m *Point) GetFieldsInt() map[string]int64 {
method GetFieldsString (line 528) | func (m *Point) GetFieldsString() map[string]string {
method GetFieldsBool (line 535) | func (m *Point) GetFieldsBool() map[string]bool {
type EndBatch (line 547) | type EndBatch struct
method Reset (line 555) | func (m *EndBatch) Reset() { *m = EndBatch{} }
method String (line 556) | func (m *EndBatch) String() string { return proto.CompactTe...
method ProtoMessage (line 557) | func (*EndBatch) ProtoMessage() {}
method Descriptor (line 558) | func (*EndBatch) Descriptor() ([]byte, []int) { return fileDescriptor0...
method GetTags (line 560) | func (m *EndBatch) GetTags() map[string]string {
type Request (line 568) | type Request struct
method Reset (line 581) | func (m *Request) Reset() { *m = Request{} }
method String (line 582) | func (m *Request) String() string { return proto.CompactTex...
method ProtoMessage (line 583) | func (*Request) ProtoMessage() {}
method Descriptor (line 584) | func (*Request) Descriptor() ([]byte, []int) { return fileDescriptor0,...
method GetMessage (line 624) | func (m *Request) GetMessage() isRequest_Message {
method GetInfo (line 631) | func (m *Request) GetInfo() *InfoRequest {
method GetInit (line 638) | func (m *Request) GetInit() *InitRequest {
method GetKeepalive (line 645) | func (m *Request) GetKeepalive() *KeepaliveRequest {
method GetSnapshot (line 652) | func (m *Request) GetSnapshot() *SnapshotRequest {
method GetRestore (line 659) | func (m *Request) GetRestore() *RestoreRequest {
method GetBegin (line 666) | func (m *Request) GetBegin() *BeginBatch {
method GetPoint (line 673) | func (m *Request) GetPoint() *Point {
method GetEnd (line 680) | func (m *Request) GetEnd() *EndBatch {
method XXX_OneofFuncs (line 688) | func (*Request) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buf...
type isRequest_Message (line 586) | type isRequest_Message interface
type Request_Info (line 590) | type Request_Info struct
method isRequest_Message (line 615) | func (*Request_Info) isRequest_Message() {}
type Request_Init (line 593) | type Request_Init struct
method isRequest_Message (line 616) | func (*Request_Init) isRequest_Message() {}
type Request_Keepalive (line 596) | type Request_Keepalive struct
method isRequest_Message (line 617) | func (*Request_Keepalive) isRequest_Message() {}
type Request_Snapshot (line 599) | type Request_Snapshot struct
method isRequest_Message (line 618) | func (*Request_Snapshot) isRequest_Message() {}
type Request_Restore (line 602) | type Request_Restore struct
method isRequest_Message (line 619) | func (*Request_Restore) isRequest_Message() {}
type Request_Begin (line 605) | type Request_Begin struct
method isRequest_Message (line 620) | func (*Request_Begin) isRequest_Message() {}
type Request_Point (line 608) | type Request_Point struct
method isRequest_Message (line 621) | func (*Request_Point) isRequest_Message() {}
type Request_End (line 611) | type Request_End struct
method isRequest_Message (line 622) | func (*Request_End) isRequest_Message() {}
function _Request_OneofMarshaler (line 701) | func _Request_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
function _Request_OneofUnmarshaler (line 752) | func _Request_OneofUnmarshaler(msg proto.Message, tag, wire int, b *prot...
function _Request_OneofSizer (line 824) | func _Request_OneofSizer(msg proto.Message) (n int) {
type Response (line 876) | type Response struct
method Reset (line 890) | func (m *Response) Reset() { *m = Response{} }
method String (line 891) | func (m *Response) String() string { return proto.CompactTe...
method ProtoMessage (line 892) | func (*Response) ProtoMessage() {}
method Descriptor (line 893) | func (*Response) Descriptor() ([]byte, []int) { return fileDescriptor0...
method GetMessage (line 937) | func (m *Response) GetMessage() isResponse_Message {
method GetInfo (line 944) | func (m *Response) GetInfo() *InfoResponse {
method GetInit (line 951) | func (m *Response) GetInit() *InitResponse {
method GetKeepalive (line 958) | func (m *Response) GetKeepalive() *KeepaliveResponse {
method GetSnapshot (line 965) | func (m *Response) GetSnapshot() *SnapshotResponse {
method GetRestore (line 972) | func (m *Response) GetRestore() *RestoreResponse {
method GetError (line 979) | func (m *Response) GetError() *ErrorResponse {
method GetBegin (line 986) | func (m *Response) GetBegin() *BeginBatch {
method GetPoint (line 993) | func (m *Response) GetPoint() *Point {
method GetEnd (line 1000) | func (m *Response) GetEnd() *EndBatch {
method XXX_OneofFuncs (line 1008) | func (*Response) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Bu...
type isResponse_Message (line 895) | type isResponse_Message interface
type Response_Info (line 899) | type Response_Info struct
method isResponse_Message (line 927) | func (*Response_Info) isResponse_Message() {}
type Response_Init (line 902) | type Response_Init struct
method isResponse_Message (line 928) | func (*Response_Init) isResponse_Message() {}
type Response_Keepalive (line 905) | type Response_Keepalive struct
method isResponse_Message (line 929) | func (*Response_Keepalive) isResponse_Message() {}
type Response_Snapshot (line 908) | type Response_Snapshot struct
method isResponse_Message (line 930) | func (*Response_Snapshot) isResponse_Message() {}
type Response_Restore (line 911) | type Response_Restore struct
method isResponse_Message (line 931) | func (*Response_Restore) isResponse_Message() {}
type Response_Error (line 914) | type Response_Error struct
method isResponse_Message (line 932) | func (*Response_Error) isResponse_Message() {}
type Response_Begin (line 917) | type Response_Begin struct
method isResponse_Message (line 933) | func (*Response_Begin) isResponse_Message() {}
type Response_Point (line 920) | type Response_Point struct
method isResponse_Message (line 934) | func (*Response_Point) isResponse_Message() {}
type Response_End (line 923) | type Response_End struct
method isResponse_Message (line 935) | func (*Response_End) isResponse_Message() {}
function _Response_OneofMarshaler (line 1022) | func _Response_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
function _Response_OneofUnmarshaler (line 1078) | func _Response_OneofUnmarshaler(msg proto.Message, tag, wire int, b *pro...
function _Response_OneofSizer (line 1158) | func _Response_OneofSizer(msg proto.Message) (n int) {
function init (line 1214) | func init() {
function init (line 1238) | func init() { proto.RegisterFile("udf.proto", fileDescriptor0) }
FILE: vendor/github.com/influxdata/kapacitor/udf/server.go
type Server (line 38) | type Server struct
method In (line 124) | func (s *Server) In() chan<- edge.Message {
method Out (line 127) | func (s *Server) Out() <-chan edge.Message {
method setError (line 131) | func (s *Server) setError(err error) {
method Start (line 140) | func (s *Server) Start() error {
method Abort (line 177) | func (s *Server) Abort(err error) {
method abort (line 182) | func (s *Server) abort() {
method WaitIO (line 197) | func (s *Server) WaitIO() {
method Stop (line 205) | func (s *Server) Stop() error {
method stop (line 212) | func (s *Server) stop() error {
method Info (line 243) | func (s *Server) Info() (Info, error) {
method Init (line 263) | func (s *Server) Init(options []*agent.Option) error {
method Snapshot (line 284) | func (s *Server) Snapshot() ([]byte, error) {
method Restore (line 298) | func (s *Server) Restore(snapshot []byte) error {
method doRequestResponse (line 314) | func (s *Server) doRequestResponse(req *agent.Request, respC chan *age...
method doResponse (line 346) | func (s *Server) doResponse(response *agent.Response, respC chan *agen...
method runKeepalive (line 355) | func (s *Server) runKeepalive() {
method watchKeepalive (line 381) | func (s *Server) watchKeepalive() {
method writeData (line 437) | func (s *Server) writeData() error {
method writePoint (line 493) | func (s *Server) writePoint(p edge.PointMessage) error {
method fieldsToTypedMaps (line 515) | func (s *Server) fieldsToTypedMaps(fields models.Fields) (
method typeMapsToFields (line 550) | func (s *Server) typeMapsToFields(
method writeBeginBatch (line 572) | func (s *Server) writeBeginBatch(begin edge.BeginBatchMessage) error {
method writeBatchPoint (line 586) | func (s *Server) writeBatchPoint(group models.GroupID, bp edge.BatchPo...
method writeEndBatch (line 604) | func (s *Server) writeEndBatch(name string, tmax time.Time, groupInfo ...
method writeBufferedBatch (line 618) | func (s *Server) writeBufferedBatch(batch edge.BufferedBatchMessage) e...
method writeRequest (line 630) | func (s *Server) writeRequest(req *agent.Request) error {
method readData (line 639) | func (s *Server) readData() error {
method readResponse (line 659) | func (s *Server) readResponse() (*agent.Response, error) {
method handleResponse (line 668) | func (s *Server) handleResponse(response *agent.Response) error {
function NewServer (line 93) | func NewServer(
type Info (line 235) | type Info struct
FILE: vendor/github.com/influxdata/kapacitor/udf/server_test.go
function TestUDF_StartStop (line 18) | func TestUDF_StartStop(t *testing.T) {
function TestUDF_StartInitStop (line 35) | func TestUDF_StartInitStop(t *testing.T) {
function TestUDF_StartInitAbort (line 71) | func TestUDF_StartInitAbort(t *testing.T) {
function TestUDF_StartInfoStop (line 92) | func TestUDF_StartInfoStop(t *testing.T) {
function TestUDF_StartInfoAbort (line 134) | func TestUDF_StartInfoAbort(t *testing.T) {
function TestUDF_Keepalive (line 155) | func TestUDF_Keepalive(t *testing.T) {
function TestUDF_MissedKeepalive (line 190) | func TestUDF_MissedKeepalive(t *testing.T) {
function TestUDF_KillCallBack (line 218) | func TestUDF_KillCallBack(t *testing.T) {
function TestUDF_MissedKeepaliveInit (line 253) | func TestUDF_MissedKeepaliveInit(t *testing.T) {
function TestUDF_MissedKeepaliveInfo (line 281) | func TestUDF_MissedKeepaliveInfo(t *testing.T) {
function TestUDF_SnapshotRestore (line 309) | func TestUDF_SnapshotRestore(t *testing.T) {
function TestUDF_StartInitPointStop (line 378) | func TestUDF_StartInitPointStop(t *testing.T) {
function TestUDF_StartInitBatchStop (line 440) | func TestUDF_StartInitBatchStop(t *testing.T) {
FILE: vendor/github.com/influxdata/kapacitor/udf/udf.go
type Interface (line 9) | type Interface interface
FILE: vendor/github.com/influxdata/kapacitor/udf_test.go
function newUDFSocket (line 22) | func newUDFSocket(name string) (*kapacitor.UDFSocket, *udf_test.IO) {
function newUDFProcess (line 29) | func newUDFProcess(name string) (*kapacitor.UDFProcess, *udf_test.IO) {
function TestUDFSocket_OpenClose (line 37) | func TestUDFSocket_OpenClose(t *testing.T) {
function TestUDFProcess_OpenClose (line 41) | func TestUDFProcess_OpenClose(t *testing.T) {
function testUDF_OpenClose (line 46) | func testUDF_OpenClose(u udf.Interface, uio *udf_test.IO, t *testing.T) {
function TestUDFSocket_WritePoint (line 59) | func TestUDFSocket_WritePoint(t *testing.T) {
function TestUDFProcess_WritePoint (line 64) | func TestUDFProcess_WritePoint(t *testing.T) {
function testUDF_WritePoint (line 69) | func testUDF_WritePoint(u udf.Interface, uio *udf_test.IO, t *testing.T) {
function TestUDFSocket_WriteBatch (line 132) | func TestUDFSocket_WriteBatch(t *testing.T) {
function TestUDFProcess_WriteBatch (line 137) | func TestUDFProcess_WriteBatch(t *testing.T) {
function testUDF_WriteBatch (line 142) | func testUDF_WriteBatch(u udf.Interface, uio *udf_test.IO, t *testing.T) {
type testCommander (line 240) | type testCommander struct
method NewCommand (line 250) | func (c *testCommander) NewCommand(command.Spec) command.Command {
method Start (line 254) | func (c *testCommander) Start() error { return nil }
method Wait (line 256) | func (c *testCommander) Wait() error { return nil }
method Stdin (line 258) | func (c *testCommander) Stdin(io.Reader) {}
method Stdout (line 259) | func (c *testCommander) Stdout(io.Writer) {}
method Stderr (line 260) | func (c *testCommander) Stderr(io.Writer) {}
method StdinPipe (line 262) | func (c *testCommander) StdinPipe() (io.WriteCloser, error) {
method StdoutPipe (line 266) | func (c *testCommander) StdoutPipe() (io.Reader, error) {
method StderrPipe (line 270) | func (c *testCommander) StderrPipe() (io.Reader, error) {
method Kill (line 274) | func (c *testCommander) Kill() {
function newTestCommander (line 244) | func newTestCommander(uio *udf_test.IO) command.Commander {
type testSocket (line 278) | type testSocket struct
method Open (line 287) | func (s *testSocket) Open() error {
method Close (line 291) | func (s *testSocket) Close() error {
method In (line 295) | func (s *testSocket) In() io.WriteCloser {
method Out (line 299) | func (s *testSocket) Out() io.Reader {
function newTestSocket (line 282) | func newTestSocket(uio *udf_test.IO) kapacitor.Socket {
FILE: vendor/github.com/influxdata/kapacitor/union.go
type UnionNode (line 11) | type UnionNode struct
method runUnion (line 40) | func (n *UnionNode) runUnion([]byte) error {
method BufferedBatch (line 50) | func (n *UnionNode) BufferedBatch(src int, batch edge.BufferedBatchMes...
method Point (line 67) | func (n *UnionNode) Point(src int, p edge.PointMessage) error {
method Barrier (line 82) | func (n *UnionNode) Barrier(src int, b edge.BarrierMessage) error {
method Finish (line 93) | func (n *UnionNode) Finish() error {
method emitReady (line 98) | func (n *UnionNode) emitReady(drain bool) error {
method emit (line 154) | func (n *UnionNode) emit(m edge.Message) error {
type timeMessage (line 23) | type timeMessage interface
function newUnionNode (line 30) | func newUnionNode(et *ExecutingTask, n *pipeline.UnionNode, l *log.Logge...
FILE: vendor/github.com/influxdata/kapacitor/where.go
type WhereNode (line 14) | type WhereNode struct
method runWhere (line 44) | func (n *WhereNode) runWhere(snapshot []byte) error {
method NewGroup (line 54) | func (n *WhereNode) NewGroup(group edge.GroupInfo, first edge.PointMet...
method newGroup (line 61) | func (n *WhereNode) newGroup() *whereGroup {
function newWhereNode (line 24) | func newWhereNode(et *ExecutingTask, n *pipeline.WhereNode, l *log.Logge...
type whereGroup (line 68) | type whereGroup struct
method BeginBatch (line 73) | func (g *whereGroup) BeginBatch(begin edge.BeginBatchMessage) (edge.Me...
method BatchPoint (line 79) | func (g *whereGroup) BatchPoint(bp edge.BatchPointMessage) (edge.Messa...
method EndBatch (line 83) | func (g *whereGroup) EndBatch(end edge.EndBatchMessage) (edge.Message,...
method Point (line 87) | func (g *whereGroup) Point(p edge.PointMessage) (edge.Message, error) {
method doWhere (line 91) | func (g *whereGroup) doWhere(p edge.FieldsTagsTimeGetterMessage) (edge...
method Barrier (line 104) | func (g *whereGroup) Barrier(b edge.BarrierMessage) (edge.Message, err...
method DeleteGroup (line 107) | func (g *whereGroup) DeleteGroup(d edge.DeleteGroupMessage) (edge.Mess...
FILE: vendor/github.com/influxdata/kapacitor/window.go
type WindowNode (line 14) | type WindowNode struct
method runWindow (line 32) | func (n *WindowNode) runWindow([]byte) error {
method NewGroup (line 38) | func (n *WindowNode) NewGroup(group edge.GroupInfo, first edge.PointMe...
method DeleteGroup (line 49) | func (n *WindowNode) DeleteGroup(group models.GroupID) {
method newWindow (line 53) | func (n *WindowNode) newWindow(group edge.GroupInfo, first edge.PointM...
function newWindowNode (line 20) | func newWindowNode(et *ExecutingTask, n *pipeline.WindowNode, l *log.Log...
type windowByTime (line 80) | type windowByTime struct
method BeginBatch (line 140) | func (w *windowByTime) BeginBatch(edge.BeginBatchMessage) (edge.Messag...
method BatchPoint (line 143) | func (w *windowByTime) BatchPoint(edge.BatchPointMessage) (edge.Messag...
method EndBatch (line 146) | func (w *windowByTime) EndBatch(edge.EndBatchMessage) (edge.Message, e...
method Barrier (line 149) | func (w *windowByTime) Barrier(b edge.BarrierMessage) (edge.Message, e...
method DeleteGroup (line 153) | func (w *windowByTime) DeleteGroup(d edge.DeleteGroupMessage) (edge.Me...
method Point (line 157) | func (w *windowByTime) Point(p edge.PointMessage) (msg edge.Message, e...
method batch (line 198) | func (w *windowByTime) batch(tmax time.Time) edge.BufferedBatchMessage {
function newWindowByTime (line 97) | func newWindowByTime(
type windowTimeBuffer (line 214) | type windowTimeBuffer struct
method insert (line 223) | func (b *windowTimeBuffer) insert(p edge.PointMessage) {
method purge (line 264) | func (b *windowTimeBuffer) purge(oldest time.Time, inclusive bool) {
method points (line 303) | func (b *windowTimeBuffer) points() []edge.BatchPointMessage {
type windowByCount (line 329) | type windowByCount struct
method BeginBatch (line 367) | func (w *windowByCount) BeginBatch(edge.BeginBatchMessage) (edge.Messa...
method BatchPoint (line 370) | func (w *windowByCount) BatchPoint(edge.BatchPointMessage) (edge.Messa...
method EndBatch (line 373) | func (w *windowByCount) EndBatch(edge.EndBatchMessage) (edge.Message, ...
method Barrier (line 376) | func (w *windowByCount) Barrier(b edge.BarrierMessage) (edge.Message, ...
method DeleteGroup (line 380) | func (w *windowByCount) DeleteGroup(d edge.DeleteGroupMessage) (edge.M...
method Point (line 384) | func (w *windowByCount) Point(p edge.PointMessage) (msg edge.Message, ...
method batch (line 401) | func (w *windowByCount) batch() edge.BufferedBatchMessage {
method points (line 417) | func (w *windowByCount) points() []edge.BatchPointMessage {
function newWindowByCount (line 345) | func newWindowByCount(
FILE: vendor/github.com/influxdata/kapacitor/window_test.go
function TestWindowBufferByTime (line 16) | func TestWindowBufferByTime(t *testing.T) {
function TestWindowBufferByCount (line 88) | func TestWindowBufferByCount(t *testing.T) {
FILE: vendor/github.com/influxdata/wlog/writer.go
type Level (line 28) | type Level
constant _ (line 31) | _ Level = iota
constant DEBUG (line 32) | DEBUG
constant INFO (line 33) | INFO
constant WARN (line 34) | WARN
constant ERROR (line 35) | ERROR
constant OFF (line 36) | OFF
constant Delimiter (line 39) | Delimiter = '!'
function init (line 51) | func init() {
function SetLevel (line 64) | func SetLevel(l Level) {
function LogLevel (line 71) | func LogLevel() Level {
function SetLevelFromName (line 87) | func SetLevelFromName(level string) error {
type Writer (line 99) | type Writer struct
method Write (line 115) | func (w *Writer) Write(buf []byte) (int, error) {
function New (line 105) | func New(w io.Writer, prefix string, flag int) *log.Logger {
function NewWriter (line 110) | func NewWriter(w io.Writer) *Writer {
type StaticLevelWriter (line 147) | type StaticLevelWriter struct
method Write (line 163) | func (w *StaticLevelWriter) Write(buf []byte) (int, error) {
function NewStaticLevelWriter (line 155) | func NewStaticLevelWriter(w io.Writer, level Level) *StaticLevelWriter {
FILE: vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/all_test.go
function TestWriteDelimited (line 25) | func TestWriteDelimited(t *testing.T) {
function TestReadDelimited (line 81) | func TestReadDelimited(t *testing.T) {
function TestEndToEndValid (line 138) | func TestEndToEndValid(t *testing.T) {
FILE: vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode.go
function ReadDelimited (line 38) | func ReadDelimited(r io.Reader, m proto.Message) (n int, err error) {
FILE: vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode_test.go
function TestReadDelimitedIllegalVarint (line 24) | func TestReadDelimitedIllegalVarint(t *testing.T) {
function TestReadDelimitedPrematureHeader (line 53) | func TestReadDelimitedPrematureHeader(t *testing.T) {
function TestReadDelimitedPrematureBody (line 65) | func TestReadDelimitedPrematureBody(t *testing.T) {
function TestReadDelimitedPrematureHeaderIncremental (line 77) | func TestReadDelimitedPrematureHeaderIncremental(t *testing.T) {
function TestReadDelimitedPrematureBodyIncremental (line 89) | func TestReadDelimitedPrematureBodyIncremental(t *testing.T) {
FILE: vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode.go
function WriteDelimited (line 30) | func WriteDelimited(w io.Writer, m proto.Message) (n int, err error) {
FILE: vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode_test.go
type cantMarshal (line 27) | type cantMarshal struct
method Marshal (line 29) | func (cantMarshal) Marshal() ([]byte, error) { return nil, errMarshal }
function TestWriteDelimitedMarshalErr (line 33) | func TestWriteDelimitedMarshalErr(t *testing.T) {
type canMarshal (line 46) | type canMarshal struct
method Marshal (line 48) | func (canMarshal) Marshal() ([]byte, error) { return []byte{0, 1, 2, 3...
type cantWrite (line 52) | type cantWrite struct
method Write (line 54) | func (cantWrite) Write([]byte) (int, error) { return 0, errWrite }
function TestWriteDelimitedWriteErr (line 56) | func TestWriteDelimitedWriteErr(t *testing.T) {
FILE: vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/fixtures_test.go
function initGoTestField (line 39) | func initGoTestField() *GoTestField {
function initGoTest_RequiredGroup (line 49) | func initGoTest_RequiredGroup() *GoTest_RequiredGroup {
function initGoTest_OptionalGroup (line 55) | func initGoTest_OptionalGroup() *GoTest_OptionalGroup {
function initGoTest_RepeatedGroup (line 61) | func initGoTest_RepeatedGroup() *GoTest_RepeatedGroup {
function initGoTest (line 67) | func initGoTest(setdefaults bool) *GoTest {
FILE: vendor/github.com/pkg/errors/bench_test.go
function noErrors (line 12) | func noErrors(at, depth int) error {
function yesErrors (line 18) | func yesErrors(at, depth int) error {
function BenchmarkErrors (line 25) | func BenchmarkErrors(b *testing.B) {
FILE: vendor/github.com/pkg/errors/errors.go
function New (line 101) | func New(message string) error {
function Errorf (line 111) | func Errorf(format string, args ...interface{}) error {
type fundamental (line 119) | type fundamental struct
method Error (line 124) | func (f *fundamental) Error() string { return f.msg }
method Format (line 126) | func (f *fundamental) Format(s fmt.State, verb rune) {
function WithStack (line 144) | func WithStack(err error) error {
type withStack (line 154) | type withStack struct
method Cause (line 159) | func (w *withStack) Cause() error { return w.error }
method Format (line 161) | func (w *withStack) Format(s fmt.State, verb rune) {
function Wrap (line 180) | func Wrap(err error, message string) error {
function Wrapf (line 197) | func Wrapf(err error, format string, args ...interface{}) error {
function WithMessage (line 213) | func WithMessage(err error, message string) error {
type withMessage (line 223) | type withMessage struct
method Error (line 228) | func (w *withMessage) Error() string { return w.msg + ": " + w.cause.E...
method Cause (line 229) | func (w *withMessage) Cause() error { return w.cause }
method Format (line 231) | func (w *withMessage) Format(s fmt.State, verb rune) {
function Cause (line 256) | func Cause(err error) error {
FILE: vendor/github.com/pkg/errors/errors_test.go
function TestNew (line 11) | func TestNew(t *testing.T) {
function TestWrapNil (line 30) | func TestWrapNil(t *testing.T) {
function TestWrap (line 37) | func TestWrap(t *testing.T) {
type nilError (line 55) | type nilError struct
method Error (line 57) | func (nilError) Error() string { return "nil error" }
function TestCause (line 59) | func TestCause(t *testing.T) {
function TestWrapfNil (line 109) | func TestWrapfNil(t *testing.T) {
function TestWrapf (line 116) | func TestWrapf(t *testing.T) {
function TestErrorf (line 135) | func TestErrorf(t *testing.T) {
function TestWithStackNil (line 152) | func TestWithStackNil(t *testing.T) {
function TestWithStack (line 159) | func TestWithStack(t *testing.T) {
function TestWithMessageNil (line 176) | func TestWithMessageNil(t *testing.T) {
function TestWithMessage (line 183) | func TestWithMessage(t *testing.T) {
function TestErrorEquality (line 206) | func TestErrorEquality(t *testing.T) {
FILE: vendor/github.com/pkg/errors/example_test.go
function ExampleNew (line 9) | func ExampleNew() {
function ExampleNew_printf (line 16) | func ExampleNew_printf() {
function ExampleWithMessage (line 38) | func ExampleWithMessage() {
function ExampleWithStack (line 46) | func ExampleWithStack() {
function ExampleWithStack_printf (line 54) | func ExampleWithStack_printf() {
function ExampleWrap (line 91) | func ExampleWrap() {
function fn (line 99) | func fn() error {
function ExampleCause (line 106) | func ExampleCause() {
function ExampleWrap_extended (line 115) | func ExampleWrap_extended() {
function ExampleWrapf (line 145) | func ExampleWrapf() {
function ExampleErrorf_extended (line 153) | func ExampleErrorf_extended() {
function Example_stackTrace (line 175) | func Example_stackTrace() {
function ExampleCause_printf (line 195) | func ExampleCause_printf() {
FILE: vendor/github.com/pkg/errors/format_test.go
function TestFormatNew (line 12) | func TestFormatNew(t *testing.T) {
function TestFormatErrorf (line 42) | func TestFormatErrorf(t *testing.T) {
function TestFormatWrap (line 68) | func TestFormatWrap(t *testing.T) {
function TestFormatWrapf (line 120) | func TestFormatWrapf(t *testing.T) {
function TestFormatWithStack (line 161) | func TestFormatWithStack(t *testing.T) {
function TestFormatWithMessage (line 230) | func TestFormatWithMessage(t *testing.T) {
function TestFormatGeneric (line 310) | func TestFormatGeneric(t *testing.T) {
function testFormatRegexp (line 363) | func testFormatRegexp(t *testing.T, n int, arg interface{}, format, want...
function parseBlocks (line 403) | func parseBlocks(input string, detectStackboundaries bool) ([]string, er...
function testFormatCompleteCompare (line 456) | func testFormatCompleteCompare(t *testing.T, n int, arg interface{}, for...
type wrapper (line 489) | type wrapper struct
function prettyBlocks (line 494) | func prettyBlocks(blocks []string, prefix ...string) string {
function testGenericRecursive (line 504) | func testGenericRecursive(t *testing.T, beforeErr error, beforeWant []st...
FILE: vendor/github.com/pkg/errors/stack.go
type Frame (line 12) | type Frame
method pc (line 16) | func (f Frame) pc() uintptr { return uintptr(f) - 1 }
method file (line 20) | func (f Frame) file() string {
method line (line 31) | func (f Frame) line() int {
method Format (line 51) | func (f Frame) Format(s fmt.State, verb rune) {
type StackTrace (line 80) | type StackTrace
method Format (line 82) | func (st StackTrace) Format(s fmt.State, verb rune) {
type stack (line 101) | type stack
method Format (line 103) | func (s *stack) Format(st fmt.State, verb rune) {
method StackTrace (line 116) | func (s *stack) StackTrace() StackTrace {
function callers (line 124) | func callers() *stack {
function funcname (line 133) | func funcname(name string) string {
function trimGOPATH (line 140) | func trimGOPATH(name, file string) string {
FILE: vendor/github.com/pkg/errors/stack_test.go
function TestFrameLine (line 11) | func TestFrameLine(t *testing.T) {
type X (line 44) | type X struct
method val (line 46) | func (x X) val() Frame {
method ptr (line 51) | func (x *X) ptr() Frame {
function TestFrameFormat (line 56) | func TestFrameFormat(t *testing.T) {
function TestFuncname (line 128) | func TestFuncname(t *testing.T) {
function TestTrimGOPATH (line 149) | func TestTrimGOPATH(t *testing.T) {
function TestStackTrace (line 167) | func TestStackTrace(t *testing.T) {
function stackTrace (line 222) | func stackTrace() StackTrace {
function TestStackTraceFormat (line 230) | func TestStackTraceFormat(t *testing.T) {
FILE: vendor/github.com/pmezard/go-difflib/difflib/difflib.go
function min (line 26) | func min(a, b int) int {
function max (line 33) | func max(a, b int) int {
function calculateRatio (line 40) | func calculateRatio(matches, length int) float64 {
type Match (line 47) | type Match struct
type OpCode (line 53) | type OpCode struct
type SequenceMatcher (line 87) | type SequenceMatcher struct
method SetSeqs (line 115) | func (m *SequenceMatcher) SetSeqs(a, b []string) {
method SetSeq1 (line 129) | func (m *SequenceMatcher) SetSeq1(a []string) {
method SetSeq2 (line 140) | func (m *SequenceMatcher) SetSeq2(b []string) {
method chainB (line 151) | func (m *SequenceMatcher) chainB() {
method isBJunk (line 192) | func (m *SequenceMatcher) isBJunk(s string) bool {
method findLongestMatch (line 221) | func (m *SequenceMatcher) findLongestMatch(alo, ahi, blo, bhi int) Mat...
method GetMatchingBlocks (line 305) | func (m *SequenceMatcher) GetMatchingBlocks() []Match {
method GetOpCodes (line 373) | func (m *SequenceMatcher) GetOpCodes() []OpCode {
method GetGroupedOpCodes (line 413) | func (m *SequenceMatcher) GetGroupedOpCodes(n int) [][]OpCode {
method Ratio (line 465) | func (m *SequenceMatcher) Ratio() float64 {
method QuickRatio (line 477) | func (m *SequenceMatcher) QuickRatio() float64 {
method RealQuickRatio (line 509) | func (m *SequenceMatcher) RealQuickRatio() float64 {
function NewMatcher (line 100) | func NewMatcher(a, b []string) *SequenceMatcher {
function NewMatcherWithJunk (line 106) | func NewMatcherWithJunk(a, b []string, autoJunk bool,
function formatRangeUnified (line 515) | func formatRangeUnified(start, stop int) string {
type UnifiedDiff (line 529) | type UnifiedDiff struct
function WriteUnifiedDiff (line 559) | func WriteUnifiedDiff(writer io.Writer, diff UnifiedDiff) error {
function GetUnifiedDiffString (line 635) | func GetUnifiedDiffString(diff UnifiedDiff) (string, error) {
function formatRangeContext (line 642) | func formatRangeContext(start, stop int) string {
type ContextDiff (line 655) | type ContextDiff
function WriteContextDiff (line 674) | func WriteContextDiff(writer io.Writer, diff ContextDiff) error {
function GetContextDiffString (line 760) | func GetContextDiffString(diff ContextDiff) (string, error) {
function SplitLines (line 768) | func SplitLines(s string) []string {
FILE: vendor/github.com/pmezard/go-difflib/difflib/difflib_test.go
function assertAlmostEqual (line 12) | func assertAlmostEqual(t *testing.T, a, b float64, places int) {
function assertEqual (line 18) | func assertEqual(t *testing.T, a, b interface{}) {
function splitChars (line 24) | func splitChars(s string) []string {
function TestSequenceMatcherRatio (line 33) | func TestSequenceMatcherRatio(t *testing.T) {
function TestGetOptCodes (line 40) | func TestGetOptCodes(t *testing.T) {
function TestGroupedOpCodes (line 61) | func TestGroupedOpCodes(t *testing.T) {
function ExampleGetUnifiedDiffCode (line 105) | func ExampleGetUnifiedDiffCode() {
function ExampleGetContextDiffCode (line 138) | func ExampleGetContextDiffCode() {
function ExampleGetContextDiffString (line 175) | func ExampleGetContextDiffString() {
function rep (line 210) | func rep(s string, count int) string {
function TestWithAsciiOneInsert (line 214) | func TestWithAsciiOneInsert(t *testing.T) {
function TestWithAsciiOnDelete (line 230) | func TestWithAsciiOnDelete(t *testing.T) {
function TestWithAsciiBJunk (line 238) | func TestWithAsciiBJunk(t *testing.T) {
function TestSFBugsRatioForNullSeqn (line 258) | func TestSFBugsRatioForNullSeqn(t *testing.T) {
function TestSFBugsComparingEmptyLists (line 265) | func TestSFBugsComparingEmptyLists(t *testing.T) {
function TestOutputFormatRangeFormatUnified (line 278) | func TestOutputFormatRangeFormatUnified(t *testing.T) {
function TestOutputFormatRangeFormatContext (line 295) | func TestOutputFormatRangeFormatContext(t *testing.T) {
function TestOutputFormatTabDelimiter (line 319) | func TestOutputFormatTabDelimiter(t *testing.T) {
function TestOutputFormatNoTrailingTabOnEmptyFiledate (line 343) | func TestOutputFormatNoTrailingTabOnEmptyFiledate(t *testing.T) {
function TestOmitFilenames (line 360) | func TestOmitFilenames(t *testing.T) {
function TestSplitLines (line 395) | func TestSplitLines(t *testing.T) {
function benchmarkSplitLines (line 409) | func benchmarkSplitLines(b *testing.B, count int) {
function BenchmarkSplitLines100 (line 420) | func BenchmarkSplitLines100(b *testing.B) {
function BenchmarkSplitLines10000 (line 424) | func BenchmarkSplitLines10000(b *testing.B) {
FILE: vendor/github.com/prometheus/client_golang/prometheus/benchmark_test.go
function BenchmarkCounterWithLabelValues (line 21) | func BenchmarkCounterWithLabelValues(b *testing.B) {
function BenchmarkCounterWithLabelValuesConcurrent (line 36) | func BenchmarkCounterWithLabelValuesConcurrent(b *testing.B) {
function BenchmarkCounterWithMappedLabels (line 59) | func BenchmarkCounterWithMappedLabels(b *testing.B) {
function BenchmarkCounterWithPreparedMappedLabels (line 74) | func BenchmarkCounterWithPreparedMappedLabels(b *testing.B) {
function BenchmarkCounterNoLabels (line 90) | func BenchmarkCounterNoLabels(b *testing.B) {
function BenchmarkGaugeWithLabelValues (line 102) | func BenchmarkGaugeWithLabelValues(b *testing.B) {
function BenchmarkGaugeNoLabels (line 117) | func BenchmarkGaugeNoLabels(b *testing.B) {
function BenchmarkSummaryWithLabelValues (line 129) | func BenchmarkSummaryWithLabelValues(b *testing.B) {
function BenchmarkSummaryNoLabels (line 145) | func BenchmarkSummaryNoLabels(b *testing.B) {
function BenchmarkHistogramWithLabelValues (line 159) | func BenchmarkHistogramWithLabelValues(b *testing.B) {
function BenchmarkHistogramNoLabels (line 174) | func BenchmarkHistogramNoLabels(b *testing.B) {
FILE: vendor/github.com/prometheus/client_golang/prometheus/collector.go
type Collector (line 27) | type Collector interface
type selfCollector (line 56) | type selfCollector struct
method init (line 63) | func (c *selfCollector) init(self Metric) {
method Describe (line 68) | func (c *selfCollector) Describe(ch chan<- *Desc) {
method Collect (line 73) | func (c *selfCollector) Collect(ch chan<- Metric) {
FILE: vendor/github.com/prometheus/client_golang/prometheus/counter.go
type Counter (line 29) | type Counter interface
type CounterOpts (line 42) | type CounterOpts
function NewCounter (line 45) | func NewCounter(opts CounterOpts) Counter {
type counter (line 57) | type counter struct
method Add (line 61) | func (c *counter) Add(v float64) {
type CounterVec (line 73) | type CounterVec struct
method GetMetricWithLabelValues (line 122) | func (m *CounterVec) GetMetricWithLabelValues(lvs ...string) (Counter,...
method GetMetricWith (line 142) | func (m *CounterVec) GetMetricWith(labels Labels) (Counter, error) {
method WithLabelValues (line 154) | func (m *CounterVec) WithLabelValues(lvs ...string) Counter {
method With (line 161) | func (m *CounterVec) With(labels Labels) Counter {
function NewCounterVec (line 79) | func NewCounterVec(opts CounterOpts, labelNames []string) *CounterVec {
type CounterFunc (line 169) | type CounterFunc interface
function NewCounterFunc (line 182) | func NewCounterFunc(opts CounterOpts, function func() float64) CounterFu...
FILE: vendor/github.com/prometheus/client_golang/prometheus/counter_test.go
function TestCounterAdd (line 24) | func TestCounterAdd(t *testing.T) {
function decreaseCounter (line 51) | func decreaseCounter(c *counter) (err error) {
function TestCounterVecGetMetricWithInvalidLabelValues (line 61) | func TestCounterVecGetMetricWithInvalidLabelValues(t *testing.T) {
function expectPanic (line 106) | func expectPanic(t *testing.T, op func(), errorMsg string) {
FILE: vendor/github.com/prometheus/client_golang/prometheus/desc.go
type Desc (line 44) | type Desc struct
method String (line 174) | func (d *Desc) String() string {
function NewDesc (line 78) | func NewDesc(fqName, help string, variableLabels []string, constLabels L...
function NewInvalidDesc (line 168) | func NewInvalidDesc(err error) *Desc {
FILE: vendor/github.com/prometheus/client_golang/prometheus/desc_test.go
function TestNewDescInvalidLabelValues (line 7) | func TestNewDescInvalidLabelValues(t *testing.T) {
FILE: vendor/github.com/prometheus/client_golang/prometheus/example_clustermanager_test.go
type ClusterManager (line 27) | type ClusterManager struct
method ReallyExpensiveAssessmentOfTheSystemState (line 38) | func (c *ClusterManager) ReallyExpensiveAssessmentOfTheSystemState() (
method Describe (line 54) | func (c *ClusterManager) Describe(ch chan<- *prometheus.Desc) {
method Collect (line 64) | func (c *ClusterManager) Collect(ch chan<- prometheus.Metric) {
function NewClusterManager (line 91) | func NewClusterManager(zone string) *ClusterManager {
function ExampleCollector (line 109) | func ExampleCollector() {
FILE: vendor/github.com/prometheus/client_golang/prometheus/example_timer_complex_test.go
function handler (line 45) | func handler(w http.ResponseWriter, r *http.Request) {
function ExampleTimer_complex (line
Condensed preview — 352 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (2,362K chars).
[
{
"path": ".gitignore",
"chars": 0,
"preview": ""
},
{
"path": ".gitmodules",
"chars": 98,
"preview": "[submodule \"docs\"]\n\tpath = docs\n\turl = https://github.com/nvcook42/morgoth.git\n\tbranch = gh-pages\n"
},
{
"path": ".travis.yml",
"chars": 893,
"preview": "language: go\nsudo: false\ngo:\n - 1.7\n\ninstall: true\nscript:\n - go test -v $(go list ./... | grep -v vendor/)\n\nbefore_de"
},
{
"path": "Gopkg.toml",
"chars": 244,
"preview": "\n[[constraint]]\n branch = \"master\"\n name = \"github.com/influxdata/kapacitor\"\n\n[[constraint]]\n branch = \"master\"\n nam"
},
{
"path": "LICENSE",
"chars": 10173,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "README.md",
"chars": 7594,
"preview": "\nMorgoth [](https://travis-ci.org/nathanielc/"
},
{
"path": "cmd/morgoth/main.go",
"chars": 14807,
"preview": "package main\n\nimport (\n\t\"flag\"\n\t\"fmt\"\n\t\"log\"\n\t\"net\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"syscall\"\n\n\t\"github.com/influxdata/kap"
},
{
"path": "counter/counter.go",
"chars": 821,
"preview": "package counter\n\nimport (\n\t\"github.com/pkg/errors\"\n\t\"github.com/prometheus/client_golang/prometheus\"\n)\n\ntype Counter int"
},
{
"path": "counter/lossy_counter.go",
"chars": 2513,
"preview": "package counter\n\nimport (\n\t\"math\"\n\t\"strconv\"\n\t\"sync\"\n\n\t\"github.com/prometheus/client_golang/prometheus\"\n)\n\ntype lossyCou"
},
{
"path": "counter/lossy_counter_test.go",
"chars": 1936,
"preview": "package counter\n\nimport (\n\t\"math\"\n\t\"testing\"\n\n\t\"github.com/prometheus/client_golang/prometheus\"\n\t\"github.com/stretchr/te"
},
{
"path": "detector.go",
"chars": 4008,
"preview": "package morgoth\n\nimport (\n\t\"log\"\n\t\"sync\"\n\n\t\"github.com/nathanielc/morgoth/counter\"\n\t\"github.com/pkg/errors\"\n\t\"github.com"
},
{
"path": "fingerprint.go",
"chars": 210,
"preview": "package morgoth\n\nimport \"github.com/nathanielc/morgoth/counter\"\n\ntype Fingerprint interface {\n\tIsMatch(other counter.Cou"
},
{
"path": "fingerprinters/jsdiv/jsdiv.go",
"chars": 2855,
"preview": "package jsdiv\n\nimport (\n\t\"math\"\n\n\t\"github.com/nathanielc/morgoth\"\n\t\"github.com/nathanielc/morgoth/counter\"\n)\n\nconst iter"
},
{
"path": "fingerprinters/jsdiv/jsdiv_test.go",
"chars": 14,
"preview": "package jsdiv\n"
},
{
"path": "fingerprinters/kstest/kstest.go",
"chars": 2178,
"preview": "package kstest\n\nimport (\n\t\"math\"\n\t\"sort\"\n\n\t\"github.com/nathanielc/morgoth\"\n\t\"github.com/nathanielc/morgoth/counter\"\n)\n\nv"
},
{
"path": "fingerprinters/kstest/kstest_test.go",
"chars": 2107,
"preview": "package kstest\n\nimport (\n\t\"testing\"\n\n\t\"github.com/nathanielc/morgoth\"\n\t\"github.com/stretchr/testify/assert\"\n)\n\nfunc Test"
},
{
"path": "fingerprinters/sigma/sigma.go",
"chars": 1080,
"preview": "package sigma\n\nimport (\n\t\"math\"\n\n\t\"github.com/nathanielc/morgoth\"\n\t\"github.com/nathanielc/morgoth/counter\"\n)\n\n// Simple "
},
{
"path": "vendor/github.com/beorn7/perks/.gitignore",
"chars": 14,
"preview": "*.test\n*.prof\n"
},
{
"path": "vendor/github.com/beorn7/perks/LICENSE",
"chars": 1058,
"preview": "Copyright (C) 2013 Blake Mizerany\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this "
},
{
"path": "vendor/github.com/beorn7/perks/README.md",
"chars": 1882,
"preview": "# Perks for Go (golang.org)\n\nPerks contains the Go package quantile that computes approximate quantiles over\nan unbounde"
},
{
"path": "vendor/github.com/beorn7/perks/quantile/bench_test.go",
"chars": 1149,
"preview": "package quantile\n\nimport (\n\t\"testing\"\n)\n\nfunc BenchmarkInsertTargeted(b *testing.B) {\n\tb.ReportAllocs()\n\n\ts := NewTarget"
},
{
"path": "vendor/github.com/beorn7/perks/quantile/example_test.go",
"chars": 2715,
"preview": "// +build go1.1\n\npackage quantile_test\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\t\"strconv\"\n\t\"time\"\n\n\t\"github.com/beorn7/pe"
},
{
"path": "vendor/github.com/beorn7/perks/quantile/exampledata.txt",
"chars": 5339,
"preview": "8\n5\n26\n12\n5\n235\n13\n6\n28\n30\n3\n3\n3\n3\n5\n2\n33\n7\n2\n4\n7\n12\n14\n5\n8\n3\n10\n4\n5\n3\n6\n6\n209\n20\n3\n10\n14\n3\n4\n6\n8\n5\n11\n7\n3\n2\n3\n3\n212\n5\n2"
},
{
"path": "vendor/github.com/beorn7/perks/quantile/stream.go",
"chars": 7406,
"preview": "// Package quantile computes approximate quantiles over an unbounded data\n// stream within low memory and CPU bounds.\n//"
},
{
"path": "vendor/github.com/beorn7/perks/quantile/stream_test.go",
"chars": 5095,
"preview": "package quantile\n\nimport (\n\t\"math\"\n\t\"math/rand\"\n\t\"sort\"\n\t\"testing\"\n)\n\nvar (\n\tTargets = map[float64]float64{\n\t\t0.01: 0.00"
},
{
"path": "vendor/github.com/davecgh/go-spew/.gitignore",
"chars": 252,
"preview": "# Compiled Object files, Static and Dynamic libs (Shared Objects)\n*.o\n*.a\n*.so\n\n# Folders\n_obj\n_test\n\n# Architecture spe"
},
{
"path": "vendor/github.com/davecgh/go-spew/.travis.yml",
"chars": 389,
"preview": "language: go\ngo:\n - 1.5.4\n - 1.6.3\n - 1.7\ninstall:\n - go get -v golang.org/x/tools/cmd/cover\nscript:\n - g"
},
{
"path": "vendor/github.com/davecgh/go-spew/LICENSE",
"chars": 763,
"preview": "ISC License\n\nCopyright (c) 2012-2016 Dave Collins <dave@davec.name>\n\nPermission to use, copy, modify, and distribute thi"
},
{
"path": "vendor/github.com/davecgh/go-spew/README.md",
"chars": 7125,
"preview": "go-spew\n=======\n\n[]\n(https://travis-ci.org/davecgh/go-"
},
{
"path": "vendor/github.com/davecgh/go-spew/cov_report.sh",
"chars": 658,
"preview": "#!/bin/sh\n\n# This script uses gocov to generate a test coverage report.\n# The gocov tool my be obtained with the followi"
},
{
"path": "vendor/github.com/davecgh/go-spew/spew/bypass.go",
"chars": 5789,
"preview": "// Copyright (c) 2015-2016 Dave Collins <dave@davec.name>\n//\n// Permission to use, copy, modify, and distribute this sof"
},
{
"path": "vendor/github.com/davecgh/go-spew/spew/bypasssafe.go",
"chars": 1734,
"preview": "// Copyright (c) 2015-2016 Dave Collins <dave@davec.name>\n//\n// Permission to use, copy, modify, and distribute this sof"
},
{
"path": "vendor/github.com/davecgh/go-spew/spew/common.go",
"chars": 10364,
"preview": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this "
},
{
"path": "vendor/github.com/davecgh/go-spew/spew/common_test.go",
"chars": 7930,
"preview": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this "
},
{
"path": "vendor/github.com/davecgh/go-spew/spew/config.go",
"chars": 12842,
"preview": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this "
},
{
"path": "vendor/github.com/davecgh/go-spew/spew/doc.go",
"chars": 8527,
"preview": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this "
},
{
"path": "vendor/github.com/davecgh/go-spew/spew/dump.go",
"chars": 13813,
"preview": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this "
},
{
"path": "vendor/github.com/davecgh/go-spew/spew/dump_test.go",
"chars": 33788,
"preview": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this "
},
{
"path": "vendor/github.com/davecgh/go-spew/spew/dumpcgo_test.go",
"chars": 3872,
"preview": "// Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n//\n// Permission to use, copy, modify, and distribute this sof"
},
{
"path": "vendor/github.com/davecgh/go-spew/spew/dumpnocgo_test.go",
"chars": 1219,
"preview": "// Copyright (c) 2013 Dave Collins <dave@davec.name>\n//\n// Permission to use, copy, modify, and distribute this software"
},
{
"path": "vendor/github.com/davecgh/go-spew/spew/example_test.go",
"chars": 5580,
"preview": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this "
},
{
"path": "vendor/github.com/davecgh/go-spew/spew/format.go",
"chars": 11330,
"preview": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this "
},
{
"path": "vendor/github.com/davecgh/go-spew/spew/format_test.go",
"chars": 57536,
"preview": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this "
},
{
"path": "vendor/github.com/davecgh/go-spew/spew/internal_test.go",
"chars": 2575,
"preview": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this "
},
{
"path": "vendor/github.com/davecgh/go-spew/spew/internalunsafe_test.go",
"chars": 3321,
"preview": "// Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n\n// Permission to use, copy, modify, and distribute this softw"
},
{
"path": "vendor/github.com/davecgh/go-spew/spew/spew.go",
"chars": 5969,
"preview": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this "
},
{
"path": "vendor/github.com/davecgh/go-spew/spew/spew_test.go",
"chars": 9641,
"preview": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this "
},
{
"path": "vendor/github.com/davecgh/go-spew/test_coverage.txt",
"chars": 4414,
"preview": "\ngithub.com/davecgh/go-spew/spew/dump.go\t\t dumpState.dump\t\t\t 100.00% (88/88)\ngithub.com/davecgh/go-spew/spew/format.go\t "
},
{
"path": "vendor/github.com/golang/protobuf/.gitignore",
"chars": 160,
"preview": ".DS_Store\n*.[568ao]\n*.ao\n*.so\n*.pyc\n._*\n.nfs.*\n[568a].out\n*~\n*.orig\ncore\n_obj\n_test\n_testmain.go\nprotoc-gen-go/testdata/"
},
{
"path": "vendor/github.com/golang/protobuf/.travis.yml",
"chars": 350,
"preview": "sudo: false\nlanguage: go\ngo:\n- 1.6.x\n- 1.7.x\n- 1.8.x\n- 1.9.x\n\ninstall:\n - go get -v -d -t github.com/golang/protobuf/.."
},
{
"path": "vendor/github.com/golang/protobuf/AUTHORS",
"chars": 173,
"preview": "# This source code refers to The Go Authors for copyright purposes.\n# The master list of authors is in the main Go distr"
},
{
"path": "vendor/github.com/golang/protobuf/CONTRIBUTORS",
"chars": 170,
"preview": "# This source code was written by the Go contributors.\n# The master list of contributors is in the main Go distribution,"
},
{
"path": "vendor/github.com/golang/protobuf/LICENSE",
"chars": 1583,
"preview": "Go support for Protocol Buffers - Google's data interchange format\n\nCopyright 2010 The Go Authors. All rights reserved."
},
{
"path": "vendor/github.com/golang/protobuf/Make.protobuf",
"chars": 1955,
"preview": "# Go support for Protocol Buffers - Google's data interchange format\n#\n# Copyright 2010 The Go Authors. All rights rese"
},
{
"path": "vendor/github.com/golang/protobuf/Makefile",
"chars": 2113,
"preview": "# Go support for Protocol Buffers - Google's data interchange format\n#\n# Copyright 2010 The Go Authors. All rights rese"
},
{
"path": "vendor/github.com/golang/protobuf/README.md",
"chars": 9802,
"preview": "# Go support for Protocol Buffers\n\n[](https://tr"
},
{
"path": "vendor/github.com/golang/protobuf/proto/Makefile",
"chars": 1934,
"preview": "# Go support for Protocol Buffers - Google's data interchange format\n#\n# Copyright 2010 The Go Authors. All rights rese"
},
{
"path": "vendor/github.com/golang/protobuf/proto/all_test.go",
"chars": 67392,
"preview": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors. All rights r"
},
{
"path": "vendor/github.com/golang/protobuf/proto/any_test.go",
"chars": 8841,
"preview": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2016 The Go Authors. All rights r"
},
{
"path": "vendor/github.com/golang/protobuf/proto/clone.go",
"chars": 6969,
"preview": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2011 The Go Authors. All rights r"
},
{
"path": "vendor/github.com/golang/protobuf/proto/clone_test.go",
"chars": 8029,
"preview": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2011 The Go Authors. All rights r"
},
{
"path": "vendor/github.com/golang/protobuf/proto/decode.go",
"chars": 24427,
"preview": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors. All rights r"
},
{
"path": "vendor/github.com/golang/protobuf/proto/decode_test.go",
"chars": 7502,
"preview": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors. All rights r"
},
{
"path": "vendor/github.com/golang/protobuf/proto/encode.go",
"chars": 34774,
"preview": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors. All rights r"
},
{
"path": "vendor/github.com/golang/protobuf/proto/encode_test.go",
"chars": 2792,
"preview": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors. All rights r"
},
{
"path": "vendor/github.com/golang/protobuf/proto/equal.go",
"chars": 8625,
"preview": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2011 The Go Authors. All rights r"
},
{
"path": "vendor/github.com/golang/protobuf/proto/equal_test.go",
"chars": 8536,
"preview": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2011 The Go Authors. All rights r"
},
{
"path": "vendor/github.com/golang/protobuf/proto/extensions.go",
"chars": 18200,
"preview": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors. All rights r"
},
{
"path": "vendor/github.com/golang/protobuf/proto/extensions_test.go",
"chars": 16828,
"preview": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2014 The Go Authors. All rights r"
},
{
"path": "vendor/github.com/golang/protobuf/proto/lib.go",
"chars": 24168,
"preview": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors. All rights r"
},
{
"path": "vendor/github.com/golang/protobuf/proto/map_test.go",
"chars": 936,
"preview": "package proto_test\n\nimport (\n\t\"fmt\"\n\t\"testing\"\n\n\t\"github.com/golang/protobuf/proto\"\n\tppb \"github.com/golang/protobuf/pro"
},
{
"path": "vendor/github.com/golang/protobuf/proto/message_set.go",
"chars": 9097,
"preview": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors. All rights r"
},
{
"path": "vendor/github.com/golang/protobuf/proto/message_set_test.go",
"chars": 2608,
"preview": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2014 The Go Authors. All rights r"
},
{
"path": "vendor/github.com/golang/protobuf/proto/pointer_reflect.go",
"chars": 13896,
"preview": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2012 The Go Authors. All rights r"
},
{
"path": "vendor/github.com/golang/protobuf/proto/pointer_unsafe.go",
"chars": 9493,
"preview": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2012 The Go Authors. All rights r"
},
{
"path": "vendor/github.com/golang/protobuf/proto/properties.go",
"chars": 25817,
"preview": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors. All rights r"
},
{
"path": "vendor/github.com/golang/protobuf/proto/proto3_test.go",
"chars": 4354,
"preview": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2014 The Go Authors. All rights r"
},
{
"path": "vendor/github.com/golang/protobuf/proto/size2_test.go",
"chars": 2334,
"preview": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2012 The Go Authors. All rights r"
},
{
"path": "vendor/github.com/golang/protobuf/proto/size_test.go",
"chars": 8018,
"preview": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2012 The Go Authors. All rights r"
},
{
"path": "vendor/github.com/golang/protobuf/proto/text.go",
"chars": 21196,
"preview": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors. All rights r"
},
{
"path": "vendor/github.com/golang/protobuf/proto/text_parser.go",
"chars": 22429,
"preview": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors. All rights r"
},
{
"path": "vendor/github.com/golang/protobuf/proto/text_parser_test.go",
"chars": 15966,
"preview": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors. All rights r"
},
{
"path": "vendor/github.com/golang/protobuf/proto/text_test.go",
"chars": 12147,
"preview": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors. All rights r"
},
{
"path": "vendor/github.com/influxdata/kapacitor/.dockerignore",
"chars": 11,
"preview": ".git\nbuild\n"
},
{
"path": "vendor/github.com/influxdata/kapacitor/.gitattributes",
"chars": 25,
"preview": "CHANGELOG.md merge=union\n"
},
{
"path": "vendor/github.com/influxdata/kapacitor/.gitignore",
"chars": 241,
"preview": ".*.swp\ndist/*\n/build/*\n/*.conf\nkapacitor_linux*\nkapacitord_linux*\n/*.tick\n*~\n*#\nkapacitor*.rpm\nkapacitor*.deb\nkapacitor*"
},
{
"path": "vendor/github.com/influxdata/kapacitor/BLOB_STORE_DESIGN.md",
"chars": 2076,
"preview": "# Blob Store\n\nThe blob store is a mechanism to store arbitrary data in Kapacitor.\nThe data stored is immutable and opaqu"
},
{
"path": "vendor/github.com/influxdata/kapacitor/CHANGELOG.md",
"chars": 64406,
"preview": "# Changelog\n\n## Unreleased\n\n### Features\n- [#1413](https://github.com/influxdata/kapacitor/issues/1413): Add subscriptio"
},
{
"path": "vendor/github.com/influxdata/kapacitor/CONTRIBUTING.md",
"chars": 9344,
"preview": "Contributing to Kapacitor\n=========================\n\nBug reports\n---------------\nBefore you file an issue, please search"
},
{
"path": "vendor/github.com/influxdata/kapacitor/DESIGN.md",
"chars": 9168,
"preview": "# Kapacitor Internal Design\n\nThis document is meant to layout both the high level design of Kapacitor as well and discus"
},
{
"path": "vendor/github.com/influxdata/kapacitor/Dockerfile_build_ubuntu32",
"chars": 1593,
"preview": "FROM 32bit/ubuntu:16.04\n\n# This dockerfile capabable of the the minumum required\n# to run the tests and nothing else.\n\n"
},
{
"path": "vendor/github.com/influxdata/kapacitor/Dockerfile_build_ubuntu64",
"chars": 1921,
"preview": "FROM ubuntu:latest\n\n# This dockerfile is capabable of performing all\n# build/test/package/deploy actions needed for Kapa"
},
{
"path": "vendor/github.com/influxdata/kapacitor/Gopkg.toml",
"chars": 1147,
"preview": "required = [\"github.com/benbjohnson/tmpl\",\"github.com/golang/protobuf/protoc-gen-go\"]\n\n[[constraint]]\n branch = \"master"
},
{
"path": "vendor/github.com/influxdata/kapacitor/LICENSE",
"chars": 1076,
"preview": "The MIT License (MIT)\n\nCopyright (c) 2015 InfluxDB\n\nPermission is hereby granted, free of charge, to any person obtainin"
},
{
"path": "vendor/github.com/influxdata/kapacitor/LICENSE_OF_DEPENDENCIES.md",
"chars": 2007,
"preview": "Dependencies\n============\n\n* github.com/BurntSushi/toml [WTFPL](https://github.com/BurntSushi/toml/blob/master/COPYING)\n"
},
{
"path": "vendor/github.com/influxdata/kapacitor/README.md",
"chars": 2808,
"preview": "# Kapacitor [\n\nfunc Test_Combination_Count(t *testing.T) {\n\tc := combination{max: "
},
{
"path": "vendor/github.com/influxdata/kapacitor/default.go",
"chars": 2792,
"preview": "package kapacitor\n\nimport (\n\t\"log\"\n\n\t\"github.com/influxdata/kapacitor/edge\"\n\t\"github.com/influxdata/kapacitor/expvar\"\n\t\""
},
{
"path": "vendor/github.com/influxdata/kapacitor/delete.go",
"chars": 3544,
"preview": "package kapacitor\n\nimport (\n\t\"log\"\n\n\t\"github.com/influxdata/kapacitor/edge\"\n\t\"github.com/influxdata/kapacitor/expvar\"\n\t\""
},
{
"path": "vendor/github.com/influxdata/kapacitor/derivative.go",
"chars": 4149,
"preview": "package kapacitor\n\nimport (\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/influxdata/kapacitor/edge\"\n\t\"github.com/influxdata/kapacitor/mo"
},
{
"path": "vendor/github.com/influxdata/kapacitor/doc.go",
"chars": 950,
"preview": "/*\n\tA data pipeline processing engine.\n\n\tSee the README for more complete examples and guides.\n\n\tCode Organization:\n\n\tTh"
},
{
"path": "vendor/github.com/influxdata/kapacitor/edge.go",
"chars": 1433,
"preview": "package kapacitor\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"log\"\n\t\"sync\"\n\n\t\"github.com/influxdata/kapacitor/edge\"\n\t\"github.com/influx"
},
{
"path": "vendor/github.com/influxdata/kapacitor/eval.go",
"chars": 5479,
"preview": "package kapacitor\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/influxdata/kapacitor/edge\"\n\t\"github.com/influxdata/kap"
},
{
"path": "vendor/github.com/influxdata/kapacitor/expr.go",
"chars": 1730,
"preview": "package kapacitor\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/influxdata/kapacitor/edge\"\n\t\"github.com/influxdata/kapacitor/tick/ast\"\n"
},
{
"path": "vendor/github.com/influxdata/kapacitor/flatten.go",
"chars": 4779,
"preview": "package kapacitor\n\nimport (\n\t\"bytes\"\n\t\"log\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/influxdata/kapacitor/edge\"\n\t\"github.com/influx"
},
{
"path": "vendor/github.com/influxdata/kapacitor/gobuild.sh",
"chars": 442,
"preview": "#!/bin/bash\n# This script run inside the Dockerfile_build_ubuntu64_git container and\n# gets the latests Go source code a"
},
{
"path": "vendor/github.com/influxdata/kapacitor/group_by.go",
"chars": 4862,
"preview": "package kapacitor\n\nimport (\n\t\"log\"\n\t\"sort\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/influxdata/kapacitor/edge\"\n\t\"github.com/influxd"
},
{
"path": "vendor/github.com/influxdata/kapacitor/http_out.go",
"chars": 4020,
"preview": "package kapacitor\n\nimport (\n\t\"encoding/json\"\n\t\"log\"\n\t\"net/http\"\n\t\"path\"\n\t\"sync\"\n\n\t\"github.com/influxdata/kapacitor/edge\""
},
{
"path": "vendor/github.com/influxdata/kapacitor/http_post.go",
"chars": 3471,
"preview": "package kapacitor\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"log\"\n\t\"net/http\"\n\t\"sync\"\n\n\t\"github.com/influxdata/kapacitor/bufpoo"
},
{
"path": "vendor/github.com/influxdata/kapacitor/influxdb_out.go",
"chars": 7397,
"preview": "package kapacitor\n\nimport (\n\t\"bytes\"\n\t\"log\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/influxdata/influxdb/influxql\"\n\t\"github.com/inf"
},
{
"path": "vendor/github.com/influxdata/kapacitor/influxql.gen.go",
"chars": 26782,
"preview": "// Generated by tmpl\n// https://github.com/benbjohnson/tmpl\n//\n// DO NOT EDIT!\n// Source: influxql.gen.go.tmpl\n\npackage "
},
{
"path": "vendor/github.com/influxdata/kapacitor/influxql.gen.go.tmpl",
"chars": 5432,
"preview": "package kapacitor\n\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\t\"reflect\"\n\n\t\"github.com/influxdata/influxdb/influxql\"\n\t\"github.com/influxda"
},
{
"path": "vendor/github.com/influxdata/kapacitor/influxql.go",
"chars": 7834,
"preview": "package kapacitor\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"reflect\"\n\t\"time\"\n\n\t\"github.com/influxdata/kapacitor/edge\"\n\t\"github.com/influ"
},
{
"path": "vendor/github.com/influxdata/kapacitor/join.go",
"chars": 16007,
"preview": "package kapacitor\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/influxdata/influxdb/influxql\"\n\t\"github.com/influ"
},
{
"path": "vendor/github.com/influxdata/kapacitor/kapacitor_loopback.go",
"chars": 2804,
"preview": "package kapacitor\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/influxdata/kapacitor/edge\"\n\t\"github.com/influxdata/kapacitor/exp"
},
{
"path": "vendor/github.com/influxdata/kapacitor/list-deps",
"chars": 1106,
"preview": "#!/bin/bash\n\n# Make sure we are in the dir of the script\nDIR=$(cd \"$(dirname \"${BASH_SOURCE[0]}\")\" && pwd)\ncd $DIR\n\n# Li"
},
{
"path": "vendor/github.com/influxdata/kapacitor/log.go",
"chars": 2228,
"preview": "package kapacitor\n\nimport (\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"log\"\n\t\"strings\"\n\n\t\"github.com/influxdata/kapacitor/edge\"\n"
},
{
"path": "vendor/github.com/influxdata/kapacitor/metaclient.go",
"chars": 1088,
"preview": "package kapacitor\n\nimport (\n\t\"errors\"\n\t\"time\"\n\n\t\"github.com/influxdata/influxdb/services/meta\"\n)\n\ntype NoopMetaClient st"
},
{
"path": "vendor/github.com/influxdata/kapacitor/node.go",
"chars": 8440,
"preview": "package kapacitor\n\nimport (\n\t\"bytes\"\n\t\"expvar\"\n\t\"fmt\"\n\t\"log\"\n\t\"runtime\"\n\t\"sync\"\n\t\"sync/atomic\"\n\t\"time\"\n\n\t\"github.com/inf"
},
{
"path": "vendor/github.com/influxdata/kapacitor/noop.go",
"chars": 634,
"preview": "package kapacitor\n\nimport (\n\t\"log\"\n\n\t\"github.com/influxdata/kapacitor/edge\"\n\t\"github.com/influxdata/kapacitor/pipeline\"\n"
},
{
"path": "vendor/github.com/influxdata/kapacitor/output.go",
"chars": 167,
"preview": "package kapacitor\n\n// An output of a pipeline. Still need to improve this interface to expose different types of outputs"
},
{
"path": "vendor/github.com/influxdata/kapacitor/query.go",
"chars": 6795,
"preview": "package kapacitor\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/influxdata/influxdb/influxql\"\n\t\"github.com/influxdata/kapacitor"
},
{
"path": "vendor/github.com/influxdata/kapacitor/query_test.go",
"chars": 4218,
"preview": "package kapacitor_test\n\nimport (\n\t\"fmt\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/influxdata/kapacitor\"\n)\n\nfunc TestQuery_Clone(t"
},
{
"path": "vendor/github.com/influxdata/kapacitor/replay.go",
"chars": 6606,
"preview": "package kapacitor\n\nimport (\n\t\"bufio\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"io\"\n\t\"time\"\n\n\tdbmodels \"github.com/influxdata/influxdb/mo"
},
{
"path": "vendor/github.com/influxdata/kapacitor/result.go",
"chars": 819,
"preview": "package kapacitor\n\nimport (\n\t\"encoding/json\"\n\t\"io\"\n\t\"io/ioutil\"\n\t\"time\"\n\n\t\"github.com/influxdata/influxdb/influxql\"\n)\n\n/"
},
{
"path": "vendor/github.com/influxdata/kapacitor/sample.go",
"chars": 2333,
"preview": "package kapacitor\n\nimport (\n\t\"errors\"\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/influxdata/kapacitor/edge\"\n\t\"github.com/influxdata/ka"
},
{
"path": "vendor/github.com/influxdata/kapacitor/shift.go",
"chars": 1659,
"preview": "package kapacitor\n\nimport (\n\t\"errors\"\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/influxdata/kapacitor/edge\"\n\t\"github.com/influxdata/ka"
},
{
"path": "vendor/github.com/influxdata/kapacitor/state_tracking.go",
"chars": 4566,
"preview": "package kapacitor\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/influxdata/kapacitor/edge\"\n\t\"github.com/influxdata/kapac"
},
{
"path": "vendor/github.com/influxdata/kapacitor/stats.go",
"chars": 2077,
"preview": "package kapacitor\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/influxdata/kapacitor/edge\"\n\t\"github.com/influxda"
},
{
"path": "vendor/github.com/influxdata/kapacitor/stream.go",
"chars": 3614,
"preview": "package kapacitor\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/influxdata/kapacitor/edge\"\n\t\"github.com/influxdata/kap"
},
{
"path": "vendor/github.com/influxdata/kapacitor/task.go",
"chars": 12643,
"preview": "package kapacitor\n\nimport (\n\t\"bytes\"\n\t\"errors\"\n\t\"fmt\"\n\t\"log\"\n\t\"math/rand\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/influxdata/kapac"
},
{
"path": "vendor/github.com/influxdata/kapacitor/task_master.go",
"chars": 20785,
"preview": "package kapacitor\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"log\"\n\t\"sync\"\n\t\"time\"\n\n\timodels \"github.com/influxdata/influxdb/models\"\n\t\""
},
{
"path": "vendor/github.com/influxdata/kapacitor/template.go",
"chars": 321,
"preview": "package kapacitor\n\nimport (\n\t\"github.com/influxdata/kapacitor/pipeline\"\n\t\"github.com/influxdata/kapacitor/tick\"\n)\n\ntype "
},
{
"path": "vendor/github.com/influxdata/kapacitor/test.sh",
"chars": 4234,
"preview": "#!/bin/bash\n#\n# This is the Kapacitor test script.\n# This script can run tests in different environments.\n# # Usage: ./t"
},
{
"path": "vendor/github.com/influxdata/kapacitor/tmpldata.json",
"chars": 499,
"preview": "[\n\t{\n\t\t\"Name\":\"Float\",\n\t\t\"name\":\"float\",\n\t\t\"Type\":\"float64\",\n\t\t\"Kind\":\"reflect.Float64\",\n\t\t\"Nil\":\"0\",\n\t\t\"Zero\":\"float64("
},
{
"path": "vendor/github.com/influxdata/kapacitor/udf/agent/README.md",
"chars": 4275,
"preview": "# UDF Agents and Servers\n\nA UDF is a User Defined Function, meaning that you can write your own functions/algorithms and"
},
{
"path": "vendor/github.com/influxdata/kapacitor/udf/agent/agent.go",
"chars": 5495,
"preview": "package agent\n\nimport (\n\t\"bufio\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"sync\"\n)\n\n// The Agent calls the appropriate methods on the Han"
},
{
"path": "vendor/github.com/influxdata/kapacitor/udf/agent/io.go",
"chars": 1576,
"preview": "package agent\n\nimport (\n\t\"encoding/binary\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/golang/protobuf/proto\"\n)\n\n//go:generate protoc --g"
},
{
"path": "vendor/github.com/influxdata/kapacitor/udf/agent/io_test.go",
"chars": 1198,
"preview": "package agent_test\n\nimport (\n\t\"bytes\"\n\t\"reflect\"\n\t\"testing\"\n\n\t\"github.com/influxdata/kapacitor/udf/agent\"\n)\n\nfunc TestMe"
},
{
"path": "vendor/github.com/influxdata/kapacitor/udf/agent/server.go",
"chars": 1988,
"preview": "package agent\n\nimport (\n\t\"net\"\n\t\"os\"\n\t\"os/signal\"\n\t\"sync\"\n)\n\n// A server accepts connections on a listener and\n// spawns"
},
{
"path": "vendor/github.com/influxdata/kapacitor/udf/agent/udf.pb.go",
"chars": 45826,
"preview": "// Code generated by protoc-gen-go.\n// source: udf.proto\n// DO NOT EDIT!\n\n/*\nPackage agent is a generated protocol buffe"
},
{
"path": "vendor/github.com/influxdata/kapacitor/udf/agent/udf.proto",
"chars": 6935,
"preview": "syntax = \"proto3\";\n\npackage agent;\n\n//------------------------------------------------------\n// RPC Messages for Kapacit"
},
{
"path": "vendor/github.com/influxdata/kapacitor/udf/server.go",
"chars": 17484,
"preview": "package udf\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"log\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/influxdata/kapacitor/edge\"\n\t\"github.co"
},
{
"path": "vendor/github.com/influxdata/kapacitor/udf/server_test.go",
"chars": 12413,
"preview": "package udf_test\n\nimport (\n\t\"errors\"\n\t\"log\"\n\t\"os\"\n\t\"reflect\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/influxdata/kapacitor/edge\""
},
{
"path": "vendor/github.com/influxdata/kapacitor/udf/udf.go",
"chars": 402,
"preview": "package udf\n\nimport (\n\t\"github.com/influxdata/kapacitor/edge\"\n\t\"github.com/influxdata/kapacitor/udf/agent\"\n)\n\n// Interfa"
},
{
"path": "vendor/github.com/influxdata/kapacitor/udf.go",
"chars": 8637,
"preview": "package kapacitor\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"io\"\n\t\"log\"\n\t\"net\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/cenkalti/backoff\"\n\t\"github"
},
{
"path": "vendor/github.com/influxdata/kapacitor/udf_test.go",
"chars": 6421,
"preview": "package kapacitor_test\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"log\"\n\t\"os\"\n\t\"reflect\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/influxda"
},
{
"path": "vendor/github.com/influxdata/kapacitor/union.go",
"chars": 3539,
"preview": "package kapacitor\n\nimport (\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/influxdata/kapacitor/edge\"\n\t\"github.com/influxdata/kapacitor/pi"
},
{
"path": "vendor/github.com/influxdata/kapacitor/update_tick_docs.sh",
"chars": 372,
"preview": "#!/bin/bash\n\n# To generate the tick docs we use a little utility similar\n# to godoc called tickdoc. It organizes the fie"
},
{
"path": "vendor/github.com/influxdata/kapacitor/where.go",
"chars": 2634,
"preview": "package kapacitor\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/influxdata/kapacitor/edge\"\n\t\"github.com/influxdata/kap"
},
{
"path": "vendor/github.com/influxdata/kapacitor/window.go",
"chars": 10339,
"preview": "package kapacitor\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/influxdata/kapacitor/edge\"\n\t\"github.com/influx"
},
{
"path": "vendor/github.com/influxdata/kapacitor/window_test.go",
"chars": 4130,
"preview": "package kapacitor\n\nimport (\n\t\"log\"\n\t\"os\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/influxdata/kapacitor/edge\"\n\t\"github.com/influx"
},
{
"path": "vendor/github.com/influxdata/wlog/LICENSE",
"chars": 1077,
"preview": "The MIT License (MIT)\n\nCopyright (c) 2016 InfluxData\n\nPermission is hereby granted, free of charge, to any person obtain"
},
{
"path": "vendor/github.com/influxdata/wlog/README.md",
"chars": 1558,
"preview": "# wlog\nSimple log level based Go logger.\nProvides an io.Writer that filters log messages based on a log level prefix.\nVa"
},
{
"path": "vendor/github.com/influxdata/wlog/writer.go",
"chars": 3485,
"preview": "/*\n\tProvides an io.Writer that filters log messages based on a log level.\n\n\tValid log levels are: DEBUG, INFO, WARN, ERR"
},
{
"path": "vendor/github.com/matttproud/golang_protobuf_extensions/.travis.yml",
"chars": 14,
"preview": "language: go\n\n"
},
{
"path": "vendor/github.com/matttproud/golang_protobuf_extensions/LICENSE",
"chars": 11357,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "vendor/github.com/matttproud/golang_protobuf_extensions/NOTICE",
"chars": 52,
"preview": "Copyright 2012 Matt T. Proud (matt.proud@gmail.com)\n"
},
{
"path": "vendor/github.com/matttproud/golang_protobuf_extensions/README.md",
"chars": 963,
"preview": "# Overview\nThis repository provides various Protocol Buffer extensions for the Go\nlanguage (golang), namely support for "
},
{
"path": "vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/all_test.go",
"chars": 6640,
"preview": "// Copyright 2013 Matt T. Proud\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use"
},
{
"path": "vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode.go",
"chars": 2836,
"preview": "// Copyright 2013 Matt T. Proud\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use"
},
{
"path": "vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode_test.go",
"chars": 3132,
"preview": "// Copyright 2016 Matt T. Proud\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use"
},
{
"path": "vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/doc.go",
"chars": 684,
"preview": "// Copyright 2013 Matt T. Proud\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use"
},
{
"path": "vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode.go",
"chars": 1510,
"preview": "// Copyright 2013 Matt T. Proud\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use"
},
{
"path": "vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode_test.go",
"chars": 1952,
"preview": "// Copyright 2016 Matt T. Proud\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use"
},
{
"path": "vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/fixtures_test.go",
"chars": 3958,
"preview": "// Copyright 2010 The Go Authors. All rights reserved.\n// http://github.com/golang/protobuf/\n//\n// Redistribution and u"
},
{
"path": "vendor/github.com/pkg/errors/.gitignore",
"chars": 266,
"preview": "# Compiled Object files, Static and Dynamic libs (Shared Objects)\n*.o\n*.a\n*.so\n\n# Folders\n_obj\n_test\n\n# Architecture spe"
},
{
"path": "vendor/github.com/pkg/errors/.travis.yml",
"chars": 133,
"preview": "language: go\ngo_import_path: github.com/pkg/errors\ngo:\n - 1.4.3\n - 1.5.4\n - 1.6.2\n - 1.7.1\n - tip\n\nscript:\n - go t"
},
{
"path": "vendor/github.com/pkg/errors/LICENSE",
"chars": 1312,
"preview": "Copyright (c) 2015, Dave Cheney <dave@cheney.net>\nAll rights reserved.\n\nRedistribution and use in source and binary form"
},
{
"path": "vendor/github.com/pkg/errors/README.md",
"chars": 2242,
"preview": "# errors [](https://travis-ci.org/pkg/errors) [\n\nfunc noErrors(at, depth int) error {"
},
{
"path": "vendor/github.com/pkg/errors/errors.go",
"chars": 6838,
"preview": "// Package errors provides simple error handling primitives.\n//\n// The traditional error handling idiom in Go is roughly"
},
{
"path": "vendor/github.com/pkg/errors/errors_test.go",
"chars": 4856,
"preview": "package errors\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"reflect\"\n\t\"testing\"\n)\n\nfunc TestNew(t *testing.T) {\n\ttests := []struct"
},
{
"path": "vendor/github.com/pkg/errors/example_test.go",
"chars": 5437,
"preview": "package errors_test\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/pkg/errors\"\n)\n\nfunc ExampleNew() {\n\terr := errors.New(\"whoops\")\n\tfmt."
},
{
"path": "vendor/github.com/pkg/errors/format_test.go",
"chars": 12799,
"preview": "package errors\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"regexp\"\n\t\"strings\"\n\t\"testing\"\n)\n\nfunc TestFormatNew(t *testing.T) {\n\tt"
},
{
"path": "vendor/github.com/pkg/errors/stack.go",
"chars": 4412,
"preview": "package errors\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"path\"\n\t\"runtime\"\n\t\"strings\"\n)\n\n// Frame represents a program counter inside a st"
},
{
"path": "vendor/github.com/pkg/errors/stack_test.go",
"chars": 5539,
"preview": "package errors\n\nimport (\n\t\"fmt\"\n\t\"runtime\"\n\t\"testing\"\n)\n\nvar initpc, _, _, _ = runtime.Caller(0)\n\nfunc TestFrameLine(t *"
},
{
"path": "vendor/github.com/pmezard/go-difflib/.travis.yml",
"chars": 34,
"preview": "language: go\ngo:\n - 1.5\n - tip\n\n"
},
{
"path": "vendor/github.com/pmezard/go-difflib/LICENSE",
"chars": 1445,
"preview": "Copyright (c) 2013, Patrick Mezard\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or with"
},
{
"path": "vendor/github.com/pmezard/go-difflib/README.md",
"chars": 1121,
"preview": "go-difflib\n==========\n\n[](https://travis-ci.o"
},
{
"path": "vendor/github.com/pmezard/go-difflib/difflib/difflib.go",
"chars": 22879,
"preview": "// Package difflib is a partial port of Python difflib module.\n//\n// It provides tools to compare sequences of strings a"
},
{
"path": "vendor/github.com/pmezard/go-difflib/difflib/difflib_test.go",
"chars": 10391,
"preview": "package difflib\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"math\"\n\t\"reflect\"\n\t\"strings\"\n\t\"testing\"\n)\n\nfunc assertAlmostEqual(t *testing."
},
{
"path": "vendor/github.com/prometheus/client_golang/.gitignore",
"chars": 266,
"preview": "# Compiled Object files, Static and Dynamic libs (Shared Objects)\n*.o\n*.a\n*.so\n\n# Folders\n_obj\n_test\n\n# Architecture spe"
},
{
"path": "vendor/github.com/prometheus/client_golang/.travis.yml",
"chars": 88,
"preview": "sudo: false\nlanguage: go\n\ngo:\n - 1.6.3\n - 1.7\n - 1.8.1\n\nscript:\n - go test -short ./...\n"
},
{
"path": "vendor/github.com/prometheus/client_golang/CHANGELOG.md",
"chars": 5428,
"preview": "## 0.8.0 / 2016-08-17\n* [CHANGE] Registry is doing more consistency checks. This might break\n existing setups that used"
},
{
"path": "vendor/github.com/prometheus/client_golang/CONTRIBUTING.md",
"chars": 870,
"preview": "# Contributing\n\nPrometheus uses GitHub to manage reviews of pull requests.\n\n* If you have a trivial fix or improvement, "
},
{
"path": "vendor/github.com/prometheus/client_golang/LICENSE",
"chars": 11357,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "vendor/github.com/prometheus/client_golang/MAINTAINERS.md",
"chars": 42,
"preview": "* Björn Rabenstein <beorn@soundcloud.com>\n"
},
{
"path": "vendor/github.com/prometheus/client_golang/NOTICE",
"chars": 841,
"preview": "Prometheus instrumentation library for Go applications\nCopyright 2012-2015 The Prometheus Authors\n\nThis product includes"
},
{
"path": "vendor/github.com/prometheus/client_golang/README.md",
"chars": 2495,
"preview": "# Prometheus Go client library\n\n[](http"
},
{
"path": "vendor/github.com/prometheus/client_golang/VERSION",
"chars": 6,
"preview": "0.8.0\n"
}
]
// ... and 152 more files (download for full content)
About this extraction
This page contains the full source code of the nathanielc/morgoth GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 352 files (2.0 MB), approximately 554.3k tokens, and a symbol index with 3443 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.