├── .gitignore
├── README.md
├── collector
└── my_collector.go
├── prometheus-exporter.go
└── vendor
└── github.com
├── beorn7
└── perks
│ ├── .gitignore
│ ├── LICENSE
│ ├── README.md
│ ├── histogram
│ ├── bench_test.go
│ ├── histogram.go
│ └── histogram_test.go
│ ├── quantile
│ ├── bench_test.go
│ ├── example_test.go
│ ├── exampledata.txt
│ ├── stream.go
│ └── stream_test.go
│ └── topk
│ ├── topk.go
│ └── topk_test.go
├── golang
└── protobuf
│ ├── .gitignore
│ ├── .travis.yml
│ ├── AUTHORS
│ ├── CONTRIBUTORS
│ ├── LICENSE
│ ├── Make.protobuf
│ ├── Makefile
│ ├── README.md
│ ├── _conformance
│ ├── Makefile
│ ├── conformance.go
│ └── conformance_proto
│ │ ├── conformance.pb.go
│ │ └── conformance.proto
│ ├── descriptor
│ ├── descriptor.go
│ └── descriptor_test.go
│ ├── jsonpb
│ ├── jsonpb.go
│ ├── jsonpb_test.go
│ └── jsonpb_test_proto
│ │ ├── Makefile
│ │ ├── more_test_objects.pb.go
│ │ ├── more_test_objects.proto
│ │ ├── test_objects.pb.go
│ │ └── test_objects.proto
│ ├── 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_proto
│ │ ├── proto3.pb.go
│ │ └── proto3.proto
│ ├── proto3_test.go
│ ├── size2_test.go
│ ├── size_test.go
│ ├── testdata
│ │ ├── Makefile
│ │ ├── golden_test.go
│ │ ├── test.pb.go
│ │ └── test.proto
│ ├── text.go
│ ├── text_parser.go
│ ├── text_parser_test.go
│ └── text_test.go
│ ├── protoc-gen-go
│ ├── Makefile
│ ├── descriptor
│ │ ├── Makefile
│ │ ├── descriptor.pb.go
│ │ └── descriptor.proto
│ ├── doc.go
│ ├── generator
│ │ ├── Makefile
│ │ ├── generator.go
│ │ └── name_test.go
│ ├── grpc
│ │ └── grpc.go
│ ├── link_grpc.go
│ ├── main.go
│ ├── plugin
│ │ ├── Makefile
│ │ ├── plugin.pb.go
│ │ ├── plugin.pb.golden
│ │ └── plugin.proto
│ └── testdata
│ │ ├── Makefile
│ │ ├── extension_base.proto
│ │ ├── extension_extra.proto
│ │ ├── extension_test.go
│ │ ├── extension_user.proto
│ │ ├── grpc.proto
│ │ ├── imp.pb.go.golden
│ │ ├── imp.proto
│ │ ├── imp2.proto
│ │ ├── imp3.proto
│ │ ├── main_test.go
│ │ ├── multi
│ │ ├── multi1.proto
│ │ ├── multi2.proto
│ │ └── multi3.proto
│ │ ├── my_test
│ │ ├── test.pb.go
│ │ ├── test.pb.go.golden
│ │ └── test.proto
│ │ └── proto3.proto
│ └── ptypes
│ ├── any.go
│ ├── any
│ ├── any.pb.go
│ └── any.proto
│ ├── any_test.go
│ ├── doc.go
│ ├── duration.go
│ ├── duration
│ ├── duration.pb.go
│ └── duration.proto
│ ├── duration_test.go
│ ├── empty
│ ├── empty.pb.go
│ └── empty.proto
│ ├── regen.sh
│ ├── struct
│ ├── struct.pb.go
│ └── struct.proto
│ ├── timestamp.go
│ ├── timestamp
│ ├── timestamp.pb.go
│ └── timestamp.proto
│ ├── timestamp_test.go
│ └── wrappers
│ ├── wrappers.pb.go
│ └── wrappers.proto
├── matttproud
└── golang_protobuf_extensions
│ ├── .travis.yml
│ ├── LICENSE
│ ├── Makefile.TRAVIS
│ ├── NOTICE
│ ├── README.md
│ ├── ext
│ └── moved.go
│ ├── pbtest
│ └── deleted.go
│ ├── pbutil
│ ├── .gitignore
│ ├── Makefile
│ ├── all_test.go
│ ├── decode.go
│ ├── decode_test.go
│ ├── doc.go
│ ├── encode.go
│ └── encode_test.go
│ └── testdata
│ ├── README.THIRD_PARTY
│ ├── test.pb.go
│ └── test.proto
└── prometheus
├── client_golang
├── .gitignore
├── .travis.yml
├── CHANGELOG.md
├── CONTRIBUTING.md
├── ISSUE_TEMPLATE.md
├── LICENSE
├── MAINTAINERS.md
├── NOTICE
├── README.md
├── VERSION
├── api
│ ├── client.go
│ ├── client_test.go
│ └── prometheus
│ │ └── v1
│ │ ├── api.go
│ │ └── api_test.go
├── examples
│ ├── random
│ │ ├── Dockerfile
│ │ └── main.go
│ └── simple
│ │ ├── Dockerfile
│ │ └── main.go
└── 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
│ ├── graphite
│ ├── bridge.go
│ └── bridge_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
│ ├── promauto
│ └── auto.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
│ ├── push
│ ├── deprecated.go
│ ├── example_add_from_gatherer_test.go
│ ├── examples_test.go
│ ├── push.go
│ └── push_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
├── cpp
│ ├── metrics.pb.cc
│ └── metrics.pb.h
├── go
│ └── metrics.pb.go
├── metrics.proto
├── pom.xml
├── python
│ └── prometheus
│ │ ├── __init__.py
│ │ └── client
│ │ ├── __init__.py
│ │ └── model
│ │ ├── __init__.py
│ │ └── metrics_pb2.py
├── ruby
│ ├── .gitignore
│ ├── Gemfile
│ ├── LICENSE
│ ├── Makefile
│ ├── README.md
│ ├── Rakefile
│ ├── lib
│ │ └── prometheus
│ │ │ └── client
│ │ │ ├── model.rb
│ │ │ └── model
│ │ │ ├── metrics.pb.rb
│ │ │ └── version.rb
│ └── prometheus-client-model.gemspec
├── setup.py
└── src
│ └── main
│ └── java
│ └── io
│ └── prometheus
│ └── client
│ └── Metrics.java
├── common
├── .travis.yml
├── CONTRIBUTING.md
├── LICENSE
├── MAINTAINERS.md
├── NOTICE
├── README.md
├── config
│ ├── config.go
│ ├── http_config.go
│ ├── http_config_test.go
│ ├── testdata
│ │ ├── http.conf.bearer-token-and-file-set.bad.yml
│ │ ├── http.conf.empty.bad.yml
│ │ ├── http.conf.good.yml
│ │ ├── http.conf.invalid-bearer-token-file.bad.yml
│ │ ├── tls_config.cert_no_key.bad.yml
│ │ ├── tls_config.empty.good.yml
│ │ ├── tls_config.insecure.good.yml
│ │ ├── tls_config.invalid_field.bad.yml
│ │ └── tls_config.key_no_cert.bad.yml
│ └── tls_config_test.go
├── expfmt
│ ├── bench_test.go
│ ├── decode.go
│ ├── decode_test.go
│ ├── encode.go
│ ├── expfmt.go
│ ├── fuzz.go
│ ├── fuzz
│ │ └── corpus
│ │ │ ├── from_test_parse_0
│ │ │ ├── from_test_parse_1
│ │ │ ├── from_test_parse_2
│ │ │ ├── from_test_parse_3
│ │ │ ├── from_test_parse_4
│ │ │ ├── from_test_parse_error_0
│ │ │ ├── from_test_parse_error_1
│ │ │ ├── from_test_parse_error_10
│ │ │ ├── from_test_parse_error_11
│ │ │ ├── from_test_parse_error_12
│ │ │ ├── from_test_parse_error_13
│ │ │ ├── from_test_parse_error_14
│ │ │ ├── from_test_parse_error_15
│ │ │ ├── from_test_parse_error_16
│ │ │ ├── from_test_parse_error_17
│ │ │ ├── from_test_parse_error_18
│ │ │ ├── from_test_parse_error_19
│ │ │ ├── from_test_parse_error_2
│ │ │ ├── from_test_parse_error_3
│ │ │ ├── from_test_parse_error_4
│ │ │ ├── from_test_parse_error_5
│ │ │ ├── from_test_parse_error_6
│ │ │ ├── from_test_parse_error_7
│ │ │ ├── from_test_parse_error_8
│ │ │ ├── from_test_parse_error_9
│ │ │ └── minimal
│ ├── testdata
│ │ ├── json2
│ │ ├── json2_bad
│ │ ├── protobuf
│ │ ├── protobuf.gz
│ │ ├── text
│ │ └── text.gz
│ ├── 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
├── log
│ ├── eventlog_formatter.go
│ ├── log.go
│ ├── log_test.go
│ ├── syslog_formatter.go
│ └── syslog_formatter_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
├── promlog
│ ├── flag
│ │ └── flag.go
│ └── log.go
├── route
│ ├── route.go
│ └── route_test.go
└── version
│ └── info.go
└── procfs
├── .travis.yml
├── CONTRIBUTING.md
├── LICENSE
├── MAINTAINERS.md
├── Makefile
├── NOTICE
├── README.md
├── bcache
├── bcache.go
├── get.go
└── get_test.go
├── buddyinfo.go
├── buddyinfo_test.go
├── doc.go
├── fixtures
├── 584
│ └── stat
├── 26231
│ ├── cmdline
│ ├── comm
│ ├── exe
│ ├── fd
│ │ ├── 0
│ │ ├── 1
│ │ ├── 2
│ │ ├── 3
│ │ └── 10
│ ├── io
│ ├── limits
│ ├── mountstats
│ ├── net
│ │ └── dev
│ ├── ns
│ │ ├── mnt
│ │ └── net
│ └── stat
├── 26232
│ ├── cmdline
│ ├── comm
│ ├── fd
│ │ ├── 0
│ │ ├── 1
│ │ ├── 2
│ │ ├── 3
│ │ └── 4
│ ├── limits
│ └── stat
├── buddyinfo
│ ├── short
│ │ └── buddyinfo
│ ├── sizemismatch
│ │ └── buddyinfo
│ └── valid
│ │ └── buddyinfo
├── fs
│ └── xfs
│ │ └── stat
├── mdstat
├── net
│ ├── dev
│ ├── ip_vs
│ ├── ip_vs_stats
│ ├── rpc
│ │ ├── nfs
│ │ └── nfsd
│ └── xfrm_stat
├── self
├── stat
└── symlinktargets
│ ├── README
│ ├── abc
│ ├── def
│ ├── ghi
│ ├── uvw
│ └── xyz
├── fs.go
├── fs_test.go
├── internal
└── util
│ └── parse.go
├── ipvs.go
├── ipvs_test.go
├── mdstat.go
├── mdstat_test.go
├── mountstats.go
├── mountstats_test.go
├── net_dev.go
├── net_dev_test.go
├── nfs
├── nfs.go
├── parse.go
├── parse_nfs.go
├── parse_nfs_test.go
├── parse_nfsd.go
└── parse_nfsd_test.go
├── proc.go
├── proc_io.go
├── proc_io_test.go
├── proc_limits.go
├── proc_limits_test.go
├── proc_ns.go
├── proc_ns_test.go
├── proc_stat.go
├── proc_stat_test.go
├── proc_test.go
├── stat.go
├── stat_test.go
├── sysfs
├── .gitignore
├── doc.go
├── fixtures.ttar
├── fs.go
└── fs_test.go
├── ttar
├── xfrm.go
├── xfrm_test.go
└── xfs
├── parse.go
├── parse_test.go
└── xfs.go
/.gitignore:
--------------------------------------------------------------------------------
1 | *.pid
2 | *.lock
3 | *.log
4 |
5 | /.project
6 | /.pydevproject
7 | /.settings/org.eclipse.core.resources.prefs
8 |
9 | .idea/
10 |
--------------------------------------------------------------------------------
/collector/my_collector.go:
--------------------------------------------------------------------------------
1 | /**
2 | * Author: SongLee24
3 | * Email: lisong.shine@qq.com
4 | * Date: 2018-08-15
5 | *
6 | *
7 | * prometheus.Desc是指标的描述符,用于实现对指标的管理
8 | *
9 | */
10 |
11 | package collector
12 |
13 | import (
14 | "sync"
15 | "github.com/prometheus/client_golang/prometheus"
16 | "math/rand"
17 | )
18 |
19 | // 指标结构体
20 | type Metrics struct {
21 | metrics map[string]*prometheus.Desc
22 | mutex sync.Mutex
23 | }
24 |
25 | /**
26 | * 函数:newGlobalMetric
27 | * 功能:创建指标描述符
28 | */
29 | func newGlobalMetric(namespace string, metricName string, docString string, labels []string) *prometheus.Desc {
30 | return prometheus.NewDesc(namespace+"_"+metricName, docString, labels, nil)
31 | }
32 |
33 |
34 | /**
35 | * 工厂方法:NewMetrics
36 | * 功能:初始化指标信息,即Metrics结构体
37 | */
38 | func NewMetrics(namespace string) *Metrics {
39 | return &Metrics{
40 | metrics: map[string]*prometheus.Desc{
41 | "my_counter_metric": newGlobalMetric(namespace, "my_counter_metric", "The description of my_counter_metric", []string{"host"}),
42 | "my_gauge_metric": newGlobalMetric(namespace, "my_gauge_metric","The description of my_gauge_metric", []string{"host"}),
43 | },
44 | }
45 | }
46 |
47 | /**
48 | * 接口:Describe
49 | * 功能:传递结构体中的指标描述符到channel
50 | */
51 | func (c *Metrics) Describe(ch chan<- *prometheus.Desc) {
52 | for _, m := range c.metrics {
53 | ch <- m
54 | }
55 | }
56 |
57 | /**
58 | * 接口:Collect
59 | * 功能:抓取最新的数据,传递给channel
60 | */
61 | func (c *Metrics) Collect(ch chan<- prometheus.Metric) {
62 | c.mutex.Lock() // 加锁
63 | defer c.mutex.Unlock()
64 |
65 | mockCounterMetricData, mockGaugeMetricData := c.GenerateMockData()
66 | for host, currentValue := range mockCounterMetricData {
67 | ch <-prometheus.MustNewConstMetric(c.metrics["my_counter_metric"], prometheus.CounterValue, float64(currentValue), host)
68 | }
69 | for host, currentValue := range mockGaugeMetricData {
70 | ch <-prometheus.MustNewConstMetric(c.metrics["my_gauge_metric"], prometheus.GaugeValue, float64(currentValue), host)
71 | }
72 | }
73 |
74 |
75 | /**
76 | * 函数:GenerateMockData
77 | * 功能:生成模拟数据
78 | */
79 | func (c *Metrics) GenerateMockData() (mockCounterMetricData map[string]int, mockGaugeMetricData map[string]int) {
80 | mockCounterMetricData = map[string]int{
81 | "yahoo.com": int(rand.Int31n(1000)),
82 | "google.com": int(rand.Int31n(1000)),
83 | }
84 | mockGaugeMetricData = map[string]int{
85 | "yahoo.com": int(rand.Int31n(10)),
86 | "google.com": int(rand.Int31n(10)),
87 | }
88 | return
89 | }
90 |
91 |
--------------------------------------------------------------------------------
/prometheus-exporter.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "log"
5 | "flag"
6 | "net/http"
7 |
8 | "prometheus-exporter/collector"
9 | "github.com/prometheus/client_golang/prometheus"
10 | "github.com/prometheus/client_golang/prometheus/promhttp"
11 | )
12 |
13 | var (
14 | // Set during go build
15 | // version string
16 | // gitCommit string
17 |
18 | // 命令行参数
19 | listenAddr = flag.String("web.listen-port", "9001", "An port to listen on for web interface and telemetry.")
20 | metricsPath = flag.String("web.telemetry-path", "/metrics", "A path under which to expose metrics.")
21 | metricsNamespace = flag.String("metric.namespace", "demo", "Prometheus metrics namespace, as the prefix of metrics name")
22 | )
23 |
24 |
25 | func main() {
26 | flag.Parse()
27 |
28 | metrics := collector.NewMetrics(*metricsNamespace)
29 | registry := prometheus.NewRegistry()
30 | registry.MustRegister(metrics)
31 |
32 | http.Handle(*metricsPath, promhttp.HandlerFor(registry, promhttp.HandlerOpts{}))
33 | http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
34 | w.Write([]byte(`
35 |
A Prometheus Exporter
36 |
37 | A Prometheus Exporter
38 | Metrics
39 |
40 | `))
41 | })
42 |
43 | log.Printf("Starting Server at http://localhost:%s%s", *listenAddr, *metricsPath)
44 | log.Fatal(http.ListenAndServe(":"+*listenAddr, nil))
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/vendor/github.com/beorn7/perks/.gitignore:
--------------------------------------------------------------------------------
1 | *.test
2 | *.prof
3 |
--------------------------------------------------------------------------------
/vendor/github.com/beorn7/perks/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (C) 2013 Blake Mizerany
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be
12 | included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/vendor/github.com/beorn7/perks/README.md:
--------------------------------------------------------------------------------
1 | # Perks for Go (golang.org)
2 |
3 | Perks contains the Go package quantile that computes approximate quantiles over
4 | an unbounded data stream within low memory and CPU bounds.
5 |
6 | For more information and examples, see:
7 | http://godoc.org/github.com/bmizerany/perks
8 |
9 | A very special thank you and shout out to Graham Cormode (Rutgers University),
10 | Flip Korn (AT&T Labs–Research), S. Muthukrishnan (Rutgers University), and
11 | Divesh Srivastava (AT&T Labs–Research) for their research and publication of
12 | [Effective Computation of Biased Quantiles over Data Streams](http://www.cs.rutgers.edu/~muthu/bquant.pdf)
13 |
14 | Thank you, also:
15 | * Armon Dadgar (@armon)
16 | * Andrew Gerrand (@nf)
17 | * Brad Fitzpatrick (@bradfitz)
18 | * Keith Rarick (@kr)
19 |
20 | FAQ:
21 |
22 | Q: Why not move the quantile package into the project root?
23 | A: I want to add more packages to perks later.
24 |
25 | Copyright (C) 2013 Blake Mizerany
26 |
27 | 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:
28 |
29 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
30 |
31 | 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.
32 |
--------------------------------------------------------------------------------
/vendor/github.com/beorn7/perks/histogram/bench_test.go:
--------------------------------------------------------------------------------
1 | package histogram
2 |
3 | import (
4 | "math/rand"
5 | "testing"
6 | )
7 |
8 | func BenchmarkInsert10Bins(b *testing.B) {
9 | b.StopTimer()
10 | h := New(10)
11 | b.StartTimer()
12 | for i := 0; i < b.N; i++ {
13 | f := rand.ExpFloat64()
14 | h.Insert(f)
15 | }
16 | }
17 |
18 | func BenchmarkInsert100Bins(b *testing.B) {
19 | b.StopTimer()
20 | h := New(100)
21 | b.StartTimer()
22 | for i := 0; i < b.N; i++ {
23 | f := rand.ExpFloat64()
24 | h.Insert(f)
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/vendor/github.com/beorn7/perks/histogram/histogram.go:
--------------------------------------------------------------------------------
1 | // Package histogram provides a Go implementation of BigML's histogram package
2 | // for Clojure/Java. It is currently experimental.
3 | package histogram
4 |
5 | import (
6 | "container/heap"
7 | "math"
8 | "sort"
9 | )
10 |
11 | type Bin struct {
12 | Count int
13 | Sum float64
14 | }
15 |
16 | func (b *Bin) Update(x *Bin) {
17 | b.Count += x.Count
18 | b.Sum += x.Sum
19 | }
20 |
21 | func (b *Bin) Mean() float64 {
22 | return b.Sum / float64(b.Count)
23 | }
24 |
25 | type Bins []*Bin
26 |
27 | func (bs Bins) Len() int { return len(bs) }
28 | func (bs Bins) Less(i, j int) bool { return bs[i].Mean() < bs[j].Mean() }
29 | func (bs Bins) Swap(i, j int) { bs[i], bs[j] = bs[j], bs[i] }
30 |
31 | func (bs *Bins) Push(x interface{}) {
32 | *bs = append(*bs, x.(*Bin))
33 | }
34 |
35 | func (bs *Bins) Pop() interface{} {
36 | return bs.remove(len(*bs) - 1)
37 | }
38 |
39 | func (bs *Bins) remove(n int) *Bin {
40 | if n < 0 || len(*bs) < n {
41 | return nil
42 | }
43 | x := (*bs)[n]
44 | *bs = append((*bs)[:n], (*bs)[n+1:]...)
45 | return x
46 | }
47 |
48 | type Histogram struct {
49 | res *reservoir
50 | }
51 |
52 | func New(maxBins int) *Histogram {
53 | return &Histogram{res: newReservoir(maxBins)}
54 | }
55 |
56 | func (h *Histogram) Insert(f float64) {
57 | h.res.insert(&Bin{1, f})
58 | h.res.compress()
59 | }
60 |
61 | func (h *Histogram) Bins() Bins {
62 | return h.res.bins
63 | }
64 |
65 | type reservoir struct {
66 | n int
67 | maxBins int
68 | bins Bins
69 | }
70 |
71 | func newReservoir(maxBins int) *reservoir {
72 | return &reservoir{maxBins: maxBins}
73 | }
74 |
75 | func (r *reservoir) insert(bin *Bin) {
76 | r.n += bin.Count
77 | i := sort.Search(len(r.bins), func(i int) bool {
78 | return r.bins[i].Mean() >= bin.Mean()
79 | })
80 | if i < 0 || i == r.bins.Len() {
81 | // TODO(blake): Maybe use an .insert(i, bin) instead of
82 | // performing the extra work of a heap.Push.
83 | heap.Push(&r.bins, bin)
84 | return
85 | }
86 | r.bins[i].Update(bin)
87 | }
88 |
89 | func (r *reservoir) compress() {
90 | for r.bins.Len() > r.maxBins {
91 | minGapIndex := -1
92 | minGap := math.MaxFloat64
93 | for i := 0; i < r.bins.Len()-1; i++ {
94 | gap := gapWeight(r.bins[i], r.bins[i+1])
95 | if minGap > gap {
96 | minGap = gap
97 | minGapIndex = i
98 | }
99 | }
100 | prev := r.bins[minGapIndex]
101 | next := r.bins.remove(minGapIndex + 1)
102 | prev.Update(next)
103 | }
104 | }
105 |
106 | func gapWeight(prev, next *Bin) float64 {
107 | return next.Mean() - prev.Mean()
108 | }
109 |
--------------------------------------------------------------------------------
/vendor/github.com/beorn7/perks/histogram/histogram_test.go:
--------------------------------------------------------------------------------
1 | package histogram
2 |
3 | import (
4 | "math/rand"
5 | "testing"
6 | )
7 |
8 | func TestHistogram(t *testing.T) {
9 | const numPoints = 1e6
10 | const maxBins = 3
11 |
12 | h := New(maxBins)
13 | for i := 0; i < numPoints; i++ {
14 | f := rand.ExpFloat64()
15 | h.Insert(f)
16 | }
17 |
18 | bins := h.Bins()
19 | if g := len(bins); g > maxBins {
20 | t.Fatalf("got %d bins, wanted <= %d", g, maxBins)
21 | }
22 |
23 | for _, b := range bins {
24 | t.Logf("%+v", b)
25 | }
26 |
27 | if g := count(h.Bins()); g != numPoints {
28 | t.Fatalf("binned %d points, wanted %d", g, numPoints)
29 | }
30 | }
31 |
32 | func count(bins Bins) int {
33 | binCounts := 0
34 | for _, b := range bins {
35 | binCounts += b.Count
36 | }
37 | return binCounts
38 | }
39 |
--------------------------------------------------------------------------------
/vendor/github.com/beorn7/perks/quantile/bench_test.go:
--------------------------------------------------------------------------------
1 | package quantile
2 |
3 | import (
4 | "testing"
5 | )
6 |
7 | func BenchmarkInsertTargeted(b *testing.B) {
8 | b.ReportAllocs()
9 |
10 | s := NewTargeted(Targets)
11 | b.ResetTimer()
12 | for i := float64(0); i < float64(b.N); i++ {
13 | s.Insert(i)
14 | }
15 | }
16 |
17 | func BenchmarkInsertTargetedSmallEpsilon(b *testing.B) {
18 | s := NewTargeted(TargetsSmallEpsilon)
19 | b.ResetTimer()
20 | for i := float64(0); i < float64(b.N); i++ {
21 | s.Insert(i)
22 | }
23 | }
24 |
25 | func BenchmarkInsertBiased(b *testing.B) {
26 | s := NewLowBiased(0.01)
27 | b.ResetTimer()
28 | for i := float64(0); i < float64(b.N); i++ {
29 | s.Insert(i)
30 | }
31 | }
32 |
33 | func BenchmarkInsertBiasedSmallEpsilon(b *testing.B) {
34 | s := NewLowBiased(0.0001)
35 | b.ResetTimer()
36 | for i := float64(0); i < float64(b.N); i++ {
37 | s.Insert(i)
38 | }
39 | }
40 |
41 | func BenchmarkQuery(b *testing.B) {
42 | s := NewTargeted(Targets)
43 | for i := float64(0); i < 1e6; i++ {
44 | s.Insert(i)
45 | }
46 | b.ResetTimer()
47 | n := float64(b.N)
48 | for i := float64(0); i < n; i++ {
49 | s.Query(i / n)
50 | }
51 | }
52 |
53 | func BenchmarkQuerySmallEpsilon(b *testing.B) {
54 | s := NewTargeted(TargetsSmallEpsilon)
55 | for i := float64(0); i < 1e6; i++ {
56 | s.Insert(i)
57 | }
58 | b.ResetTimer()
59 | n := float64(b.N)
60 | for i := float64(0); i < n; i++ {
61 | s.Query(i / n)
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/vendor/github.com/beorn7/perks/topk/topk.go:
--------------------------------------------------------------------------------
1 | package topk
2 |
3 | import (
4 | "sort"
5 | )
6 |
7 | // http://www.cs.ucsb.edu/research/tech_reports/reports/2005-23.pdf
8 |
9 | type Element struct {
10 | Value string
11 | Count int
12 | }
13 |
14 | type Samples []*Element
15 |
16 | func (sm Samples) Len() int {
17 | return len(sm)
18 | }
19 |
20 | func (sm Samples) Less(i, j int) bool {
21 | return sm[i].Count < sm[j].Count
22 | }
23 |
24 | func (sm Samples) Swap(i, j int) {
25 | sm[i], sm[j] = sm[j], sm[i]
26 | }
27 |
28 | type Stream struct {
29 | k int
30 | mon map[string]*Element
31 |
32 | // the minimum Element
33 | min *Element
34 | }
35 |
36 | func New(k int) *Stream {
37 | s := new(Stream)
38 | s.k = k
39 | s.mon = make(map[string]*Element)
40 | s.min = &Element{}
41 |
42 | // Track k+1 so that less frequenet items contended for that spot,
43 | // resulting in k being more accurate.
44 | return s
45 | }
46 |
47 | func (s *Stream) Insert(x string) {
48 | s.insert(&Element{x, 1})
49 | }
50 |
51 | func (s *Stream) Merge(sm Samples) {
52 | for _, e := range sm {
53 | s.insert(e)
54 | }
55 | }
56 |
57 | func (s *Stream) insert(in *Element) {
58 | e := s.mon[in.Value]
59 | if e != nil {
60 | e.Count++
61 | } else {
62 | if len(s.mon) < s.k+1 {
63 | e = &Element{in.Value, in.Count}
64 | s.mon[in.Value] = e
65 | } else {
66 | e = s.min
67 | delete(s.mon, e.Value)
68 | e.Value = in.Value
69 | e.Count += in.Count
70 | s.min = e
71 | }
72 | }
73 | if e.Count < s.min.Count {
74 | s.min = e
75 | }
76 | }
77 |
78 | func (s *Stream) Query() Samples {
79 | var sm Samples
80 | for _, e := range s.mon {
81 | sm = append(sm, e)
82 | }
83 | sort.Sort(sort.Reverse(sm))
84 |
85 | if len(sm) < s.k {
86 | return sm
87 | }
88 |
89 | return sm[:s.k]
90 | }
91 |
--------------------------------------------------------------------------------
/vendor/github.com/beorn7/perks/topk/topk_test.go:
--------------------------------------------------------------------------------
1 | package topk
2 |
3 | import (
4 | "fmt"
5 | "math/rand"
6 | "sort"
7 | "testing"
8 | )
9 |
10 | func TestTopK(t *testing.T) {
11 | stream := New(10)
12 | ss := []*Stream{New(10), New(10), New(10)}
13 | m := make(map[string]int)
14 | for _, s := range ss {
15 | for i := 0; i < 1e6; i++ {
16 | v := fmt.Sprintf("%x", int8(rand.ExpFloat64()))
17 | s.Insert(v)
18 | m[v]++
19 | }
20 | stream.Merge(s.Query())
21 | }
22 |
23 | var sm Samples
24 | for x, s := range m {
25 | sm = append(sm, &Element{x, s})
26 | }
27 | sort.Sort(sort.Reverse(sm))
28 |
29 | g := stream.Query()
30 | if len(g) != 10 {
31 | t.Fatalf("got %d, want 10", len(g))
32 | }
33 | for i, e := range g {
34 | if sm[i].Value != e.Value {
35 | t.Errorf("at %d: want %q, got %q", i, sm[i].Value, e.Value)
36 | }
37 | }
38 | }
39 |
40 | func TestQuery(t *testing.T) {
41 | queryTests := []struct {
42 | value string
43 | expected int
44 | }{
45 | {"a", 1},
46 | {"b", 2},
47 | {"c", 2},
48 | }
49 |
50 | stream := New(2)
51 | for _, tt := range queryTests {
52 | stream.Insert(tt.value)
53 | if n := len(stream.Query()); n != tt.expected {
54 | t.Errorf("want %d, got %d", tt.expected, n)
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | *.[568ao]
3 | *.ao
4 | *.so
5 | *.pyc
6 | ._*
7 | .nfs.*
8 | [568a].out
9 | *~
10 | *.orig
11 | core
12 | _obj
13 | _test
14 | _testmain.go
15 | protoc-gen-go/testdata/multi/*.pb.go
16 | _conformance/_conformance
17 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/.travis.yml:
--------------------------------------------------------------------------------
1 | sudo: false
2 | language: go
3 | go:
4 | - 1.6.x
5 | - 1.7.x
6 | - 1.8.x
7 | - 1.9.x
8 |
9 | install:
10 | - go get -v -d -t github.com/golang/protobuf/...
11 | - curl -L https://github.com/google/protobuf/releases/download/v3.3.0/protoc-3.3.0-linux-x86_64.zip -o /tmp/protoc.zip
12 | - unzip /tmp/protoc.zip -d $HOME/protoc
13 |
14 | env:
15 | - PATH=$HOME/protoc/bin:$PATH
16 |
17 | script:
18 | - make all test
19 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/AUTHORS:
--------------------------------------------------------------------------------
1 | # This source code refers to The Go Authors for copyright purposes.
2 | # The master list of authors is in the main Go distribution,
3 | # visible at http://tip.golang.org/AUTHORS.
4 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/CONTRIBUTORS:
--------------------------------------------------------------------------------
1 | # This source code was written by the Go contributors.
2 | # The master list of contributors is in the main Go distribution,
3 | # visible at http://tip.golang.org/CONTRIBUTORS.
4 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/LICENSE:
--------------------------------------------------------------------------------
1 | Go support for Protocol Buffers - Google's data interchange format
2 |
3 | Copyright 2010 The Go Authors. All rights reserved.
4 | https://github.com/golang/protobuf
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are
8 | met:
9 |
10 | * Redistributions of source code must retain the above copyright
11 | notice, this list of conditions and the following disclaimer.
12 | * Redistributions in binary form must reproduce the above
13 | copyright notice, this list of conditions and the following disclaimer
14 | in the documentation and/or other materials provided with the
15 | distribution.
16 | * Neither the name of Google Inc. nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/Make.protobuf:
--------------------------------------------------------------------------------
1 | # Go support for Protocol Buffers - Google's data interchange format
2 | #
3 | # Copyright 2010 The Go Authors. All rights reserved.
4 | # https://github.com/golang/protobuf
5 | #
6 | # Redistribution and use in source and binary forms, with or without
7 | # modification, are permitted provided that the following conditions are
8 | # met:
9 | #
10 | # * Redistributions of source code must retain the above copyright
11 | # notice, this list of conditions and the following disclaimer.
12 | # * Redistributions in binary form must reproduce the above
13 | # copyright notice, this list of conditions and the following disclaimer
14 | # in the documentation and/or other materials provided with the
15 | # distribution.
16 | # * Neither the name of Google Inc. nor the names of its
17 | # contributors may be used to endorse or promote products derived from
18 | # this software without specific prior written permission.
19 | #
20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | # Includable Makefile to add a rule for generating .pb.go files from .proto files
33 | # (Google protocol buffer descriptions).
34 | # Typical use if myproto.proto is a file in package mypackage in this directory:
35 | #
36 | # include $(GOROOT)/src/pkg/github.com/golang/protobuf/Make.protobuf
37 |
38 | %.pb.go: %.proto
39 | protoc --go_out=. $<
40 |
41 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/Makefile:
--------------------------------------------------------------------------------
1 | # Go support for Protocol Buffers - Google's data interchange format
2 | #
3 | # Copyright 2010 The Go Authors. All rights reserved.
4 | # https://github.com/golang/protobuf
5 | #
6 | # Redistribution and use in source and binary forms, with or without
7 | # modification, are permitted provided that the following conditions are
8 | # met:
9 | #
10 | # * Redistributions of source code must retain the above copyright
11 | # notice, this list of conditions and the following disclaimer.
12 | # * Redistributions in binary form must reproduce the above
13 | # copyright notice, this list of conditions and the following disclaimer
14 | # in the documentation and/or other materials provided with the
15 | # distribution.
16 | # * Neither the name of Google Inc. nor the names of its
17 | # contributors may be used to endorse or promote products derived from
18 | # this software without specific prior written permission.
19 | #
20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 |
33 | all: install
34 |
35 | install:
36 | go install ./proto ./jsonpb ./ptypes
37 | go install ./protoc-gen-go
38 |
39 | test:
40 | go test ./proto ./jsonpb ./ptypes
41 | make -C protoc-gen-go/testdata test
42 |
43 | clean:
44 | go clean ./...
45 |
46 | nuke:
47 | go clean -i ./...
48 |
49 | regenerate:
50 | make -C protoc-gen-go/descriptor regenerate
51 | make -C protoc-gen-go/plugin regenerate
52 | make -C protoc-gen-go/testdata regenerate
53 | make -C proto/testdata regenerate
54 | make -C jsonpb/jsonpb_test_proto regenerate
55 | make -C _conformance regenerate
56 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/_conformance/Makefile:
--------------------------------------------------------------------------------
1 | # Go support for Protocol Buffers - Google's data interchange format
2 | #
3 | # Copyright 2016 The Go Authors. All rights reserved.
4 | # https://github.com/golang/protobuf
5 | #
6 | # Redistribution and use in source and binary forms, with or without
7 | # modification, are permitted provided that the following conditions are
8 | # met:
9 | #
10 | # * Redistributions of source code must retain the above copyright
11 | # notice, this list of conditions and the following disclaimer.
12 | # * Redistributions in binary form must reproduce the above
13 | # copyright notice, this list of conditions and the following disclaimer
14 | # in the documentation and/or other materials provided with the
15 | # distribution.
16 | # * Neither the name of Google Inc. nor the names of its
17 | # contributors may be used to endorse or promote products derived from
18 | # this software without specific prior written permission.
19 | #
20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | regenerate:
33 | protoc --go_out=Mgoogle/protobuf/any.proto=github.com/golang/protobuf/ptypes/any,Mgoogle/protobuf/duration.proto=github.com/golang/protobuf/ptypes/duration,Mgoogle/protobuf/struct.proto=github.com/golang/protobuf/ptypes/struct,Mgoogle/protobuf/timestamp.proto=github.com/golang/protobuf/ptypes/timestamp,Mgoogle/protobuf/wrappers.proto=github.com/golang/protobuf/ptypes/wrappers,Mgoogle/protobuf/field_mask.proto=google.golang.org/genproto/protobuf:. conformance_proto/conformance.proto
34 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/descriptor/descriptor_test.go:
--------------------------------------------------------------------------------
1 | package descriptor_test
2 |
3 | import (
4 | "fmt"
5 | "testing"
6 |
7 | "github.com/golang/protobuf/descriptor"
8 | tpb "github.com/golang/protobuf/proto/testdata"
9 | protobuf "github.com/golang/protobuf/protoc-gen-go/descriptor"
10 | )
11 |
12 | func TestMessage(t *testing.T) {
13 | var msg *protobuf.DescriptorProto
14 | fd, md := descriptor.ForMessage(msg)
15 | if pkg, want := fd.GetPackage(), "google.protobuf"; pkg != want {
16 | t.Errorf("descriptor.ForMessage(%T).GetPackage() = %q; want %q", msg, pkg, want)
17 | }
18 | if name, want := md.GetName(), "DescriptorProto"; name != want {
19 | t.Fatalf("descriptor.ForMessage(%T).GetName() = %q; want %q", msg, name, want)
20 | }
21 | }
22 |
23 | func Example_Options() {
24 | var msg *tpb.MyMessageSet
25 | _, md := descriptor.ForMessage(msg)
26 | if md.GetOptions().GetMessageSetWireFormat() {
27 | fmt.Printf("%v uses option message_set_wire_format.\n", md.GetName())
28 | }
29 |
30 | // Output:
31 | // MyMessageSet uses option message_set_wire_format.
32 | }
33 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/Makefile:
--------------------------------------------------------------------------------
1 | # Go support for Protocol Buffers - Google's data interchange format
2 | #
3 | # Copyright 2015 The Go Authors. All rights reserved.
4 | # https://github.com/golang/protobuf
5 | #
6 | # Redistribution and use in source and binary forms, with or without
7 | # modification, are permitted provided that the following conditions are
8 | # met:
9 | #
10 | # * Redistributions of source code must retain the above copyright
11 | # notice, this list of conditions and the following disclaimer.
12 | # * Redistributions in binary form must reproduce the above
13 | # copyright notice, this list of conditions and the following disclaimer
14 | # in the documentation and/or other materials provided with the
15 | # distribution.
16 | # * Neither the name of Google Inc. nor the names of its
17 | # contributors may be used to endorse or promote products derived from
18 | # this software without specific prior written permission.
19 | #
20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | regenerate:
33 | protoc --go_out=Mgoogle/protobuf/any.proto=github.com/golang/protobuf/ptypes/any,Mgoogle/protobuf/duration.proto=github.com/golang/protobuf/ptypes/duration,Mgoogle/protobuf/struct.proto=github.com/golang/protobuf/ptypes/struct,Mgoogle/protobuf/timestamp.proto=github.com/golang/protobuf/ptypes/timestamp,Mgoogle/protobuf/wrappers.proto=github.com/golang/protobuf/ptypes/wrappers:. *.proto
34 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/more_test_objects.proto:
--------------------------------------------------------------------------------
1 | // Go support for Protocol Buffers - Google's data interchange format
2 | //
3 | // Copyright 2015 The Go Authors. All rights reserved.
4 | // https://github.com/golang/protobuf
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | syntax = "proto3";
33 |
34 | package jsonpb;
35 |
36 | message Simple3 {
37 | double dub = 1;
38 | }
39 |
40 | message SimpleSlice3 {
41 | repeated string slices = 1;
42 | }
43 |
44 | message SimpleMap3 {
45 | map stringy = 1;
46 | }
47 |
48 | message SimpleNull3 {
49 | Simple3 simple = 1;
50 | }
51 |
52 | enum Numeral {
53 | UNKNOWN = 0;
54 | ARABIC = 1;
55 | ROMAN = 2;
56 | }
57 |
58 | message Mappy {
59 | map nummy = 1;
60 | map strry = 2;
61 | map objjy = 3;
62 | map buggy = 4;
63 | map booly = 5;
64 | map enumy = 6;
65 | map s32booly = 7;
66 | map s64booly = 8;
67 | map u32booly = 9;
68 | map u64booly = 10;
69 | }
70 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/proto/Makefile:
--------------------------------------------------------------------------------
1 | # Go support for Protocol Buffers - Google's data interchange format
2 | #
3 | # Copyright 2010 The Go Authors. All rights reserved.
4 | # https://github.com/golang/protobuf
5 | #
6 | # Redistribution and use in source and binary forms, with or without
7 | # modification, are permitted provided that the following conditions are
8 | # met:
9 | #
10 | # * Redistributions of source code must retain the above copyright
11 | # notice, this list of conditions and the following disclaimer.
12 | # * Redistributions in binary form must reproduce the above
13 | # copyright notice, this list of conditions and the following disclaimer
14 | # in the documentation and/or other materials provided with the
15 | # distribution.
16 | # * Neither the name of Google Inc. nor the names of its
17 | # contributors may be used to endorse or promote products derived from
18 | # this software without specific prior written permission.
19 | #
20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | install:
33 | go install
34 |
35 | test: install generate-test-pbs
36 | go test
37 |
38 |
39 | generate-test-pbs:
40 | make install
41 | make -C testdata
42 | protoc --go_out=Mtestdata/test.proto=github.com/golang/protobuf/proto/testdata,Mgoogle/protobuf/any.proto=github.com/golang/protobuf/ptypes/any:. proto3_proto/proto3.proto
43 | make
44 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/proto/map_test.go:
--------------------------------------------------------------------------------
1 | package proto_test
2 |
3 | import (
4 | "fmt"
5 | "testing"
6 |
7 | "github.com/golang/protobuf/proto"
8 | ppb "github.com/golang/protobuf/proto/proto3_proto"
9 | )
10 |
11 | func marshalled() []byte {
12 | m := &ppb.IntMaps{}
13 | for i := 0; i < 1000; i++ {
14 | m.Maps = append(m.Maps, &ppb.IntMap{
15 | Rtt: map[int32]int32{1: 2},
16 | })
17 | }
18 | b, err := proto.Marshal(m)
19 | if err != nil {
20 | panic(fmt.Sprintf("Can't marshal %+v: %v", m, err))
21 | }
22 | return b
23 | }
24 |
25 | func BenchmarkConcurrentMapUnmarshal(b *testing.B) {
26 | in := marshalled()
27 | b.RunParallel(func(pb *testing.PB) {
28 | for pb.Next() {
29 | var out ppb.IntMaps
30 | if err := proto.Unmarshal(in, &out); err != nil {
31 | b.Errorf("Can't unmarshal ppb.IntMaps: %v", err)
32 | }
33 | }
34 | })
35 | }
36 |
37 | func BenchmarkSequentialMapUnmarshal(b *testing.B) {
38 | in := marshalled()
39 | b.ResetTimer()
40 | for i := 0; i < b.N; i++ {
41 | var out ppb.IntMaps
42 | if err := proto.Unmarshal(in, &out); err != nil {
43 | b.Errorf("Can't unmarshal ppb.IntMaps: %v", err)
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/proto/size2_test.go:
--------------------------------------------------------------------------------
1 | // Go support for Protocol Buffers - Google's data interchange format
2 | //
3 | // Copyright 2012 The Go Authors. All rights reserved.
4 | // https://github.com/golang/protobuf
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | package proto
33 |
34 | import (
35 | "testing"
36 | )
37 |
38 | // This is a separate file and package from size_test.go because that one uses
39 | // generated messages and thus may not be in package proto without having a circular
40 | // dependency, whereas this file tests unexported details of size.go.
41 |
42 | func TestVarintSize(t *testing.T) {
43 | // Check the edge cases carefully.
44 | testCases := []struct {
45 | n uint64
46 | size int
47 | }{
48 | {0, 1},
49 | {1, 1},
50 | {127, 1},
51 | {128, 2},
52 | {16383, 2},
53 | {16384, 3},
54 | {1<<63 - 1, 9},
55 | {1 << 63, 10},
56 | }
57 | for _, tc := range testCases {
58 | size := sizeVarint(tc.n)
59 | if size != tc.size {
60 | t.Errorf("sizeVarint(%d) = %d, want %d", tc.n, size, tc.size)
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/proto/testdata/Makefile:
--------------------------------------------------------------------------------
1 | # Go support for Protocol Buffers - Google's data interchange format
2 | #
3 | # Copyright 2010 The Go Authors. All rights reserved.
4 | # https://github.com/golang/protobuf
5 | #
6 | # Redistribution and use in source and binary forms, with or without
7 | # modification, are permitted provided that the following conditions are
8 | # met:
9 | #
10 | # * Redistributions of source code must retain the above copyright
11 | # notice, this list of conditions and the following disclaimer.
12 | # * Redistributions in binary form must reproduce the above
13 | # copyright notice, this list of conditions and the following disclaimer
14 | # in the documentation and/or other materials provided with the
15 | # distribution.
16 | # * Neither the name of Google Inc. nor the names of its
17 | # contributors may be used to endorse or promote products derived from
18 | # this software without specific prior written permission.
19 | #
20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 |
33 | include ../../Make.protobuf
34 |
35 | all: regenerate
36 |
37 | regenerate:
38 | rm -f test.pb.go
39 | make test.pb.go
40 |
41 | # The following rules are just aids to development. Not needed for typical testing.
42 |
43 | diff: regenerate
44 | git diff test.pb.go
45 |
46 | restore:
47 | cp test.pb.go.golden test.pb.go
48 |
49 | preserve:
50 | cp test.pb.go test.pb.go.golden
51 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/protoc-gen-go/Makefile:
--------------------------------------------------------------------------------
1 | # Go support for Protocol Buffers - Google's data interchange format
2 | #
3 | # Copyright 2010 The Go Authors. All rights reserved.
4 | # https://github.com/golang/protobuf
5 | #
6 | # Redistribution and use in source and binary forms, with or without
7 | # modification, are permitted provided that the following conditions are
8 | # met:
9 | #
10 | # * Redistributions of source code must retain the above copyright
11 | # notice, this list of conditions and the following disclaimer.
12 | # * Redistributions in binary form must reproduce the above
13 | # copyright notice, this list of conditions and the following disclaimer
14 | # in the documentation and/or other materials provided with the
15 | # distribution.
16 | # * Neither the name of Google Inc. nor the names of its
17 | # contributors may be used to endorse or promote products derived from
18 | # this software without specific prior written permission.
19 | #
20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | test:
33 | cd testdata && make test
34 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/Makefile:
--------------------------------------------------------------------------------
1 | # Go support for Protocol Buffers - Google's data interchange format
2 | #
3 | # Copyright 2010 The Go Authors. All rights reserved.
4 | # https://github.com/golang/protobuf
5 | #
6 | # Redistribution and use in source and binary forms, with or without
7 | # modification, are permitted provided that the following conditions are
8 | # met:
9 | #
10 | # * Redistributions of source code must retain the above copyright
11 | # notice, this list of conditions and the following disclaimer.
12 | # * Redistributions in binary form must reproduce the above
13 | # copyright notice, this list of conditions and the following disclaimer
14 | # in the documentation and/or other materials provided with the
15 | # distribution.
16 | # * Neither the name of Google Inc. nor the names of its
17 | # contributors may be used to endorse or promote products derived from
18 | # this software without specific prior written permission.
19 | #
20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | # Not stored here, but descriptor.proto is in https://github.com/google/protobuf/
33 | # at src/google/protobuf/descriptor.proto
34 | regenerate:
35 | @echo WARNING! THIS RULE IS PROBABLY NOT RIGHT FOR YOUR INSTALLATION
36 | cp $(HOME)/src/protobuf/include/google/protobuf/descriptor.proto .
37 | protoc --go_out=../../../../.. -I$(HOME)/src/protobuf/include $(HOME)/src/protobuf/include/google/protobuf/descriptor.proto
38 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/protoc-gen-go/doc.go:
--------------------------------------------------------------------------------
1 | // Go support for Protocol Buffers - Google's data interchange format
2 | //
3 | // Copyright 2010 The Go Authors. All rights reserved.
4 | // https://github.com/golang/protobuf
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | /*
33 | A plugin for the Google protocol buffer compiler to generate Go code.
34 | Run it by building this program and putting it in your path with the name
35 | protoc-gen-go
36 | That word 'go' at the end becomes part of the option string set for the
37 | protocol compiler, so once the protocol compiler (protoc) is installed
38 | you can run
39 | protoc --go_out=output_directory input_directory/file.proto
40 | to generate Go bindings for the protocol defined by file.proto.
41 | With that input, the output will be written to
42 | output_directory/file.pb.go
43 |
44 | The generated code is documented in the package comment for
45 | the library.
46 |
47 | See the README and documentation for protocol buffers to learn more:
48 | https://developers.google.com/protocol-buffers/
49 |
50 | */
51 | package documentation
52 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/protoc-gen-go/generator/Makefile:
--------------------------------------------------------------------------------
1 | # Go support for Protocol Buffers - Google's data interchange format
2 | #
3 | # Copyright 2010 The Go Authors. All rights reserved.
4 | # https://github.com/golang/protobuf
5 | #
6 | # Redistribution and use in source and binary forms, with or without
7 | # modification, are permitted provided that the following conditions are
8 | # met:
9 | #
10 | # * Redistributions of source code must retain the above copyright
11 | # notice, this list of conditions and the following disclaimer.
12 | # * Redistributions in binary form must reproduce the above
13 | # copyright notice, this list of conditions and the following disclaimer
14 | # in the documentation and/or other materials provided with the
15 | # distribution.
16 | # * Neither the name of Google Inc. nor the names of its
17 | # contributors may be used to endorse or promote products derived from
18 | # this software without specific prior written permission.
19 | #
20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | include $(GOROOT)/src/Make.inc
33 |
34 | TARG=github.com/golang/protobuf/compiler/generator
35 | GOFILES=\
36 | generator.go\
37 |
38 | DEPS=../descriptor ../plugin ../../proto
39 |
40 | include $(GOROOT)/src/Make.pkg
41 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/protoc-gen-go/link_grpc.go:
--------------------------------------------------------------------------------
1 | // Go support for Protocol Buffers - Google's data interchange format
2 | //
3 | // Copyright 2015 The Go Authors. All rights reserved.
4 | // https://github.com/golang/protobuf
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | package main
33 |
34 | import _ "github.com/golang/protobuf/protoc-gen-go/grpc"
35 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/protoc-gen-go/plugin/Makefile:
--------------------------------------------------------------------------------
1 | # Go support for Protocol Buffers - Google's data interchange format
2 | #
3 | # Copyright 2010 The Go Authors. All rights reserved.
4 | # https://github.com/golang/protobuf
5 | #
6 | # Redistribution and use in source and binary forms, with or without
7 | # modification, are permitted provided that the following conditions are
8 | # met:
9 | #
10 | # * Redistributions of source code must retain the above copyright
11 | # notice, this list of conditions and the following disclaimer.
12 | # * Redistributions in binary form must reproduce the above
13 | # copyright notice, this list of conditions and the following disclaimer
14 | # in the documentation and/or other materials provided with the
15 | # distribution.
16 | # * Neither the name of Google Inc. nor the names of its
17 | # contributors may be used to endorse or promote products derived from
18 | # this software without specific prior written permission.
19 | #
20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | # Not stored here, but plugin.proto is in https://github.com/google/protobuf/
33 | # at src/google/protobuf/compiler/plugin.proto
34 | # Also we need to fix an import.
35 | regenerate:
36 | @echo WARNING! THIS RULE IS PROBABLY NOT RIGHT FOR YOUR INSTALLATION
37 | cp $(HOME)/src/protobuf/include/google/protobuf/compiler/plugin.proto .
38 | protoc --go_out=Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor:../../../../.. \
39 | -I$(HOME)/src/protobuf/include $(HOME)/src/protobuf/include/google/protobuf/compiler/plugin.proto
40 |
41 | restore:
42 | cp plugin.pb.golden plugin.pb.go
43 |
44 | preserve:
45 | cp plugin.pb.go plugin.pb.golden
46 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_base.proto:
--------------------------------------------------------------------------------
1 | // Go support for Protocol Buffers - Google's data interchange format
2 | //
3 | // Copyright 2010 The Go Authors. All rights reserved.
4 | // https://github.com/golang/protobuf
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | syntax = "proto2";
33 |
34 | package extension_base;
35 |
36 | message BaseMessage {
37 | optional int32 height = 1;
38 | extensions 4 to 9;
39 | extensions 16 to max;
40 | }
41 |
42 | // Another message that may be extended, using message_set_wire_format.
43 | message OldStyleMessage {
44 | option message_set_wire_format = true;
45 | extensions 100 to max;
46 | }
47 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_extra.proto:
--------------------------------------------------------------------------------
1 | // Go support for Protocol Buffers - Google's data interchange format
2 | //
3 | // Copyright 2011 The Go Authors. All rights reserved.
4 | // https://github.com/golang/protobuf
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | syntax = "proto2";
33 |
34 | package extension_extra;
35 |
36 | message ExtraMessage {
37 | optional int32 width = 1;
38 | }
39 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/grpc.proto:
--------------------------------------------------------------------------------
1 | // Go support for Protocol Buffers - Google's data interchange format
2 | //
3 | // Copyright 2015 The Go Authors. All rights reserved.
4 | // https://github.com/golang/protobuf
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | syntax = "proto3";
33 |
34 | package grpc.testing;
35 |
36 | message SimpleRequest {
37 | }
38 |
39 | message SimpleResponse {
40 | }
41 |
42 | message StreamMsg {
43 | }
44 |
45 | message StreamMsg2 {
46 | }
47 |
48 | service Test {
49 | rpc UnaryCall(SimpleRequest) returns (SimpleResponse);
50 |
51 | // This RPC streams from the server only.
52 | rpc Downstream(SimpleRequest) returns (stream StreamMsg);
53 |
54 | // This RPC streams from the client.
55 | rpc Upstream(stream StreamMsg) returns (SimpleResponse);
56 |
57 | // This one streams in both directions.
58 | rpc Bidi(stream StreamMsg) returns (stream StreamMsg2);
59 | }
60 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imp2.proto:
--------------------------------------------------------------------------------
1 | // Go support for Protocol Buffers - Google's data interchange format
2 | //
3 | // Copyright 2011 The Go Authors. All rights reserved.
4 | // https://github.com/golang/protobuf
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | syntax = "proto2";
33 |
34 | package imp;
35 |
36 | message PubliclyImportedMessage {
37 | optional int64 field = 1;
38 | }
39 |
40 | enum PubliclyImportedEnum {
41 | GLASSES = 1;
42 | HAIR = 2;
43 | }
44 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imp3.proto:
--------------------------------------------------------------------------------
1 | // Go support for Protocol Buffers - Google's data interchange format
2 | //
3 | // Copyright 2012 The Go Authors. All rights reserved.
4 | // https://github.com/golang/protobuf
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | syntax = "proto2";
33 |
34 | package imp;
35 |
36 | message ForeignImportedMessage {
37 | optional string tuber = 1;
38 | }
39 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/main_test.go:
--------------------------------------------------------------------------------
1 | // Go support for Protocol Buffers - Google's data interchange format
2 | //
3 | // Copyright 2010 The Go Authors. All rights reserved.
4 | // https://github.com/golang/protobuf
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | // A simple binary to link together the protocol buffers in this test.
33 |
34 | package testdata
35 |
36 | import (
37 | "testing"
38 |
39 | mytestpb "./my_test"
40 | multipb "github.com/golang/protobuf/protoc-gen-go/testdata/multi"
41 | )
42 |
43 | func TestLink(t *testing.T) {
44 | _ = &multipb.Multi1{}
45 | _ = &mytestpb.Request{}
46 | }
47 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi1.proto:
--------------------------------------------------------------------------------
1 | // Go support for Protocol Buffers - Google's data interchange format
2 | //
3 | // Copyright 2010 The Go Authors. All rights reserved.
4 | // https://github.com/golang/protobuf
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | syntax = "proto2";
33 |
34 | import "multi/multi2.proto";
35 | import "multi/multi3.proto";
36 |
37 | package multitest;
38 |
39 | message Multi1 {
40 | required Multi2 multi2 = 1;
41 | optional Multi2.Color color = 2;
42 | optional Multi3.HatType hat_type = 3;
43 | }
44 |
45 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi2.proto:
--------------------------------------------------------------------------------
1 | // Go support for Protocol Buffers - Google's data interchange format
2 | //
3 | // Copyright 2010 The Go Authors. All rights reserved.
4 | // https://github.com/golang/protobuf
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | syntax = "proto2";
33 |
34 | package multitest;
35 |
36 | message Multi2 {
37 | required int32 required_value = 1;
38 |
39 | enum Color {
40 | BLUE = 1;
41 | GREEN = 2;
42 | RED = 3;
43 | };
44 | optional Color color = 2;
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi3.proto:
--------------------------------------------------------------------------------
1 | // Go support for Protocol Buffers - Google's data interchange format
2 | //
3 | // Copyright 2010 The Go Authors. All rights reserved.
4 | // https://github.com/golang/protobuf
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | syntax = "proto2";
33 |
34 | package multitest;
35 |
36 | message Multi3 {
37 | enum HatType {
38 | FEDORA = 1;
39 | FEZ = 2;
40 | };
41 | optional HatType hat_type = 1;
42 | }
43 |
44 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/proto3.proto:
--------------------------------------------------------------------------------
1 | // Go support for Protocol Buffers - Google's data interchange format
2 | //
3 | // Copyright 2014 The Go Authors. All rights reserved.
4 | // https://github.com/golang/protobuf
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | syntax = "proto3";
33 |
34 | package proto3;
35 |
36 | message Request {
37 | enum Flavour {
38 | SWEET = 0;
39 | SOUR = 1;
40 | UMAMI = 2;
41 | GOPHERLICIOUS = 3;
42 | }
43 | string name = 1;
44 | repeated int64 key = 2;
45 | Flavour taste = 3;
46 | Book book = 4;
47 | repeated int64 unpacked = 5 [packed=false];
48 | }
49 |
50 | message Book {
51 | string title = 1;
52 | bytes raw_data = 2;
53 | }
54 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/ptypes/doc.go:
--------------------------------------------------------------------------------
1 | // Go support for Protocol Buffers - Google's data interchange format
2 | //
3 | // Copyright 2016 The Go Authors. All rights reserved.
4 | // https://github.com/golang/protobuf
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | /*
33 | Package ptypes contains code for interacting with well-known types.
34 | */
35 | package ptypes
36 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/ptypes/empty/empty.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | syntax = "proto3";
32 |
33 | package google.protobuf;
34 |
35 | option csharp_namespace = "Google.Protobuf.WellKnownTypes";
36 | option go_package = "github.com/golang/protobuf/ptypes/empty";
37 | option java_package = "com.google.protobuf";
38 | option java_outer_classname = "EmptyProto";
39 | option java_multiple_files = true;
40 | option objc_class_prefix = "GPB";
41 | option cc_enable_arenas = true;
42 |
43 | // A generic empty message that you can re-use to avoid defining duplicated
44 | // empty messages in your APIs. A typical example is to use it as the request
45 | // or the response type of an API method. For instance:
46 | //
47 | // service Foo {
48 | // rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
49 | // }
50 | //
51 | // The JSON representation for `Empty` is empty JSON object `{}`.
52 | message Empty {}
53 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/ptypes/regen.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -e
2 | #
3 | # This script fetches and rebuilds the "well-known types" protocol buffers.
4 | # To run this you will need protoc and goprotobuf installed;
5 | # see https://github.com/golang/protobuf for instructions.
6 | # You also need Go and Git installed.
7 |
8 | PKG=github.com/golang/protobuf/ptypes
9 | UPSTREAM=https://github.com/google/protobuf
10 | UPSTREAM_SUBDIR=src/google/protobuf
11 | PROTO_FILES=(any duration empty struct timestamp wrappers)
12 |
13 | function die() {
14 | echo 1>&2 $*
15 | exit 1
16 | }
17 |
18 | # Sanity check that the right tools are accessible.
19 | for tool in go git protoc protoc-gen-go; do
20 | q=$(which $tool) || die "didn't find $tool"
21 | echo 1>&2 "$tool: $q"
22 | done
23 |
24 | tmpdir=$(mktemp -d -t regen-wkt.XXXXXX)
25 | trap 'rm -rf $tmpdir' EXIT
26 |
27 | echo -n 1>&2 "finding package dir... "
28 | pkgdir=$(go list -f '{{.Dir}}' $PKG)
29 | echo 1>&2 $pkgdir
30 | base=$(echo $pkgdir | sed "s,/$PKG\$,,")
31 | echo 1>&2 "base: $base"
32 | cd "$base"
33 |
34 | echo 1>&2 "fetching latest protos... "
35 | git clone -q $UPSTREAM $tmpdir
36 |
37 | for file in ${PROTO_FILES[@]}; do
38 | echo 1>&2 "* $file"
39 | protoc --go_out=. -I$tmpdir/src $tmpdir/src/google/protobuf/$file.proto || die
40 | cp $tmpdir/src/google/protobuf/$file.proto $PKG/$file
41 | done
42 |
43 | echo 1>&2 "All OK"
44 |
--------------------------------------------------------------------------------
/vendor/github.com/matttproud/golang_protobuf_extensions/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 |
3 | go:
4 | - 1.5
5 | - 1.6
6 | - tip
7 |
8 | script: make -f Makefile.TRAVIS
9 |
--------------------------------------------------------------------------------
/vendor/github.com/matttproud/golang_protobuf_extensions/Makefile.TRAVIS:
--------------------------------------------------------------------------------
1 | all: build cover test vet
2 |
3 | build:
4 | go build -v ./...
5 |
6 | cover: test
7 | $(MAKE) -C pbutil cover
8 |
9 | test: build
10 | go test -v ./...
11 |
12 | vet: build
13 | go vet -v ./...
14 |
15 | .PHONY: build cover test vet
16 |
--------------------------------------------------------------------------------
/vendor/github.com/matttproud/golang_protobuf_extensions/NOTICE:
--------------------------------------------------------------------------------
1 | Copyright 2012 Matt T. Proud (matt.proud@gmail.com)
2 |
--------------------------------------------------------------------------------
/vendor/github.com/matttproud/golang_protobuf_extensions/README.md:
--------------------------------------------------------------------------------
1 | # Overview
2 | This repository provides various Protocol Buffer extensions for the Go
3 | language (golang), namely support for record length-delimited message
4 | streaming.
5 |
6 | | Java | Go |
7 | | ------------------------------ | --------------------- |
8 | | MessageLite#parseDelimitedFrom | pbutil.ReadDelimited |
9 | | MessageLite#writeDelimitedTo | pbutil.WriteDelimited |
10 |
11 | Because [Code Review 9102043](https://codereview.appspot.com/9102043/) is
12 | destined to never be merged into mainline (i.e., never be promoted to formal
13 | [goprotobuf features](https://github.com/golang/protobuf)), this repository
14 | will live here in the wild.
15 |
16 | # Documentation
17 | We have [generated Go Doc documentation](http://godoc.org/github.com/matttproud/golang_protobuf_extensions/pbutil) here.
18 |
19 | # Testing
20 | [](https://travis-ci.org/matttproud/golang_protobuf_extensions)
21 |
--------------------------------------------------------------------------------
/vendor/github.com/matttproud/golang_protobuf_extensions/ext/moved.go:
--------------------------------------------------------------------------------
1 | // Package ext moved to a new location: github.com/matttproud/golang_protobuf_extensions/pbutil.
2 | package ext
3 |
--------------------------------------------------------------------------------
/vendor/github.com/matttproud/golang_protobuf_extensions/pbtest/deleted.go:
--------------------------------------------------------------------------------
1 | // Package pbtest is deleted for the time being, because upstream Protocol Buffer 3 may have rendered quick.Value-based blackbox generation impossible.
2 | package pbtest
3 |
--------------------------------------------------------------------------------
/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/.gitignore:
--------------------------------------------------------------------------------
1 | cover.dat
2 |
--------------------------------------------------------------------------------
/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/Makefile:
--------------------------------------------------------------------------------
1 | all:
2 |
3 | cover:
4 | go test -cover -v -coverprofile=cover.dat ./...
5 | go tool cover -func cover.dat
6 |
7 | .PHONY: cover
8 |
--------------------------------------------------------------------------------
/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/doc.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 Matt T. Proud
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | // Package pbutil provides record length-delimited Protocol Buffer streaming.
16 | package pbutil
17 |
--------------------------------------------------------------------------------
/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 Matt T. Proud
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package pbutil
16 |
17 | import (
18 | "encoding/binary"
19 | "io"
20 |
21 | "github.com/golang/protobuf/proto"
22 | )
23 |
24 | // WriteDelimited encodes and dumps a message to the provided writer prefixed
25 | // with a 32-bit varint indicating the length of the encoded message, producing
26 | // a length-delimited record stream, which can be used to chain together
27 | // encoded messages of the same type together in a file. It returns the total
28 | // number of bytes written and any applicable error. This is roughly
29 | // equivalent to the companion Java API's MessageLite#writeDelimitedTo.
30 | func WriteDelimited(w io.Writer, m proto.Message) (n int, err error) {
31 | buffer, err := proto.Marshal(m)
32 | if err != nil {
33 | return 0, err
34 | }
35 |
36 | var buf [binary.MaxVarintLen32]byte
37 | encodedLength := binary.PutUvarint(buf[:], uint64(len(buffer)))
38 |
39 | sync, err := w.Write(buf[:encodedLength])
40 | if err != nil {
41 | return sync, err
42 | }
43 |
44 | n, err = w.Write(buffer)
45 | return n + sync, err
46 | }
47 |
--------------------------------------------------------------------------------
/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 Matt T. Proud
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package pbutil
16 |
17 | import (
18 | "bytes"
19 | "errors"
20 | "testing"
21 |
22 | "github.com/golang/protobuf/proto"
23 | )
24 |
25 | var errMarshal = errors.New("pbutil: can't marshal")
26 |
27 | type cantMarshal struct{ proto.Message }
28 |
29 | func (cantMarshal) Marshal() ([]byte, error) { return nil, errMarshal }
30 |
31 | var _ proto.Message = cantMarshal{}
32 |
33 | func TestWriteDelimitedMarshalErr(t *testing.T) {
34 | t.Parallel()
35 | var data cantMarshal
36 | var buf bytes.Buffer
37 | n, err := WriteDelimited(&buf, data)
38 | if got, want := n, 0; got != want {
39 | t.Errorf("WriteDelimited(buf, %#v) = %#v, ?; want = %v#, ?", data, got, want)
40 | }
41 | if got, want := err, errMarshal; got != want {
42 | t.Errorf("WriteDelimited(buf, %#v) = ?, %#v; want = ?, %#v", data, got, want)
43 | }
44 | }
45 |
46 | type canMarshal struct{ proto.Message }
47 |
48 | func (canMarshal) Marshal() ([]byte, error) { return []byte{0, 1, 2, 3, 4, 5}, nil }
49 |
50 | var errWrite = errors.New("pbutil: can't write")
51 |
52 | type cantWrite struct{}
53 |
54 | func (cantWrite) Write([]byte) (int, error) { return 0, errWrite }
55 |
56 | func TestWriteDelimitedWriteErr(t *testing.T) {
57 | t.Parallel()
58 | var data canMarshal
59 | var buf cantWrite
60 | n, err := WriteDelimited(buf, data)
61 | if got, want := n, 0; got != want {
62 | t.Errorf("WriteDelimited(buf, %#v) = %#v, ?; want = %v#, ?", data, got, want)
63 | }
64 | if got, want := err, errWrite; got != want {
65 | t.Errorf("WriteDelimited(buf, %#v) = ?, %#v; want = ?, %#v", data, got, want)
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/vendor/github.com/matttproud/golang_protobuf_extensions/testdata/README.THIRD_PARTY:
--------------------------------------------------------------------------------
1 | test.pb.go and test.proto are third-party data.
2 |
3 | SOURCE: https://github.com/golang/protobuf
4 | REVISION: bf531ff1a004f24ee53329dfd5ce0b41bfdc17df
5 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_golang/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
2 | *.o
3 | *.a
4 | *.so
5 |
6 | # Folders
7 | _obj
8 | _test
9 |
10 | # Examples
11 | /examples/simple/simple
12 | /examples/random/random
13 |
14 | # Architecture specific extensions/prefixes
15 | *.[568vq]
16 | [568vq].out
17 |
18 | *.cgo1.go
19 | *.cgo2.c
20 | _cgo_defun.c
21 | _cgo_gotypes.go
22 | _cgo_export.*
23 |
24 | _testmain.go
25 |
26 | *.exe
27 |
28 | *~
29 | *#
30 | .build
31 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_golang/.travis.yml:
--------------------------------------------------------------------------------
1 | sudo: false
2 | language: go
3 |
4 | go:
5 | - 1.7.x
6 | - 1.8.x
7 | - 1.9.x
8 |
9 | script:
10 | - go test -short ./...
11 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_golang/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | Prometheus uses GitHub to manage reviews of pull requests.
4 |
5 | * If you have a trivial fix or improvement, go ahead and create a pull request,
6 | addressing (with `@...`) the maintainer of this repository (see
7 | [MAINTAINERS.md](MAINTAINERS.md)) in the description of the pull request.
8 |
9 | * If you plan to do something more involved, first discuss your ideas
10 | on our [mailing list](https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers).
11 | This will avoid unnecessary work and surely give you and us a good deal
12 | of inspiration.
13 |
14 | * Relevant coding style guidelines are the [Go Code Review
15 | Comments](https://code.google.com/p/go-wiki/wiki/CodeReviewComments)
16 | and the _Formatting and style_ section of Peter Bourgon's [Go: Best
17 | Practices for Production
18 | Environments](http://peter.bourgon.org/go-in-production/#formatting-and-style).
19 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_golang/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_golang/MAINTAINERS.md:
--------------------------------------------------------------------------------
1 | * Björn Rabenstein
2 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_golang/NOTICE:
--------------------------------------------------------------------------------
1 | Prometheus instrumentation library for Go applications
2 | Copyright 2012-2015 The Prometheus Authors
3 |
4 | This product includes software developed at
5 | SoundCloud Ltd. (http://soundcloud.com/).
6 |
7 |
8 | The following components are included in this product:
9 |
10 | perks - a fork of https://github.com/bmizerany/perks
11 | https://github.com/beorn7/perks
12 | Copyright 2013-2015 Blake Mizerany, Björn Rabenstein
13 | See https://github.com/beorn7/perks/blob/master/README.md for license details.
14 |
15 | Go support for Protocol Buffers - Google's data interchange format
16 | http://github.com/golang/protobuf/
17 | Copyright 2010 The Go Authors
18 | See source code for license details.
19 |
20 | Support for streaming Protocol Buffer messages for the Go language (golang).
21 | https://github.com/matttproud/golang_protobuf_extensions
22 | Copyright 2013 Matt T. Proud
23 | Licensed under the Apache License, Version 2.0
24 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_golang/VERSION:
--------------------------------------------------------------------------------
1 | 0.8.0
2 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_golang/examples/random/Dockerfile:
--------------------------------------------------------------------------------
1 | # This Dockerfile builds an image for a client_golang example.
2 | #
3 | # Use as (from the root for the client_golang repository):
4 | # docker build -f examples/$name/Dockerfile -t prometheus/golang-example-$name .
5 |
6 | # Builder image, where we build the example.
7 | FROM golang:1.9.0 AS builder
8 | WORKDIR /go/src/github.com/prometheus/client_golang
9 | COPY . .
10 | WORKDIR /go/src/github.com/prometheus/client_golang/prometheus
11 | RUN go get -d
12 | WORKDIR /go/src/github.com/prometheus/client_golang/examples/random
13 | RUN CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w'
14 |
15 | # Final image.
16 | FROM scratch
17 | LABEL maintainer "The Prometheus Authors "
18 | COPY --from=builder /go/src/github.com/prometheus/client_golang/examples/random .
19 | EXPOSE 8080
20 | ENTRYPOINT ["/random"]
21 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_golang/examples/simple/Dockerfile:
--------------------------------------------------------------------------------
1 | # This Dockerfile builds an image for a client_golang example.
2 | #
3 | # Use as (from the root for the client_golang repository):
4 | # docker build -f examples/$name/Dockerfile -t prometheus/golang-example-$name .
5 |
6 | # Builder image, where we build the example.
7 | FROM golang:1.9.0 AS builder
8 | WORKDIR /go/src/github.com/prometheus/client_golang
9 | COPY . .
10 | WORKDIR /go/src/github.com/prometheus/client_golang/prometheus
11 | RUN go get -d
12 | WORKDIR /go/src/github.com/prometheus/client_golang/examples/simple
13 | RUN CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w'
14 |
15 | # Final image.
16 | FROM scratch
17 | LABEL maintainer "The Prometheus Authors "
18 | COPY --from=builder /go/src/github.com/prometheus/client_golang/examples/simple .
19 | EXPOSE 8080
20 | ENTRYPOINT ["/simple"]
21 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_golang/examples/simple/main.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Prometheus Authors
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | // A minimal example of how to include Prometheus instrumentation.
15 | package main
16 |
17 | import (
18 | "flag"
19 | "log"
20 | "net/http"
21 |
22 | "github.com/prometheus/client_golang/prometheus/promhttp"
23 | )
24 |
25 | var addr = flag.String("listen-address", ":8080", "The address to listen on for HTTP requests.")
26 |
27 | func main() {
28 | flag.Parse()
29 | http.Handle("/metrics", promhttp.Handler())
30 | log.Fatal(http.ListenAndServe(*addr, nil))
31 | }
32 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_golang/prometheus/.gitignore:
--------------------------------------------------------------------------------
1 | command-line-arguments.test
2 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_golang/prometheus/README.md:
--------------------------------------------------------------------------------
1 | See [](https://godoc.org/github.com/prometheus/client_golang/prometheus).
2 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_golang/prometheus/desc_test.go:
--------------------------------------------------------------------------------
1 | package prometheus
2 |
3 | import (
4 | "testing"
5 | )
6 |
7 | func TestNewDescInvalidLabelValues(t *testing.T) {
8 | desc := NewDesc(
9 | "sample_label",
10 | "sample label",
11 | nil,
12 | Labels{"a": "\xFF"},
13 | )
14 | if desc.err == nil {
15 | t.Errorf("NewDesc: expected error because: %s", desc.err)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_golang/prometheus/example_timer_gauge_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 The Prometheus Authors
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | package prometheus_test
15 |
16 | import (
17 | "os"
18 |
19 | "github.com/prometheus/client_golang/prometheus"
20 | )
21 |
22 | var (
23 | // If a function is called rarely (i.e. not more often than scrapes
24 | // happen) or ideally only once (like in a batch job), it can make sense
25 | // to use a Gauge for timing the function call. For timing a batch job
26 | // and pushing the result to a Pushgateway, see also the comprehensive
27 | // example in the push package.
28 | funcDuration = prometheus.NewGauge(prometheus.GaugeOpts{
29 | Name: "example_function_duration_seconds",
30 | Help: "Duration of the last call of an example function.",
31 | })
32 | )
33 |
34 | func run() error {
35 | // The Set method of the Gauge is used to observe the duration.
36 | timer := prometheus.NewTimer(prometheus.ObserverFunc(funcDuration.Set))
37 | defer timer.ObserveDuration()
38 |
39 | // Do something. Return errors as encountered. The use of 'defer' above
40 | // makes sure the function is still timed properly.
41 | return nil
42 | }
43 |
44 | func ExampleTimer_gauge() {
45 | if err := run(); err != nil {
46 | os.Exit(1)
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_golang/prometheus/example_timer_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 The Prometheus Authors
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | package prometheus_test
15 |
16 | import (
17 | "math/rand"
18 | "time"
19 |
20 | "github.com/prometheus/client_golang/prometheus"
21 | )
22 |
23 | var (
24 | requestDuration = prometheus.NewHistogram(prometheus.HistogramOpts{
25 | Name: "example_request_duration_seconds",
26 | Help: "Histogram for the runtime of a simple example function.",
27 | Buckets: prometheus.LinearBuckets(0.01, 0.01, 10),
28 | })
29 | )
30 |
31 | func ExampleTimer() {
32 | // timer times this example function. It uses a Histogram, but a Summary
33 | // would also work, as both implement Observer. Check out
34 | // https://prometheus.io/docs/practices/histograms/ for differences.
35 | timer := prometheus.NewTimer(requestDuration)
36 | defer timer.ObserveDuration()
37 |
38 | // Do something here that takes time.
39 | time.Sleep(time.Duration(rand.NormFloat64()*10000+50000) * time.Microsecond)
40 | }
41 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_golang/prometheus/fnv.go:
--------------------------------------------------------------------------------
1 | package prometheus
2 |
3 | // Inline and byte-free variant of hash/fnv's fnv64a.
4 |
5 | const (
6 | offset64 = 14695981039346656037
7 | prime64 = 1099511628211
8 | )
9 |
10 | // hashNew initializies a new fnv64a hash value.
11 | func hashNew() uint64 {
12 | return offset64
13 | }
14 |
15 | // hashAdd adds a string to a fnv64a hash value, returning the updated hash.
16 | func hashAdd(h uint64, s string) uint64 {
17 | for i := 0; i < len(s); i++ {
18 | h ^= uint64(s[i])
19 | h *= prime64
20 | }
21 | return h
22 | }
23 |
24 | // hashAddByte adds a byte to a fnv64a hash value, returning the updated hash.
25 | func hashAddByte(h uint64, b byte) uint64 {
26 | h ^= uint64(b)
27 | h *= prime64
28 | return h
29 | }
30 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_golang/prometheus/labels.go:
--------------------------------------------------------------------------------
1 | package prometheus
2 |
3 | import (
4 | "errors"
5 | "fmt"
6 | "strings"
7 | "unicode/utf8"
8 |
9 | "github.com/prometheus/common/model"
10 | )
11 |
12 | // Labels represents a collection of label name -> value mappings. This type is
13 | // commonly used with the With(Labels) and GetMetricWith(Labels) methods of
14 | // metric vector Collectors, e.g.:
15 | // myVec.With(Labels{"code": "404", "method": "GET"}).Add(42)
16 | //
17 | // The other use-case is the specification of constant label pairs in Opts or to
18 | // create a Desc.
19 | type Labels map[string]string
20 |
21 | // reservedLabelPrefix is a prefix which is not legal in user-supplied
22 | // label names.
23 | const reservedLabelPrefix = "__"
24 |
25 | var errInconsistentCardinality = errors.New("inconsistent label cardinality")
26 |
27 | func validateValuesInLabels(labels Labels, expectedNumberOfValues int) error {
28 | if len(labels) != expectedNumberOfValues {
29 | return errInconsistentCardinality
30 | }
31 |
32 | for name, val := range labels {
33 | if !utf8.ValidString(val) {
34 | return fmt.Errorf("label %s: value %q is not valid UTF-8", name, val)
35 | }
36 | }
37 |
38 | return nil
39 | }
40 |
41 | func validateLabelValues(vals []string, expectedNumberOfValues int) error {
42 | if len(vals) != expectedNumberOfValues {
43 | return errInconsistentCardinality
44 | }
45 |
46 | for _, val := range vals {
47 | if !utf8.ValidString(val) {
48 | return fmt.Errorf("label value %q is not valid UTF-8", val)
49 | }
50 | }
51 |
52 | return nil
53 | }
54 |
55 | func checkLabelName(l string) bool {
56 | return model.LabelName(l).IsValid() && !strings.HasPrefix(l, reservedLabelPrefix)
57 | }
58 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_golang/prometheus/metric_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 The Prometheus Authors
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | package prometheus
15 |
16 | import "testing"
17 |
18 | func TestBuildFQName(t *testing.T) {
19 | scenarios := []struct{ namespace, subsystem, name, result string }{
20 | {"a", "b", "c", "a_b_c"},
21 | {"", "b", "c", "b_c"},
22 | {"a", "", "c", "a_c"},
23 | {"", "", "c", "c"},
24 | {"a", "b", "", ""},
25 | {"a", "", "", ""},
26 | {"", "b", "", ""},
27 | {" ", "", "", ""},
28 | }
29 |
30 | for i, s := range scenarios {
31 | if want, got := s.result, BuildFQName(s.namespace, s.subsystem, s.name); want != got {
32 | t.Errorf("%d. want %s, got %s", i, want, got)
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_golang/prometheus/observer.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Prometheus Authors
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | package prometheus
15 |
16 | // Observer is the interface that wraps the Observe method, which is used by
17 | // Histogram and Summary to add observations.
18 | type Observer interface {
19 | Observe(float64)
20 | }
21 |
22 | // The ObserverFunc type is an adapter to allow the use of ordinary
23 | // functions as Observers. If f is a function with the appropriate
24 | // signature, ObserverFunc(f) is an Observer that calls f.
25 | //
26 | // This adapter is usually used in connection with the Timer type, and there are
27 | // two general use cases:
28 | //
29 | // The most common one is to use a Gauge as the Observer for a Timer.
30 | // See the "Gauge" Timer example.
31 | //
32 | // The more advanced use case is to create a function that dynamically decides
33 | // which Observer to use for observing the duration. See the "Complex" Timer
34 | // example.
35 | type ObserverFunc func(float64)
36 |
37 | // Observe calls f(value). It implements Observer.
38 | func (f ObserverFunc) Observe(value float64) {
39 | f(value)
40 | }
41 |
42 | // ObserverVec is an interface implemented by `HistogramVec` and `SummaryVec`.
43 | type ObserverVec interface {
44 | GetMetricWith(Labels) (Observer, error)
45 | GetMetricWithLabelValues(lvs ...string) (Observer, error)
46 | With(Labels) Observer
47 | WithLabelValues(...string) Observer
48 | CurryWith(Labels) (ObserverVec, error)
49 | MustCurryWith(Labels) ObserverVec
50 |
51 | Collector
52 | }
53 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_golang/prometheus/process_collector_test.go:
--------------------------------------------------------------------------------
1 | package prometheus
2 |
3 | import (
4 | "bytes"
5 | "os"
6 | "regexp"
7 | "testing"
8 |
9 | "github.com/prometheus/common/expfmt"
10 | "github.com/prometheus/procfs"
11 | )
12 |
13 | func TestProcessCollector(t *testing.T) {
14 | if _, err := procfs.Self(); err != nil {
15 | t.Skipf("skipping TestProcessCollector, procfs not available: %s", err)
16 | }
17 |
18 | registry := NewRegistry()
19 | if err := registry.Register(NewProcessCollector(os.Getpid(), "")); err != nil {
20 | t.Fatal(err)
21 | }
22 | if err := registry.Register(NewProcessCollectorPIDFn(
23 | func() (int, error) { return os.Getpid(), nil }, "foobar"),
24 | ); err != nil {
25 | t.Fatal(err)
26 | }
27 |
28 | mfs, err := registry.Gather()
29 | if err != nil {
30 | t.Fatal(err)
31 | }
32 |
33 | var buf bytes.Buffer
34 | for _, mf := range mfs {
35 | if _, err := expfmt.MetricFamilyToText(&buf, mf); err != nil {
36 | t.Fatal(err)
37 | }
38 | }
39 |
40 | for _, re := range []*regexp.Regexp{
41 | regexp.MustCompile("\nprocess_cpu_seconds_total [0-9]"),
42 | regexp.MustCompile("\nprocess_max_fds [1-9]"),
43 | regexp.MustCompile("\nprocess_open_fds [1-9]"),
44 | regexp.MustCompile("\nprocess_virtual_memory_bytes [1-9]"),
45 | regexp.MustCompile("\nprocess_resident_memory_bytes [1-9]"),
46 | regexp.MustCompile("\nprocess_start_time_seconds [0-9.]{10,}"),
47 | regexp.MustCompile("\nfoobar_process_cpu_seconds_total [0-9]"),
48 | regexp.MustCompile("\nfoobar_process_max_fds [1-9]"),
49 | regexp.MustCompile("\nfoobar_process_open_fds [1-9]"),
50 | regexp.MustCompile("\nfoobar_process_virtual_memory_bytes [1-9]"),
51 | regexp.MustCompile("\nfoobar_process_resident_memory_bytes [1-9]"),
52 | regexp.MustCompile("\nfoobar_process_start_time_seconds [0-9.]{10,}"),
53 | } {
54 | if !re.Match(buf.Bytes()) {
55 | t.Errorf("want body to match %s\n%s", re, buf.String())
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator_pre_1_8.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Prometheus Authors
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | // +build !go1.8
15 |
16 | package promhttp
17 |
18 | import (
19 | "io"
20 | "net/http"
21 | )
22 |
23 | func newDelegator(w http.ResponseWriter, observeWriteHeaderFunc func(int)) delegator {
24 | d := &responseWriterDelegator{
25 | ResponseWriter: w,
26 | observeWriteHeader: observeWriteHeaderFunc,
27 | }
28 |
29 | id := 0
30 | if _, ok := w.(http.CloseNotifier); ok {
31 | id += closeNotifier
32 | }
33 | if _, ok := w.(http.Flusher); ok {
34 | id += flusher
35 | }
36 | if _, ok := w.(http.Hijacker); ok {
37 | id += hijacker
38 | }
39 | if _, ok := w.(io.ReaderFrom); ok {
40 | id += readerFrom
41 | }
42 |
43 | return pickDelegator[id](d)
44 | }
45 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_golang/prometheus/push/examples_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Prometheus Authors
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | package push_test
15 |
16 | import (
17 | "fmt"
18 |
19 | "github.com/prometheus/client_golang/prometheus"
20 | "github.com/prometheus/client_golang/prometheus/push"
21 | )
22 |
23 | func ExamplePusher_Push() {
24 | completionTime := prometheus.NewGauge(prometheus.GaugeOpts{
25 | Name: "db_backup_last_completion_timestamp_seconds",
26 | Help: "The timestamp of the last successful completion of a DB backup.",
27 | })
28 | completionTime.SetToCurrentTime()
29 | if err := push.New("http://pushgateway:9091", "db_backup").
30 | Collector(completionTime).
31 | Grouping("db", "customers").
32 | Push(); err != nil {
33 | fmt.Println("Could not push completion time to Pushgateway:", err)
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_golang/prometheus/timer.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Prometheus Authors
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | package prometheus
15 |
16 | import "time"
17 |
18 | // Timer is a helper type to time functions. Use NewTimer to create new
19 | // instances.
20 | type Timer struct {
21 | begin time.Time
22 | observer Observer
23 | }
24 |
25 | // NewTimer creates a new Timer. The provided Observer is used to observe a
26 | // duration in seconds. Timer is usually used to time a function call in the
27 | // following way:
28 | // func TimeMe() {
29 | // timer := NewTimer(myHistogram)
30 | // defer timer.ObserveDuration()
31 | // // Do actual work.
32 | // }
33 | func NewTimer(o Observer) *Timer {
34 | return &Timer{
35 | begin: time.Now(),
36 | observer: o,
37 | }
38 | }
39 |
40 | // ObserveDuration records the duration passed since the Timer was created with
41 | // NewTimer. It calls the Observe method of the Observer provided during
42 | // construction with the duration in seconds as an argument. ObserveDuration is
43 | // usually called with a defer statement.
44 | //
45 | // Note that this method is only guaranteed to never observe negative durations
46 | // if used with Go1.9+.
47 | func (t *Timer) ObserveDuration() {
48 | if t.observer != nil {
49 | t.observer.Observe(time.Since(t.begin).Seconds())
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_golang/prometheus/untyped.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 The Prometheus Authors
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | package prometheus
15 |
16 | // UntypedOpts is an alias for Opts. See there for doc comments.
17 | type UntypedOpts Opts
18 |
19 | // UntypedFunc works like GaugeFunc but the collected metric is of type
20 | // "Untyped". UntypedFunc is useful to mirror an external metric of unknown
21 | // type.
22 | //
23 | // To create UntypedFunc instances, use NewUntypedFunc.
24 | type UntypedFunc interface {
25 | Metric
26 | Collector
27 | }
28 |
29 | // NewUntypedFunc creates a new UntypedFunc based on the provided
30 | // UntypedOpts. The value reported is determined by calling the given function
31 | // from within the Write method. Take into account that metric collection may
32 | // happen concurrently. If that results in concurrent calls to Write, like in
33 | // the case where an UntypedFunc is directly registered with Prometheus, the
34 | // provided function must be concurrency-safe.
35 | func NewUntypedFunc(opts UntypedOpts, function func() float64) UntypedFunc {
36 | return newValueFunc(NewDesc(
37 | BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
38 | opts.Help,
39 | nil,
40 | opts.ConstLabels,
41 | ), UntypedValue, function)
42 | }
43 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_golang/prometheus/value_test.go:
--------------------------------------------------------------------------------
1 | package prometheus
2 |
3 | import (
4 | "fmt"
5 | "testing"
6 | )
7 |
8 | func TestNewConstMetricInvalidLabelValues(t *testing.T) {
9 | testCases := []struct {
10 | desc string
11 | labels Labels
12 | }{
13 | {
14 | desc: "non utf8 label value",
15 | labels: Labels{"a": "\xFF"},
16 | },
17 | {
18 | desc: "not enough label values",
19 | labels: Labels{},
20 | },
21 | {
22 | desc: "too many label values",
23 | labels: Labels{"a": "1", "b": "2"},
24 | },
25 | }
26 |
27 | for _, test := range testCases {
28 | metricDesc := NewDesc(
29 | "sample_value",
30 | "sample value",
31 | []string{"a"},
32 | Labels{},
33 | )
34 |
35 | expectPanic(t, func() {
36 | MustNewConstMetric(metricDesc, CounterValue, 0.3, "\xFF")
37 | }, fmt.Sprintf("WithLabelValues: expected panic because: %s", test.desc))
38 |
39 | if _, err := NewConstMetric(metricDesc, CounterValue, 0.3, "\xFF"); err == nil {
40 | t.Errorf("NewConstMetric: expected error because: %s", test.desc)
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_model/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_model/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | Prometheus uses GitHub to manage reviews of pull requests.
4 |
5 | * If you have a trivial fix or improvement, go ahead and create a pull request,
6 | addressing (with `@...`) the maintainer of this repository (see
7 | [MAINTAINERS.md](MAINTAINERS.md)) in the description of the pull request.
8 |
9 | * If you plan to do something more involved, first discuss your ideas
10 | on our [mailing list](https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers).
11 | This will avoid unnecessary work and surely give you and us a good deal
12 | of inspiration.
13 |
14 | * Relevant coding style guidelines are the [Go Code Review
15 | Comments](https://code.google.com/p/go-wiki/wiki/CodeReviewComments)
16 | and the _Formatting and style_ section of Peter Bourgon's [Go: Best
17 | Practices for Production
18 | Environments](http://peter.bourgon.org/go-in-production/#formatting-and-style).
19 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_model/MAINTAINERS.md:
--------------------------------------------------------------------------------
1 | * Björn Rabenstein
2 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_model/Makefile:
--------------------------------------------------------------------------------
1 | # Copyright 2013 Prometheus Team
2 | # Licensed under the Apache License, Version 2.0 (the "License");
3 | # you may not use this file except in compliance with the License.
4 | # You may obtain a copy of the License at
5 |
6 | # http://www.apache.org/licenses/LICENSE-2.0
7 |
8 | # Unless required by applicable law or agreed to in writing, software
9 | # distributed under the License is distributed on an "AS IS" BASIS,
10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | # See the License for the specific language governing permissions and
12 | # limitations under the License.
13 |
14 | KEY_ID ?= _DEFINE_ME_
15 |
16 | all: cpp go java python ruby
17 |
18 | SUFFIXES:
19 |
20 | cpp: cpp/metrics.pb.cc cpp/metrics.pb.h
21 |
22 | cpp/metrics.pb.cc: metrics.proto
23 | protoc $< --cpp_out=cpp/
24 |
25 | cpp/metrics.pb.h: metrics.proto
26 | protoc $< --cpp_out=cpp/
27 |
28 | go: go/metrics.pb.go
29 |
30 | go/metrics.pb.go: metrics.proto
31 | protoc $< --go_out=go/
32 |
33 | java: src/main/java/io/prometheus/client/Metrics.java pom.xml
34 | mvn clean compile package
35 |
36 | src/main/java/io/prometheus/client/Metrics.java: metrics.proto
37 | protoc $< --java_out=src/main/java
38 |
39 | python: python/prometheus/client/model/metrics_pb2.py
40 |
41 | python/prometheus/client/model/metrics_pb2.py: metrics.proto
42 | mkdir -p python/prometheus/client/model
43 | protoc $< --python_out=python/prometheus/client/model
44 |
45 | ruby:
46 | $(MAKE) -C ruby build
47 |
48 | clean:
49 | -rm -rf cpp/*
50 | -rm -rf go/*
51 | -rm -rf java/*
52 | -rm -rf python/*
53 | -$(MAKE) -C ruby clean
54 | -mvn clean
55 |
56 | maven-deploy-snapshot: java
57 | mvn clean deploy -Dgpg.keyname=$(KEY_ID) -DperformRelease=true
58 |
59 | maven-deploy-release: java
60 | mvn clean release:clean release:prepare release:perform -Dgpg.keyname=$(KEY_ID) -DperformRelease=true
61 |
62 | .PHONY: all clean cpp go java maven-deploy-snapshot maven-deploy-release python ruby
63 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_model/NOTICE:
--------------------------------------------------------------------------------
1 | Data model artifacts for Prometheus.
2 | Copyright 2012-2015 The Prometheus Authors
3 |
4 | This product includes software developed at
5 | SoundCloud Ltd. (http://soundcloud.com/).
6 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_model/README.md:
--------------------------------------------------------------------------------
1 | # Background
2 | Under most circumstances, manually downloading this repository should never
3 | be required.
4 |
5 | # Prerequisites
6 | # Base
7 | * [Google Protocol Buffers](https://developers.google.com/protocol-buffers)
8 |
9 | ## Java
10 | * [Apache Maven](http://maven.apache.org)
11 | * [Prometheus Maven Repository](https://github.com/prometheus/io.prometheus-maven-repository) checked out into ../io.prometheus-maven-repository
12 |
13 | ## Go
14 | * [Go](http://golang.org)
15 | * [goprotobuf](https://code.google.com/p/goprotobuf)
16 |
17 | ## Ruby
18 | * [Ruby](https://www.ruby-lang.org)
19 | * [bundler](https://rubygems.org/gems/bundler)
20 |
21 | # Building
22 | $ make
23 |
24 | # Getting Started
25 | * The Go source code is periodically indexed: [Go Protocol Buffer Model](http://godoc.org/github.com/prometheus/client_model/go).
26 | * All of the core developers are accessible via the [Prometheus Developers Mailinglist](https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers).
27 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_model/metrics.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2013 Prometheus Team
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | syntax = "proto2";
15 |
16 | package io.prometheus.client;
17 | option java_package = "io.prometheus.client";
18 |
19 | message LabelPair {
20 | optional string name = 1;
21 | optional string value = 2;
22 | }
23 |
24 | enum MetricType {
25 | COUNTER = 0;
26 | GAUGE = 1;
27 | SUMMARY = 2;
28 | UNTYPED = 3;
29 | HISTOGRAM = 4;
30 | }
31 |
32 | message Gauge {
33 | optional double value = 1;
34 | }
35 |
36 | message Counter {
37 | optional double value = 1;
38 | }
39 |
40 | message Quantile {
41 | optional double quantile = 1;
42 | optional double value = 2;
43 | }
44 |
45 | message Summary {
46 | optional uint64 sample_count = 1;
47 | optional double sample_sum = 2;
48 | repeated Quantile quantile = 3;
49 | }
50 |
51 | message Untyped {
52 | optional double value = 1;
53 | }
54 |
55 | message Histogram {
56 | optional uint64 sample_count = 1;
57 | optional double sample_sum = 2;
58 | repeated Bucket bucket = 3; // Ordered in increasing order of upper_bound, +Inf bucket is optional.
59 | }
60 |
61 | message Bucket {
62 | optional uint64 cumulative_count = 1; // Cumulative in increasing order.
63 | optional double upper_bound = 2; // Inclusive.
64 | }
65 |
66 | message Metric {
67 | repeated LabelPair label = 1;
68 | optional Gauge gauge = 2;
69 | optional Counter counter = 3;
70 | optional Summary summary = 4;
71 | optional Untyped untyped = 5;
72 | optional Histogram histogram = 7;
73 | optional int64 timestamp_ms = 6;
74 | }
75 |
76 | message MetricFamily {
77 | optional string name = 1;
78 | optional string help = 2;
79 | optional MetricType type = 3;
80 | repeated Metric metric = 4;
81 | }
82 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_model/python/prometheus/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2013 Prometheus Team
2 | # Licensed under the Apache License, Version 2.0 (the "License");
3 | # you may not use this file except in compliance with the License.
4 | # You may obtain a copy of the License at
5 |
6 | # http://www.apache.org/licenses/LICENSE-2.0
7 |
8 | # Unless required by applicable law or agreed to in writing, software
9 | # distributed under the License is distributed on an "AS IS" BASIS,
10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | # See the License for the specific language governing permissions and
12 | # limitations under the License.
13 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_model/python/prometheus/client/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2013 Prometheus Team
2 | # Licensed under the Apache License, Version 2.0 (the "License");
3 | # you may not use this file except in compliance with the License.
4 | # You may obtain a copy of the License at
5 |
6 | # http://www.apache.org/licenses/LICENSE-2.0
7 |
8 | # Unless required by applicable law or agreed to in writing, software
9 | # distributed under the License is distributed on an "AS IS" BASIS,
10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | # See the License for the specific language governing permissions and
12 | # limitations under the License.
13 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_model/python/prometheus/client/model/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2013 Prometheus Team
2 | # Licensed under the Apache License, Version 2.0 (the "License");
3 | # you may not use this file except in compliance with the License.
4 | # You may obtain a copy of the License at
5 |
6 | # http://www.apache.org/licenses/LICENSE-2.0
7 |
8 | # Unless required by applicable law or agreed to in writing, software
9 | # distributed under the License is distributed on an "AS IS" BASIS,
10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | # See the License for the specific language governing permissions and
12 | # limitations under the License.
13 |
14 | __all__ = ['metrics_pb2']
15 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_model/ruby/.gitignore:
--------------------------------------------------------------------------------
1 | *.gem
2 | .bundle
3 | Gemfile.lock
4 | pkg
5 | vendor/bundle
6 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_model/ruby/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | # Specify your gem's dependencies in prometheus-client-model.gemspec
4 | gemspec
5 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_model/ruby/Makefile:
--------------------------------------------------------------------------------
1 | VENDOR_BUNDLE = vendor/bundle
2 |
3 | build: $(VENDOR_BUNDLE)/.bundled
4 | BEEFCAKE_NAMESPACE=Prometheus::Client protoc --beefcake_out lib/prometheus/client/model -I .. ../metrics.proto
5 |
6 | $(VENDOR_BUNDLE):
7 | mkdir -p $@
8 |
9 | $(VENDOR_BUNDLE)/.bundled: $(VENDOR_BUNDLE) Gemfile
10 | bundle install --quiet --path $<
11 | @touch $@
12 |
13 | clean:
14 | -rm -f lib/prometheus/client/model/metrics.pb.rb
15 | -rm -rf $(VENDOR_BUNDLE)
16 |
17 | .PHONY: build clean
18 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_model/ruby/README.md:
--------------------------------------------------------------------------------
1 | # Prometheus Ruby client model
2 |
3 | Data model artifacts for the [Prometheus Ruby client][1].
4 |
5 | ## Installation
6 |
7 | gem install prometheus-client-model
8 |
9 | ## Usage
10 |
11 | Build the artifacts from the protobuf specification:
12 |
13 | make build
14 |
15 | While this Gem's main purpose is to define the Prometheus data types for the
16 | [client][1], it's possible to use it without the client to decode a stream of
17 | delimited protobuf messages:
18 |
19 | ```ruby
20 | require 'open-uri'
21 | require 'prometheus/client/model'
22 |
23 | CONTENT_TYPE = 'application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited'
24 |
25 | stream = open('http://localhost:9090/metrics', 'Accept' => CONTENT_TYPE).read
26 | while family = Prometheus::Client::MetricFamily.read_delimited(stream)
27 | puts family
28 | end
29 | ```
30 |
31 | [1]: https://github.com/prometheus/client_ruby
32 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_model/ruby/Rakefile:
--------------------------------------------------------------------------------
1 | require "bundler/gem_tasks"
2 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_model/ruby/lib/prometheus/client/model.rb:
--------------------------------------------------------------------------------
1 | require 'prometheus/client/model/metrics.pb'
2 | require 'prometheus/client/model/version'
3 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_model/ruby/lib/prometheus/client/model/version.rb:
--------------------------------------------------------------------------------
1 | module Prometheus
2 | module Client
3 | module Model
4 | VERSION = '0.1.0'
5 | end
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_model/ruby/prometheus-client-model.gemspec:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 | lib = File.expand_path('../lib', __FILE__)
3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4 | require 'prometheus/client/model/version'
5 |
6 | Gem::Specification.new do |spec|
7 | spec.name = 'prometheus-client-model'
8 | spec.version = Prometheus::Client::Model::VERSION
9 | spec.authors = ['Tobias Schmidt']
10 | spec.email = ['tobidt@gmail.com']
11 | spec.summary = 'Data model artifacts for the Prometheus Ruby client'
12 | spec.homepage = 'https://github.com/prometheus/client_model/tree/master/ruby'
13 | spec.license = 'Apache 2.0'
14 |
15 | spec.files = %w[README.md LICENSE] + Dir.glob('{lib/**/*}')
16 | spec.require_paths = ['lib']
17 |
18 | spec.add_dependency 'beefcake', '>= 0.4.0'
19 |
20 | spec.add_development_dependency 'bundler', '~> 1.3'
21 | spec.add_development_dependency 'rake'
22 | end
23 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/client_model/setup.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 |
3 | from setuptools import setup
4 |
5 | setup(
6 | name = 'prometheus_client_model',
7 | version = '0.0.1',
8 | author = 'Matt T. Proud',
9 | author_email = 'matt.proud@gmail.com',
10 | description = 'Data model artifacts for the Prometheus client.',
11 | license = 'Apache License 2.0',
12 | url = 'http://github.com/prometheus/client_model',
13 | packages = ['prometheus', 'prometheus/client', 'prometheus/client/model'],
14 | package_dir = {'': 'python'},
15 | requires = ['protobuf(==2.4.1)'],
16 | platforms = 'Platform Independent',
17 | classifiers = ['Development Status :: 3 - Alpha',
18 | 'Intended Audience :: Developers',
19 | 'Intended Audience :: System Administrators',
20 | 'License :: OSI Approved :: Apache Software License',
21 | 'Operating System :: OS Independent',
22 | 'Topic :: Software Development :: Testing',
23 | 'Topic :: System :: Monitoring'])
24 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/.travis.yml:
--------------------------------------------------------------------------------
1 | sudo: false
2 |
3 | language: go
4 | go:
5 | - 1.7.5
6 | - tip
7 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | Prometheus uses GitHub to manage reviews of pull requests.
4 |
5 | * If you have a trivial fix or improvement, go ahead and create a pull request,
6 | addressing (with `@...`) the maintainer of this repository (see
7 | [MAINTAINERS.md](MAINTAINERS.md)) in the description of the pull request.
8 |
9 | * If you plan to do something more involved, first discuss your ideas
10 | on our [mailing list](https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers).
11 | This will avoid unnecessary work and surely give you and us a good deal
12 | of inspiration.
13 |
14 | * Relevant coding style guidelines are the [Go Code Review
15 | Comments](https://code.google.com/p/go-wiki/wiki/CodeReviewComments)
16 | and the _Formatting and style_ section of Peter Bourgon's [Go: Best
17 | Practices for Production
18 | Environments](http://peter.bourgon.org/go-in-production/#formatting-and-style).
19 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/MAINTAINERS.md:
--------------------------------------------------------------------------------
1 | * Fabian Reinartz
2 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/NOTICE:
--------------------------------------------------------------------------------
1 | Common libraries shared by Prometheus Go components.
2 | Copyright 2015 The Prometheus Authors
3 |
4 | This product includes software developed at
5 | SoundCloud Ltd. (http://soundcloud.com/).
6 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/README.md:
--------------------------------------------------------------------------------
1 | # Common
2 | [](https://travis-ci.org/prometheus/common)
3 |
4 | This repository contains Go libraries that are shared across Prometheus
5 | components and libraries.
6 |
7 | * **config**: Common configuration structures
8 | * **expfmt**: Decoding and encoding for the exposition format
9 | * **log**: A logging wrapper around [logrus](https://github.com/sirupsen/logrus)
10 | * **model**: Shared data structures
11 | * **route**: A routing wrapper around [httprouter](https://github.com/julienschmidt/httprouter) using `context.Context`
12 | * **version**: Version informations and metric
13 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/config/config.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Prometheus Authors
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | package config
15 |
16 | import (
17 | "fmt"
18 | "strings"
19 | )
20 |
21 | func checkOverflow(m map[string]interface{}, ctx string) error {
22 | if len(m) > 0 {
23 | var keys []string
24 | for k := range m {
25 | keys = append(keys, k)
26 | }
27 | return fmt.Errorf("unknown fields in %s: %s", ctx, strings.Join(keys, ", "))
28 | }
29 | return nil
30 | }
31 |
32 | // Secret special type for storing secrets.
33 | type Secret string
34 |
35 | // MarshalYAML implements the yaml.Marshaler interface for Secrets.
36 | func (s Secret) MarshalYAML() (interface{}, error) {
37 | if s != "" {
38 | return "", nil
39 | }
40 | return nil, nil
41 | }
42 |
43 | //UnmarshalYAML implements the yaml.Unmarshaler interface for Secrets.
44 | func (s *Secret) UnmarshalYAML(unmarshal func(interface{}) error) error {
45 | type plain Secret
46 | return unmarshal((*plain)(s))
47 | }
48 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/config/testdata/http.conf.bearer-token-and-file-set.bad.yml:
--------------------------------------------------------------------------------
1 | basic_auth:
2 | username: username
3 | password: "mysecret"
4 | bearer_token: mysecret
5 | bearer_token_file: file
6 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/config/testdata/http.conf.empty.bad.yml:
--------------------------------------------------------------------------------
1 | basic_auth:
2 | username: username
3 | password: mysecret
4 | bearer_token_file: file
5 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/config/testdata/http.conf.good.yml:
--------------------------------------------------------------------------------
1 | basic_auth:
2 | username: username
3 | password: "mysecret"
4 | proxy_url: "http://remote.host"
5 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/config/testdata/http.conf.invalid-bearer-token-file.bad.yml:
--------------------------------------------------------------------------------
1 | bearer_token_file: file
2 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/config/testdata/tls_config.cert_no_key.bad.yml:
--------------------------------------------------------------------------------
1 | cert_file: somefile
2 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/config/testdata/tls_config.empty.good.yml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SongLee24/prometheus-exporter/5fc6c8cc5ed17eebb736b1f752e2c45dd413abeb/vendor/github.com/prometheus/common/config/testdata/tls_config.empty.good.yml
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/config/testdata/tls_config.insecure.good.yml:
--------------------------------------------------------------------------------
1 | insecure_skip_verify: true
2 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/config/testdata/tls_config.invalid_field.bad.yml:
--------------------------------------------------------------------------------
1 | something_invalid: true
2 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/config/testdata/tls_config.key_no_cert.bad.yml:
--------------------------------------------------------------------------------
1 | key_file: somefile
2 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/expfmt.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Prometheus Authors
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | // Package expfmt contains tools for reading and writing Prometheus metrics.
15 | package expfmt
16 |
17 | // Format specifies the HTTP content type of the different wire protocols.
18 | type Format string
19 |
20 | // Constants to assemble the Content-Type values for the different wire protocols.
21 | const (
22 | TextVersion = "0.0.4"
23 | ProtoType = `application/vnd.google.protobuf`
24 | ProtoProtocol = `io.prometheus.client.MetricFamily`
25 | ProtoFmt = ProtoType + "; proto=" + ProtoProtocol + ";"
26 |
27 | // The Content-Type values for the different wire protocols.
28 | FmtUnknown Format = ``
29 | FmtText Format = `text/plain; version=` + TextVersion
30 | FmtProtoDelim Format = ProtoFmt + ` encoding=delimited`
31 | FmtProtoText Format = ProtoFmt + ` encoding=text`
32 | FmtProtoCompact Format = ProtoFmt + ` encoding=compact-text`
33 | )
34 |
35 | const (
36 | hdrContentType = "Content-Type"
37 | hdrAccept = "Accept"
38 | )
39 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 The Prometheus Authors
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | // Build only when actually fuzzing
15 | // +build gofuzz
16 |
17 | package expfmt
18 |
19 | import "bytes"
20 |
21 | // Fuzz text metric parser with with github.com/dvyukov/go-fuzz:
22 | //
23 | // go-fuzz-build github.com/prometheus/common/expfmt
24 | // go-fuzz -bin expfmt-fuzz.zip -workdir fuzz
25 | //
26 | // Further input samples should go in the folder fuzz/corpus.
27 | func Fuzz(in []byte) int {
28 | parser := TextParser{}
29 | _, err := parser.TextToMetricFamilies(bytes.NewReader(in))
30 |
31 | if err != nil {
32 | return 0
33 | }
34 |
35 | return 1
36 | }
37 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_0:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_1:
--------------------------------------------------------------------------------
1 |
2 | minimal_metric 1.234
3 | another_metric -3e3 103948
4 | # Even that:
5 | no_labels{} 3
6 | # HELP line for non-existing metric will be ignored.
7 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_2:
--------------------------------------------------------------------------------
1 |
2 | # A normal comment.
3 | #
4 | # TYPE name counter
5 | name{labelname="val1",basename="basevalue"} NaN
6 | name {labelname="val2",basename="base\"v\\al\nue"} 0.23 1234567890
7 | # HELP name two-line\n doc str\\ing
8 |
9 | # HELP name2 doc str"ing 2
10 | # TYPE name2 gauge
11 | name2{labelname="val2" ,basename = "basevalue2" } +Inf 54321
12 | name2{ labelname = "val1" , }-Inf
13 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_3:
--------------------------------------------------------------------------------
1 |
2 | # TYPE my_summary summary
3 | my_summary{n1="val1",quantile="0.5"} 110
4 | decoy -1 -2
5 | my_summary{n1="val1",quantile="0.9"} 140 1
6 | my_summary_count{n1="val1"} 42
7 | # Latest timestamp wins in case of a summary.
8 | my_summary_sum{n1="val1"} 4711 2
9 | fake_sum{n1="val1"} 2001
10 | # TYPE another_summary summary
11 | another_summary_count{n2="val2",n1="val1"} 20
12 | my_summary_count{n2="val2",n1="val1"} 5 5
13 | another_summary{n1="val1",n2="val2",quantile=".3"} -1.2
14 | my_summary_sum{n1="val2"} 08 15
15 | my_summary{n1="val3", quantile="0.2"} 4711
16 | my_summary{n1="val1",n2="val2",quantile="-12.34",} NaN
17 | # some
18 | # funny comments
19 | # HELP
20 | # HELP
21 | # HELP my_summary
22 | # HELP my_summary
23 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_4:
--------------------------------------------------------------------------------
1 |
2 | # HELP request_duration_microseconds The response latency.
3 | # TYPE request_duration_microseconds histogram
4 | request_duration_microseconds_bucket{le="100"} 123
5 | request_duration_microseconds_bucket{le="120"} 412
6 | request_duration_microseconds_bucket{le="144"} 592
7 | request_duration_microseconds_bucket{le="172.8"} 1524
8 | request_duration_microseconds_bucket{le="+Inf"} 2693
9 | request_duration_microseconds_sum 1.7560473e+06
10 | request_duration_microseconds_count 2693
11 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_0:
--------------------------------------------------------------------------------
1 | bla 3.14
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_1:
--------------------------------------------------------------------------------
1 | metric{label="\t"} 3.14
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_10:
--------------------------------------------------------------------------------
1 | metric{label="bla"} 3.14 2 3
2 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_11:
--------------------------------------------------------------------------------
1 | metric{label="bla"} blubb
2 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_12:
--------------------------------------------------------------------------------
1 |
2 | # HELP metric one
3 | # HELP metric two
4 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_13:
--------------------------------------------------------------------------------
1 |
2 | # TYPE metric counter
3 | # TYPE metric untyped
4 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_14:
--------------------------------------------------------------------------------
1 |
2 | metric 4.12
3 | # TYPE metric counter
4 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_15:
--------------------------------------------------------------------------------
1 |
2 | # TYPE metric bla
3 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_16:
--------------------------------------------------------------------------------
1 |
2 | # TYPE met-ric
3 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_17:
--------------------------------------------------------------------------------
1 | @invalidmetric{label="bla"} 3.14 2
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_18:
--------------------------------------------------------------------------------
1 | {label="bla"} 3.14 2
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_19:
--------------------------------------------------------------------------------
1 |
2 | # TYPE metric histogram
3 | metric_bucket{le="bla"} 3.14
4 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_2:
--------------------------------------------------------------------------------
1 |
2 | metric{label="new
3 | line"} 3.14
4 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_3:
--------------------------------------------------------------------------------
1 | metric{@="bla"} 3.14
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_4:
--------------------------------------------------------------------------------
1 | metric{__name__="bla"} 3.14
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_5:
--------------------------------------------------------------------------------
1 | metric{label+="bla"} 3.14
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_6:
--------------------------------------------------------------------------------
1 | metric{label=bla} 3.14
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_7:
--------------------------------------------------------------------------------
1 |
2 | # TYPE metric summary
3 | metric{quantile="bla"} 3.14
4 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_8:
--------------------------------------------------------------------------------
1 | metric{label="bla"+} 3.14
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_9:
--------------------------------------------------------------------------------
1 | metric{label="bla"} 3.14 2.72
2 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/minimal:
--------------------------------------------------------------------------------
1 | m{} 0
2 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/testdata/json2:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "baseLabels": {
4 | "__name__": "rpc_calls_total",
5 | "job": "batch_job"
6 | },
7 | "docstring": "RPC calls.",
8 | "metric": {
9 | "type": "counter",
10 | "value": [
11 | {
12 | "labels": {
13 | "service": "zed"
14 | },
15 | "value": 25
16 | },
17 | {
18 | "labels": {
19 | "service": "bar"
20 | },
21 | "value": 24
22 | }
23 | ]
24 | }
25 | },
26 | {
27 | "baseLabels": {
28 | "__name__": "rpc_latency_microseconds"
29 | },
30 | "docstring": "RPC latency.",
31 | "metric": {
32 | "type": "histogram",
33 | "value": [
34 | {
35 | "labels": {
36 | "service": "foo"
37 | },
38 | "value": {
39 | "0.010000": 15,
40 | "0.990000": 17
41 | }
42 | }
43 | ]
44 | }
45 | }
46 | ]
47 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/testdata/json2_bad:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "baseLabels": {
4 | "__name__": "rpc_calls_total",
5 | "job": "batch_job"
6 | },
7 | "docstring": "RPC calls.",
8 | "metric": {
9 | "type": "counter",
10 | "value": [
11 | {
12 | "labels": {
13 | "servic|e": "zed"
14 | },
15 | "value": 25
16 | },
17 | {
18 | "labels": {
19 | "service": "bar"
20 | },
21 | "value": 24
22 | }
23 | ]
24 | }
25 | },
26 | {
27 | "baseLabels": {
28 | "__name__": "rpc_latency_microseconds"
29 | },
30 | "docstring": "RPC latency.",
31 | "metric": {
32 | "type": "histogram",
33 | "value": [
34 | {
35 | "labels": {
36 | "service": "foo"
37 | },
38 | "value": {
39 | "0.010000": 15,
40 | "0.990000": 17
41 | }
42 | }
43 | ]
44 | }
45 | }
46 | ]
47 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/testdata/protobuf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SongLee24/prometheus-exporter/5fc6c8cc5ed17eebb736b1f752e2c45dd413abeb/vendor/github.com/prometheus/common/expfmt/testdata/protobuf
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/testdata/protobuf.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SongLee24/prometheus-exporter/5fc6c8cc5ed17eebb736b1f752e2c45dd413abeb/vendor/github.com/prometheus/common/expfmt/testdata/protobuf.gz
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/expfmt/testdata/text.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SongLee24/prometheus-exporter/5fc6c8cc5ed17eebb736b1f752e2c45dd413abeb/vendor/github.com/prometheus/common/expfmt/testdata/text.gz
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt:
--------------------------------------------------------------------------------
1 | PACKAGE
2 |
3 | package goautoneg
4 | import "bitbucket.org/ww/goautoneg"
5 |
6 | HTTP Content-Type Autonegotiation.
7 |
8 | The functions in this package implement the behaviour specified in
9 | http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
10 |
11 | Copyright (c) 2011, Open Knowledge Foundation Ltd.
12 | All rights reserved.
13 |
14 | Redistribution and use in source and binary forms, with or without
15 | modification, are permitted provided that the following conditions are
16 | met:
17 |
18 | Redistributions of source code must retain the above copyright
19 | notice, this list of conditions and the following disclaimer.
20 |
21 | Redistributions in binary form must reproduce the above copyright
22 | notice, this list of conditions and the following disclaimer in
23 | the documentation and/or other materials provided with the
24 | distribution.
25 |
26 | Neither the name of the Open Knowledge Foundation Ltd. nor the
27 | names of its contributors may be used to endorse or promote
28 | products derived from this software without specific prior written
29 | permission.
30 |
31 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
36 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
37 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
38 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
39 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
41 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 |
43 |
44 | FUNCTIONS
45 |
46 | func Negotiate(header string, alternatives []string) (content_type string)
47 | Negotiate the most appropriate content_type given the accept header
48 | and a list of alternatives.
49 |
50 | func ParseAccept(header string) (accept []Accept)
51 | Parse an Accept Header string returning a sorted list
52 | of clauses
53 |
54 |
55 | TYPES
56 |
57 | type Accept struct {
58 | Type, SubType string
59 | Q float32
60 | Params map[string]string
61 | }
62 | Structure to represent a clause in an HTTP Accept Header
63 |
64 |
65 | SUBDIRECTORIES
66 |
67 | .hg
68 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg_test.go:
--------------------------------------------------------------------------------
1 | package goautoneg
2 |
3 | import (
4 | "testing"
5 | )
6 |
7 | var chrome = "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"
8 |
9 | func TestParseAccept(t *testing.T) {
10 | alternatives := []string{"text/html", "image/png"}
11 | content_type := Negotiate(chrome, alternatives)
12 | if content_type != "image/png" {
13 | t.Errorf("got %s expected image/png", content_type)
14 | }
15 |
16 | alternatives = []string{"text/html", "text/plain", "text/n3"}
17 | content_type = Negotiate(chrome, alternatives)
18 | if content_type != "text/html" {
19 | t.Errorf("got %s expected text/html", content_type)
20 | }
21 |
22 | alternatives = []string{"text/n3", "text/plain"}
23 | content_type = Negotiate(chrome, alternatives)
24 | if content_type != "text/plain" {
25 | t.Errorf("got %s expected text/plain", content_type)
26 | }
27 |
28 | alternatives = []string{"text/n3", "application/rdf+xml"}
29 | content_type = Negotiate(chrome, alternatives)
30 | if content_type != "text/n3" {
31 | t.Errorf("got %s expected text/n3", content_type)
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/log/eventlog_formatter.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Prometheus Authors
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | // +build windows
15 |
16 | package log
17 |
18 | import (
19 | "fmt"
20 | "os"
21 |
22 | "golang.org/x/sys/windows/svc/eventlog"
23 |
24 | "github.com/sirupsen/logrus"
25 | )
26 |
27 | func init() {
28 | setEventlogFormatter = func(l logger, name string, debugAsInfo bool) error {
29 | if name == "" {
30 | return fmt.Errorf("missing name parameter")
31 | }
32 |
33 | fmter, err := newEventlogger(name, debugAsInfo, l.entry.Logger.Formatter)
34 | if err != nil {
35 | fmt.Fprintf(os.Stderr, "error creating eventlog formatter: %v\n", err)
36 | l.Errorf("can't connect logger to eventlog: %v", err)
37 | return err
38 | }
39 | l.entry.Logger.Formatter = fmter
40 | return nil
41 | }
42 | }
43 |
44 | type eventlogger struct {
45 | log *eventlog.Log
46 | debugAsInfo bool
47 | wrap logrus.Formatter
48 | }
49 |
50 | func newEventlogger(name string, debugAsInfo bool, fmter logrus.Formatter) (*eventlogger, error) {
51 | logHandle, err := eventlog.Open(name)
52 | if err != nil {
53 | return nil, err
54 | }
55 | return &eventlogger{log: logHandle, debugAsInfo: debugAsInfo, wrap: fmter}, nil
56 | }
57 |
58 | func (s *eventlogger) Format(e *logrus.Entry) ([]byte, error) {
59 | data, err := s.wrap.Format(e)
60 | if err != nil {
61 | fmt.Fprintf(os.Stderr, "eventlogger: can't format entry: %v\n", err)
62 | return data, err
63 | }
64 |
65 | switch e.Level {
66 | case logrus.PanicLevel:
67 | fallthrough
68 | case logrus.FatalLevel:
69 | fallthrough
70 | case logrus.ErrorLevel:
71 | err = s.log.Error(102, e.Message)
72 | case logrus.WarnLevel:
73 | err = s.log.Warning(101, e.Message)
74 | case logrus.InfoLevel:
75 | err = s.log.Info(100, e.Message)
76 | case logrus.DebugLevel:
77 | if s.debugAsInfo {
78 | err = s.log.Info(100, e.Message)
79 | }
80 | default:
81 | err = s.log.Info(100, e.Message)
82 | }
83 |
84 | if err != nil {
85 | fmt.Fprintf(os.Stderr, "eventlogger: can't send log to eventlog: %v\n", err)
86 | }
87 |
88 | return data, err
89 | }
90 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/log/log_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Prometheus Authors
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | package log
15 |
16 | import (
17 | "bytes"
18 | "regexp"
19 | "testing"
20 |
21 | "github.com/sirupsen/logrus"
22 | )
23 |
24 | func TestFileLineLogging(t *testing.T) {
25 | var buf bytes.Buffer
26 | origLogger.Out = &buf
27 | origLogger.Formatter = &logrus.TextFormatter{
28 | DisableColors: true,
29 | }
30 |
31 | // The default logging level should be "info".
32 | Debug("This debug-level line should not show up in the output.")
33 | Infof("This %s-level line should show up in the output.", "info")
34 |
35 | re := `^time=".*" level=info msg="This info-level line should show up in the output." source="log_test.go:33"\n$`
36 | if !regexp.MustCompile(re).Match(buf.Bytes()) {
37 | t.Fatalf("%q did not match expected regex %q", buf.String(), re)
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/log/syslog_formatter_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Prometheus Authors
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | // +build !windows,!nacl,!plan9
15 |
16 | package log
17 |
18 | import (
19 | "errors"
20 | "log/syslog"
21 | "testing"
22 | )
23 |
24 | func TestGetFacility(t *testing.T) {
25 | testCases := []struct {
26 | facility string
27 | expectedPriority syslog.Priority
28 | expectedErr error
29 | }{
30 | {"0", syslog.LOG_LOCAL0, nil},
31 | {"1", syslog.LOG_LOCAL1, nil},
32 | {"2", syslog.LOG_LOCAL2, nil},
33 | {"3", syslog.LOG_LOCAL3, nil},
34 | {"4", syslog.LOG_LOCAL4, nil},
35 | {"5", syslog.LOG_LOCAL5, nil},
36 | {"6", syslog.LOG_LOCAL6, nil},
37 | {"7", syslog.LOG_LOCAL7, nil},
38 | {"8", syslog.LOG_LOCAL0, errors.New("invalid local(8) for syslog")},
39 | }
40 | for _, tc := range testCases {
41 | priority, err := getFacility(tc.facility)
42 | if err != tc.expectedErr {
43 | if err.Error() != tc.expectedErr.Error() {
44 | t.Errorf("want %s, got %s", tc.expectedErr.Error(), err.Error())
45 | }
46 | }
47 |
48 | if priority != tc.expectedPriority {
49 | t.Errorf("want %q, got %q", tc.expectedPriority, priority)
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/model/fnv.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Prometheus Authors
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | package model
15 |
16 | // Inline and byte-free variant of hash/fnv's fnv64a.
17 |
18 | const (
19 | offset64 = 14695981039346656037
20 | prime64 = 1099511628211
21 | )
22 |
23 | // hashNew initializies a new fnv64a hash value.
24 | func hashNew() uint64 {
25 | return offset64
26 | }
27 |
28 | // hashAdd adds a string to a fnv64a hash value, returning the updated hash.
29 | func hashAdd(h uint64, s string) uint64 {
30 | for i := 0; i < len(s); i++ {
31 | h ^= uint64(s[i])
32 | h *= prime64
33 | }
34 | return h
35 | }
36 |
37 | // hashAddByte adds a byte to a fnv64a hash value, returning the updated hash.
38 | func hashAddByte(h uint64, b byte) uint64 {
39 | h ^= uint64(b)
40 | h *= prime64
41 | return h
42 | }
43 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/model/model.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 The Prometheus Authors
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | // Package model contains common data structures that are shared across
15 | // Prometheus components and libraries.
16 | package model
17 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/promlog/flag/flag.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Prometheus Authors
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | package flag
15 |
16 | import (
17 | "github.com/prometheus/common/promlog"
18 | kingpin "gopkg.in/alecthomas/kingpin.v2"
19 | )
20 |
21 | // LevelFlagName is the canonical flag name to configure the allowed log level
22 | // within Prometheus projects.
23 | const LevelFlagName = "log.level"
24 |
25 | // LevelFlagHelp is the help description for the log.level flag.
26 | const LevelFlagHelp = "Only log messages with the given severity or above. One of: [debug, info, warn, error]"
27 |
28 | // AddFlags adds the flags used by this package to the Kingpin application.
29 | // To use the default Kingpin application, call AddFlags(kingpin.CommandLine)
30 | func AddFlags(a *kingpin.Application, logLevel *promlog.AllowedLevel) {
31 | a.Flag(LevelFlagName, LevelFlagHelp).
32 | Default("info").SetValue(logLevel)
33 | }
34 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/promlog/log.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Prometheus Authors
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | // Package promlog defines standardised ways to initialize Go kit loggers
15 | // across Prometheus components.
16 | // It should typically only ever be imported by main packages.
17 | package promlog
18 |
19 | import (
20 | "os"
21 |
22 | "github.com/go-kit/kit/log"
23 | "github.com/go-kit/kit/log/level"
24 | "github.com/pkg/errors"
25 | )
26 |
27 | // AllowedLevel is a settable identifier for the minimum level a log entry
28 | // must be have.
29 | type AllowedLevel struct {
30 | s string
31 | o level.Option
32 | }
33 |
34 | func (l *AllowedLevel) String() string {
35 | return l.s
36 | }
37 |
38 | // Set updates the value of the allowed level.
39 | func (l *AllowedLevel) Set(s string) error {
40 | switch s {
41 | case "debug":
42 | l.o = level.AllowDebug()
43 | case "info":
44 | l.o = level.AllowInfo()
45 | case "warn":
46 | l.o = level.AllowWarn()
47 | case "error":
48 | l.o = level.AllowError()
49 | default:
50 | return errors.Errorf("unrecognized log level %q", s)
51 | }
52 | l.s = s
53 | return nil
54 | }
55 |
56 | // New returns a new leveled oklog logger in the logfmt format. Each logged line will be annotated
57 | // with a timestamp. The output always goes to stderr.
58 | func New(al AllowedLevel) log.Logger {
59 | l := log.NewLogfmtLogger(log.NewSyncWriter(os.Stderr))
60 | l = level.NewFilter(l, al.o)
61 | l = log.With(l, "ts", log.DefaultTimestampUTC, "caller", log.DefaultCaller)
62 | return l
63 | }
64 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/common/route/route_test.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | import (
4 | "net/http"
5 | "net/http/httptest"
6 | "testing"
7 | )
8 |
9 | func TestRedirect(t *testing.T) {
10 | router := New().WithPrefix("/test/prefix")
11 | w := httptest.NewRecorder()
12 | r, err := http.NewRequest("GET", "http://localhost:9090/foo", nil)
13 | if err != nil {
14 | t.Fatalf("Error building test request: %s", err)
15 | }
16 |
17 | router.Redirect(w, r, "/some/endpoint", http.StatusFound)
18 | if w.Code != http.StatusFound {
19 | t.Fatalf("Unexpected redirect status code: got %d, want %d", w.Code, http.StatusFound)
20 | }
21 |
22 | want := "/test/prefix/some/endpoint"
23 | got := w.Header()["Location"][0]
24 | if want != got {
25 | t.Fatalf("Unexpected redirect location: got %s, want %s", got, want)
26 | }
27 | }
28 |
29 | func TestContext(t *testing.T) {
30 | router := New()
31 | router.Get("/test/:foo/", func(w http.ResponseWriter, r *http.Request) {
32 | want := "bar"
33 | got := Param(r.Context(), "foo")
34 | if want != got {
35 | t.Fatalf("Unexpected context value: want %q, got %q", want, got)
36 | }
37 | })
38 |
39 | r, err := http.NewRequest("GET", "http://localhost:9090/test/bar/", nil)
40 | if err != nil {
41 | t.Fatalf("Error building test request: %s", err)
42 | }
43 | router.ServeHTTP(nil, r)
44 | }
45 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/.travis.yml:
--------------------------------------------------------------------------------
1 | sudo: false
2 |
3 | language: go
4 |
5 | go:
6 | - 1.9.x
7 | - 1.x
8 |
9 | go_import_path: github.com/prometheus/procfs
10 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | Prometheus uses GitHub to manage reviews of pull requests.
4 |
5 | * If you have a trivial fix or improvement, go ahead and create a pull request,
6 | addressing (with `@...`) the maintainer of this repository (see
7 | [MAINTAINERS.md](MAINTAINERS.md)) in the description of the pull request.
8 |
9 | * If you plan to do something more involved, first discuss your ideas
10 | on our [mailing list](https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers).
11 | This will avoid unnecessary work and surely give you and us a good deal
12 | of inspiration.
13 |
14 | * Relevant coding style guidelines are the [Go Code Review
15 | Comments](https://code.google.com/p/go-wiki/wiki/CodeReviewComments)
16 | and the _Formatting and style_ section of Peter Bourgon's [Go: Best
17 | Practices for Production
18 | Environments](http://peter.bourgon.org/go-in-production/#formatting-and-style).
19 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/MAINTAINERS.md:
--------------------------------------------------------------------------------
1 | * Tobias Schmidt
2 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/Makefile:
--------------------------------------------------------------------------------
1 | ci: fmt lint test
2 |
3 | fmt:
4 | ! gofmt -l *.go | read nothing
5 | go vet
6 |
7 | lint:
8 | go get github.com/golang/lint/golint
9 | golint *.go
10 |
11 | test: sysfs/fixtures/.unpacked
12 | go test -v ./...
13 |
14 | sysfs/fixtures/.unpacked: sysfs/fixtures.ttar
15 | ./ttar -C sysfs -x -f sysfs/fixtures.ttar
16 | touch $@
17 |
18 | .PHONY: fmt lint test ci
19 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/NOTICE:
--------------------------------------------------------------------------------
1 | procfs provides functions to retrieve system, kernel and process
2 | metrics from the pseudo-filesystem proc.
3 |
4 | Copyright 2014-2015 The Prometheus Authors
5 |
6 | This product includes software developed at
7 | SoundCloud Ltd. (http://soundcloud.com/).
8 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/README.md:
--------------------------------------------------------------------------------
1 | # procfs
2 |
3 | This procfs package provides functions to retrieve system, kernel and process
4 | metrics from the pseudo-filesystem proc.
5 |
6 | *WARNING*: This package is a work in progress. Its API may still break in
7 | backwards-incompatible ways without warnings. Use it at your own risk.
8 |
9 | [](https://godoc.org/github.com/prometheus/procfs)
10 | [](https://travis-ci.org/prometheus/procfs)
11 | [](https://goreportcard.com/report/github.com/prometheus/procfs)
12 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/buddyinfo_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Prometheus Authors
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | package procfs
15 |
16 | import (
17 | "strings"
18 | "testing"
19 | )
20 |
21 | func TestBuddyInfo(t *testing.T) {
22 | buddyInfo, err := FS("fixtures/buddyinfo/valid").NewBuddyInfo()
23 | if err != nil {
24 | t.Fatal(err)
25 | }
26 |
27 | if want, got := "DMA", buddyInfo[0].Zone; want != got {
28 | t.Errorf("want Node 0, Zone %s, got %s", want, got)
29 | }
30 |
31 | if want, got := "Normal", buddyInfo[2].Zone; want != got {
32 | t.Errorf("want Node 0, Zone %s, got %s", want, got)
33 | }
34 |
35 | if want, got := 4381.0, buddyInfo[2].Sizes[0]; want != got {
36 | t.Errorf("want Node 0, Zone Normal %f, got %f", want, got)
37 | }
38 |
39 | if want, got := 572.0, buddyInfo[1].Sizes[1]; want != got {
40 | t.Errorf("want Node 0, Zone DMA32 %f, got %f", want, got)
41 | }
42 | }
43 |
44 | func TestBuddyInfoShort(t *testing.T) {
45 | _, err := FS("fixtures/buddyinfo/short").NewBuddyInfo()
46 | if err == nil {
47 | t.Errorf("expected error, but none occurred")
48 | }
49 |
50 | if want, got := "invalid number of fields when parsing buddyinfo", err.Error(); want != got {
51 | t.Errorf("wrong error returned, wanted %q, got %q", want, got)
52 | }
53 | }
54 |
55 | func TestBuddyInfoSizeMismatch(t *testing.T) {
56 | _, err := FS("fixtures/buddyinfo/sizemismatch").NewBuddyInfo()
57 | if err == nil {
58 | t.Errorf("expected error, but none occurred")
59 | }
60 |
61 | if want, got := "mismatch in number of buddyinfo buckets", err.Error(); !strings.HasPrefix(got, want) {
62 | t.Errorf("wrong error returned, wanted prefix %q, got %q", want, got)
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/doc.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Prometheus Team
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | // Package procfs provides functions to retrieve system, kernel and process
15 | // metrics from the pseudo-filesystem proc.
16 | //
17 | // Example:
18 | //
19 | // package main
20 | //
21 | // import (
22 | // "fmt"
23 | // "log"
24 | //
25 | // "github.com/prometheus/procfs"
26 | // )
27 | //
28 | // func main() {
29 | // p, err := procfs.Self()
30 | // if err != nil {
31 | // log.Fatalf("could not get process: %s", err)
32 | // }
33 | //
34 | // stat, err := p.NewStat()
35 | // if err != nil {
36 | // log.Fatalf("could not get process stat: %s", err)
37 | // }
38 | //
39 | // fmt.Printf("command: %s\n", stat.Comm)
40 | // fmt.Printf("cpu time: %fs\n", stat.CPUTime())
41 | // fmt.Printf("vsize: %dB\n", stat.VirtualMemory())
42 | // fmt.Printf("rss: %dB\n", stat.ResidentMemory())
43 | // }
44 | //
45 | package procfs
46 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/26231/cmdline:
--------------------------------------------------------------------------------
1 | vim test.go +10
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/26231/comm:
--------------------------------------------------------------------------------
1 | vim
2 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/26231/exe:
--------------------------------------------------------------------------------
1 | /usr/bin/vim
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/26231/fd/0:
--------------------------------------------------------------------------------
1 | ../../symlinktargets/abc
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/26231/fd/1:
--------------------------------------------------------------------------------
1 | ../../symlinktargets/def
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/26231/fd/10:
--------------------------------------------------------------------------------
1 | ../../symlinktargets/xyz
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/26231/fd/2:
--------------------------------------------------------------------------------
1 | ../../symlinktargets/ghi
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/26231/fd/3:
--------------------------------------------------------------------------------
1 | ../../symlinktargets/uvw
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/26231/io:
--------------------------------------------------------------------------------
1 | rchar: 750339
2 | wchar: 818609
3 | syscr: 7405
4 | syscw: 5245
5 | read_bytes: 1024
6 | write_bytes: 2048
7 | cancelled_write_bytes: -1024
8 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/26231/limits:
--------------------------------------------------------------------------------
1 | Limit Soft Limit Hard Limit Units
2 | Max cpu time unlimited unlimited seconds
3 | Max file size unlimited unlimited bytes
4 | Max data size unlimited unlimited bytes
5 | Max stack size 8388608 unlimited bytes
6 | Max core file size 0 unlimited bytes
7 | Max resident set unlimited unlimited bytes
8 | Max processes 62898 62898 processes
9 | Max open files 2048 4096 files
10 | Max locked memory 65536 65536 bytes
11 | Max address space 8589934592 unlimited bytes
12 | Max file locks unlimited unlimited locks
13 | Max pending signals 62898 62898 signals
14 | Max msgqueue size 819200 819200 bytes
15 | Max nice priority 0 0
16 | Max realtime priority 0 0
17 | Max realtime timeout unlimited unlimited us
18 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/26231/mountstats:
--------------------------------------------------------------------------------
1 | device rootfs mounted on / with fstype rootfs
2 | device sysfs mounted on /sys with fstype sysfs
3 | device proc mounted on /proc with fstype proc
4 | device /dev/sda1 mounted on / with fstype ext4
5 | device 192.168.1.1:/srv/test mounted on /mnt/nfs/test with fstype nfs4 statvers=1.1
6 | opts: rw,vers=4.0,rsize=1048576,wsize=1048576,namlen=255,acregmin=3,acregmax=60,acdirmin=30,acdirmax=60,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=192.168.1.5,local_lock=none
7 | age: 13968
8 | caps: caps=0xfff7,wtmult=512,dtsize=32768,bsize=0,namlen=255
9 | nfsv4: bm0=0xfdffafff,bm1=0xf9be3e,bm2=0x0,acl=0x0,pnfs=not configured
10 | sec: flavor=1,pseudoflavor=1
11 | events: 52 226 0 0 1 13 398 0 0 331 0 47 0 0 77 0 0 77 0 0 0 0 0 0 0 0 0
12 | bytes: 1207640230 0 0 0 1210214218 0 295483 0
13 | RPC iostats version: 1.0 p/v: 100003/4 (nfs)
14 | xprt: tcp 832 0 1 0 11 6428 6428 0 12154 0 24 26 5726
15 | per-op statistics
16 | NULL: 0 0 0 0 0 0 0 0
17 | READ: 1298 1298 0 207680 1210292152 6 79386 79407
18 | WRITE: 0 0 0 0 0 0 0 0
19 |
20 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/26231/net/dev:
--------------------------------------------------------------------------------
1 | Inter-| Receive | Transmit
2 | face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
3 | lo: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4 | eth0: 438 5 0 0 0 0 0 0 648 8 0 0 0 0 0 0
5 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/26231/ns/mnt:
--------------------------------------------------------------------------------
1 | mnt:[4026531840]
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/26231/ns/net:
--------------------------------------------------------------------------------
1 | net:[4026531993]
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/26231/stat:
--------------------------------------------------------------------------------
1 | 26231 (vim) R 5392 7446 5392 34835 7446 4218880 32533 309516 26 82 1677 44 158 99 20 0 1 0 82375 56274944 1981 18446744073709551615 4194304 6294284 140736914091744 140736914087944 139965136429984 0 0 12288 1870679807 0 0 0 17 0 0 0 31 0 0 8391624 8481048 16420864 140736914093252 140736914093279 140736914093279 140736914096107 0
2 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/26232/cmdline:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SongLee24/prometheus-exporter/5fc6c8cc5ed17eebb736b1f752e2c45dd413abeb/vendor/github.com/prometheus/procfs/fixtures/26232/cmdline
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/26232/comm:
--------------------------------------------------------------------------------
1 | ata_sff
2 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/26232/fd/0:
--------------------------------------------------------------------------------
1 | ../../symlinktargets/abc
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/26232/fd/1:
--------------------------------------------------------------------------------
1 | ../../symlinktargets/def
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/26232/fd/2:
--------------------------------------------------------------------------------
1 | ../../symlinktargets/ghi
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/26232/fd/3:
--------------------------------------------------------------------------------
1 | ../../symlinktargets/uvw
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/26232/fd/4:
--------------------------------------------------------------------------------
1 | ../../symlinktargets/xyz
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/26232/limits:
--------------------------------------------------------------------------------
1 | Limit Soft Limit Hard Limit Units
2 | Max cpu time unlimited unlimited seconds
3 | Max file size unlimited unlimited bytes
4 | Max data size unlimited unlimited bytes
5 | Max stack size 8388608 unlimited bytes
6 | Max core file size 0 unlimited bytes
7 | Max resident set unlimited unlimited bytes
8 | Max processes 29436 29436 processes
9 | Max open files 1024 4096 files
10 | Max locked memory 65536 65536 bytes
11 | Max address space unlimited unlimited bytes
12 | Max file locks unlimited unlimited locks
13 | Max pending signals 29436 29436 signals
14 | Max msgqueue size 819200 819200 bytes
15 | Max nice priority 0 0
16 | Max realtime priority 0 0
17 | Max realtime timeout unlimited unlimited us
18 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/26232/stat:
--------------------------------------------------------------------------------
1 | 33 (ata_sff) S 2 0 0 0 -1 69238880 0 0 0 0 0 0 0 0 0 -20 1 0 5 0 0 18446744073709551615 0 0 0 0 0 0 0 2147483647 0 18446744073709551615 0 0 17 1 0 0 0 0 0 0 0 0 0 0 0 0 0
2 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/584/stat:
--------------------------------------------------------------------------------
1 | 1020 ((a b ) ( c d) ) R 28378 1020 28378 34842 1020 4218880 286 0 0 0 0 0 0 0 20 0 1 0 10839175 10395648 155 18446744073709551615 4194304 4238788 140736466511168 140736466511168 140609271124624 0 0 0 0 0 0 0 17 5 0 0 0 0 0 6336016 6337300 25579520 140736466515030 140736466515061 140736466515061 140736466518002 0
2 | #!/bin/cat /proc/self/stat
3 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/buddyinfo/short/buddyinfo:
--------------------------------------------------------------------------------
1 | Node 0, zone
2 | Node 0, zone
3 | Node 0, zone
4 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/buddyinfo/sizemismatch/buddyinfo:
--------------------------------------------------------------------------------
1 | Node 0, zone DMA 1 0 1 0 2 1 1 0 1 1 3
2 | Node 0, zone DMA32 759 572 791 475 194 45 12 0 0 0 0 0
3 | Node 0, zone Normal 4381 1093 185 1530 567 102 4 0 0 0
4 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/buddyinfo/valid/buddyinfo:
--------------------------------------------------------------------------------
1 | Node 0, zone DMA 1 0 1 0 2 1 1 0 1 1 3
2 | Node 0, zone DMA32 759 572 791 475 194 45 12 0 0 0 0
3 | Node 0, zone Normal 4381 1093 185 1530 567 102 4 0 0 0 0
4 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/fs/xfs/stat:
--------------------------------------------------------------------------------
1 | extent_alloc 92447 97589 92448 93751
2 | abt 0 0 0 0
3 | blk_map 1767055 188820 184891 92447 92448 2140766 0
4 | bmbt 0 0 0 0
5 | dir 185039 92447 92444 136422
6 | trans 706 944304 0
7 | ig 185045 58807 0 126238 0 33637 22
8 | log 2883 113448 9 17360 739
9 | push_ail 945014 0 134260 15483 0 3940 464 159985 0 40
10 | xstrat 92447 0
11 | rw 107739 94045
12 | attr 4 0 0 0
13 | icluster 8677 7849 135802
14 | vnodes 92601 0 0 0 92444 92444 92444 0
15 | buf 2666287 7122 2659202 3599 2 7085 0 10297 7085
16 | abtb2 184941 1277345 13257 13278 0 0 0 0 0 0 0 0 0 0 2746147
17 | abtc2 345295 2416764 172637 172658 0 0 0 0 0 0 0 0 0 0 21406023
18 | bmbt2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
19 | ibt2 343004 1358467 0 0 0 0 0 0 0 0 0 0 0 0 0
20 | fibt2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
21 | qm 0 0 0 0 0 0 0 0
22 | xpc 399724544 92823103 86219234
23 | debug 0
24 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/mdstat:
--------------------------------------------------------------------------------
1 | Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
2 | md3 : active raid6 sda1[8] sdh1[7] sdg1[6] sdf1[5] sde1[11] sdd1[3] sdc1[10] sdb1[9]
3 | 5853468288 blocks super 1.2 level 6, 64k chunk, algorithm 2 [8/8] [UUUUUUUU]
4 |
5 | md127 : active raid1 sdi2[0] sdj2[1]
6 | 312319552 blocks [2/2] [UU]
7 |
8 | md0 : active raid1 sdk[2](S) sdi1[0] sdj1[1]
9 | 248896 blocks [2/2] [UU]
10 |
11 | md4 : inactive raid1 sda3[0] sdb3[1]
12 | 4883648 blocks [2/2] [UU]
13 |
14 | md6 : active raid1 sdb2[2] sda2[0]
15 | 195310144 blocks [2/1] [U_]
16 | [=>...................] recovery = 8.5% (16775552/195310144) finish=17.0min speed=259783K/sec
17 |
18 | md8 : active raid1 sdb1[1] sda1[0]
19 | 195310144 blocks [2/2] [UU]
20 | [=>...................] resync = 8.5% (16775552/195310144) finish=17.0min speed=259783K/sec
21 |
22 | md7 : active raid6 sdb1[0] sde1[3] sdd1[2] sdc1[1]
23 | 7813735424 blocks super 1.2 level 6, 512k chunk, algorithm 2 [4/3] [U_UU]
24 | bitmap: 0/30 pages [0KB], 65536KB chunk
25 |
26 | unused devices:
27 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/net/dev:
--------------------------------------------------------------------------------
1 | Inter-| Receive | Transmit
2 | face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
3 | vethf345468: 648 8 0 0 0 0 0 0 438 5 0 0 0 0 0 0
4 | lo: 1664039048 1566805 0 0 0 0 0 0 1664039048 1566805 0 0 0 0 0 0
5 | docker0: 2568 38 0 0 0 0 0 0 438 5 0 0 0 0 0 0
6 | eth0: 874354587 1036395 0 0 0 0 0 0 563352563 732147 0 0 0 0 0 0
7 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/net/ip_vs:
--------------------------------------------------------------------------------
1 | IP Virtual Server version 1.2.1 (size=4096)
2 | Prot LocalAddress:Port Scheduler Flags
3 | -> RemoteAddress:Port Forward Weight ActiveConn InActConn
4 | TCP C0A80016:0CEA wlc
5 | -> C0A85216:0CEA Tunnel 100 248 2
6 | -> C0A85318:0CEA Tunnel 100 248 2
7 | -> C0A85315:0CEA Tunnel 100 248 1
8 | TCP C0A80039:0CEA wlc
9 | -> C0A85416:0CEA Tunnel 0 0 0
10 | -> C0A85215:0CEA Tunnel 100 1499 0
11 | -> C0A83215:0CEA Tunnel 100 1498 0
12 | TCP C0A80037:0CEA wlc
13 | -> C0A8321A:0CEA Tunnel 0 0 0
14 | -> C0A83120:0CEA Tunnel 100 0 0
15 | TCP [2620:0000:0000:0000:0000:0000:0000:0001]:0050 sh
16 | -> [2620:0000:0000:0000:0000:0000:0000:0002]:0050 Route 1 0 0
17 | -> [2620:0000:0000:0000:0000:0000:0000:0003]:0050 Route 1 0 0
18 | -> [2620:0000:0000:0000:0000:0000:0000:0004]:0050 Route 1 1 1
19 | FWM 10001000 wlc
20 | -> C0A8321A:0CEA Route 0 0 1
21 | -> C0A83215:0CEA Route 0 0 2
22 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/net/ip_vs_stats:
--------------------------------------------------------------------------------
1 | Total Incoming Outgoing Incoming Outgoing
2 | Conns Packets Packets Bytes Bytes
3 | 16AA370 E33656E5 0 51D8C8883AB3 0
4 |
5 | Conns/s Pkts/s Pkts/s Bytes/s Bytes/s
6 | 4 1FB3C 0 1282A8F 0
7 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/net/rpc/nfs:
--------------------------------------------------------------------------------
1 | net 18628 0 18628 6
2 | rpc 4329785 0 4338291
3 | proc2 18 2 69 0 0 4410 0 0 0 0 0 0 0 0 0 0 0 99 2
4 | proc3 22 1 4084749 29200 94754 32580 186 47747 7981 8639 0 6356 0 6962 0 7958 0 0 241 4 4 2 39
5 | proc4 61 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/net/rpc/nfsd:
--------------------------------------------------------------------------------
1 | rc 0 6 18622
2 | fh 0 0 0 0 0
3 | io 157286400 0
4 | th 8 0 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
5 | ra 32 0 0 0 0 0 0 0 0 0 0 0
6 | net 18628 0 18628 6
7 | rpc 18628 0 0 0 0
8 | proc2 18 2 69 0 0 4410 0 0 0 0 0 0 0 0 0 0 0 99 2
9 | proc3 22 2 112 0 2719 111 0 0 0 0 0 0 0 0 0 0 0 27 216 0 2 1 0
10 | proc4 2 2 10853
11 | proc4ops 72 0 0 0 1098 2 0 0 0 0 8179 5896 0 0 0 0 5900 0 0 2 0 2 0 9609 0 2 150 1272 0 0 0 1236 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
12 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/net/xfrm_stat:
--------------------------------------------------------------------------------
1 | XfrmInError 1
2 | XfrmInBufferError 2
3 | XfrmInHdrError 4
4 | XfrmInNoStates 3
5 | XfrmInStateProtoError 40
6 | XfrmInStateModeError 100
7 | XfrmInStateSeqError 6000
8 | XfrmInStateExpired 4
9 | XfrmInStateMismatch 23451
10 | XfrmInStateInvalid 55555
11 | XfrmInTmplMismatch 51
12 | XfrmInNoPols 65432
13 | XfrmInPolBlock 100
14 | XfrmInPolError 10000
15 | XfrmOutError 1000000
16 | XfrmOutBundleGenError 43321
17 | XfrmOutBundleCheckError 555
18 | XfrmOutNoStates 869
19 | XfrmOutStateProtoError 4542
20 | XfrmOutStateModeError 4
21 | XfrmOutStateSeqError 543
22 | XfrmOutStateExpired 565
23 | XfrmOutPolBlock 43456
24 | XfrmOutPolDead 7656
25 | XfrmOutPolError 1454
26 | XfrmFwdHdrError 6654
27 | XfrmOutStateInvalid 28765
28 | XfrmAcquireError 24532
29 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/self:
--------------------------------------------------------------------------------
1 | 26231
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/stat:
--------------------------------------------------------------------------------
1 | cpu 301854 612 111922 8979004 3552 2 3944 0 0 0
2 | cpu0 44490 19 21045 1087069 220 1 3410 0 0 0
3 | cpu1 47869 23 16474 1110787 591 0 46 0 0 0
4 | cpu2 46504 36 15916 1112321 441 0 326 0 0 0
5 | cpu3 47054 102 15683 1113230 533 0 60 0 0 0
6 | cpu4 28413 25 10776 1140321 217 0 8 0 0 0
7 | cpu5 29271 101 11586 1136270 672 0 30 0 0 0
8 | cpu6 29152 36 10276 1139721 319 0 29 0 0 0
9 | cpu7 29098 268 10164 1139282 555 0 31 0 0 0
10 | intr 8885917 17 0 0 0 0 0 0 0 1 79281 0 0 0 0 0 0 0 231237 0 0 0 0 250586 103 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 223424 190745 13 906 1283803 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11 | ctxt 38014093
12 | btime 1418183276
13 | processes 26442
14 | procs_running 2
15 | procs_blocked 1
16 | softirq 5057579 250191 1481983 1647 211099 186066 0 1783454 622196 12499 508444
17 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/symlinktargets/README:
--------------------------------------------------------------------------------
1 | This directory contains some empty files that are the symlinks the files in the "fd" directory point to.
2 | They are otherwise ignored by the tests
3 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/symlinktargets/abc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SongLee24/prometheus-exporter/5fc6c8cc5ed17eebb736b1f752e2c45dd413abeb/vendor/github.com/prometheus/procfs/fixtures/symlinktargets/abc
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/symlinktargets/def:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SongLee24/prometheus-exporter/5fc6c8cc5ed17eebb736b1f752e2c45dd413abeb/vendor/github.com/prometheus/procfs/fixtures/symlinktargets/def
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/symlinktargets/ghi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SongLee24/prometheus-exporter/5fc6c8cc5ed17eebb736b1f752e2c45dd413abeb/vendor/github.com/prometheus/procfs/fixtures/symlinktargets/ghi
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/symlinktargets/uvw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SongLee24/prometheus-exporter/5fc6c8cc5ed17eebb736b1f752e2c45dd413abeb/vendor/github.com/prometheus/procfs/fixtures/symlinktargets/uvw
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fixtures/symlinktargets/xyz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SongLee24/prometheus-exporter/5fc6c8cc5ed17eebb736b1f752e2c45dd413abeb/vendor/github.com/prometheus/procfs/fixtures/symlinktargets/xyz
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fs.go:
--------------------------------------------------------------------------------
1 | package procfs
2 |
3 | import (
4 | "fmt"
5 | "os"
6 | "path"
7 |
8 | "github.com/prometheus/procfs/nfs"
9 | "github.com/prometheus/procfs/xfs"
10 | )
11 |
12 | // FS represents the pseudo-filesystem proc, which provides an interface to
13 | // kernel data structures.
14 | type FS string
15 |
16 | // DefaultMountPoint is the common mount point of the proc filesystem.
17 | const DefaultMountPoint = "/proc"
18 |
19 | // NewFS returns a new FS mounted under the given mountPoint. It will error
20 | // if the mount point can't be read.
21 | func NewFS(mountPoint string) (FS, error) {
22 | info, err := os.Stat(mountPoint)
23 | if err != nil {
24 | return "", fmt.Errorf("could not read %s: %s", mountPoint, err)
25 | }
26 | if !info.IsDir() {
27 | return "", fmt.Errorf("mount point %s is not a directory", mountPoint)
28 | }
29 |
30 | return FS(mountPoint), nil
31 | }
32 |
33 | // Path returns the path of the given subsystem relative to the procfs root.
34 | func (fs FS) Path(p ...string) string {
35 | return path.Join(append([]string{string(fs)}, p...)...)
36 | }
37 |
38 | // XFSStats retrieves XFS filesystem runtime statistics.
39 | func (fs FS) XFSStats() (*xfs.Stats, error) {
40 | f, err := os.Open(fs.Path("fs/xfs/stat"))
41 | if err != nil {
42 | return nil, err
43 | }
44 | defer f.Close()
45 |
46 | return xfs.ParseStats(f)
47 | }
48 |
49 | // NFSClientRPCStats retrieves NFS client RPC statistics.
50 | func (fs FS) NFSClientRPCStats() (*nfs.ClientRPCStats, error) {
51 | f, err := os.Open(fs.Path("net/rpc/nfs"))
52 | if err != nil {
53 | return nil, err
54 | }
55 | defer f.Close()
56 |
57 | return nfs.ParseClientRPCStats(f)
58 | }
59 |
60 | // NFSdServerRPCStats retrieves NFS daemon RPC statistics.
61 | func (fs FS) NFSdServerRPCStats() (*nfs.ServerRPCStats, error) {
62 | f, err := os.Open(fs.Path("net/rpc/nfsd"))
63 | if err != nil {
64 | return nil, err
65 | }
66 | defer f.Close()
67 |
68 | return nfs.ParseServerRPCStats(f)
69 | }
70 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/fs_test.go:
--------------------------------------------------------------------------------
1 | package procfs
2 |
3 | import "testing"
4 |
5 | func TestNewFS(t *testing.T) {
6 | if _, err := NewFS("foobar"); err == nil {
7 | t.Error("want NewFS to fail for non-existing mount point")
8 | }
9 |
10 | if _, err := NewFS("procfs.go"); err == nil {
11 | t.Error("want NewFS to fail if mount point is not a directory")
12 | }
13 | }
14 |
15 | func TestFSXFSStats(t *testing.T) {
16 | stats, err := FS("fixtures").XFSStats()
17 | if err != nil {
18 | t.Fatalf("failed to parse XFS stats: %v", err)
19 | }
20 |
21 | // Very lightweight test just to sanity check the path used
22 | // to open XFS stats. Heavier tests in package xfs.
23 | if want, got := uint32(92447), stats.ExtentAllocation.ExtentsAllocated; want != got {
24 | t.Errorf("unexpected extents allocated:\nwant: %d\nhave: %d", want, got)
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/internal/util/parse.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Prometheus Authors
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | package util
15 |
16 | import "strconv"
17 |
18 | // ParseUint32s parses a slice of strings into a slice of uint32s.
19 | func ParseUint32s(ss []string) ([]uint32, error) {
20 | us := make([]uint32, 0, len(ss))
21 | for _, s := range ss {
22 | u, err := strconv.ParseUint(s, 10, 32)
23 | if err != nil {
24 | return nil, err
25 | }
26 |
27 | us = append(us, uint32(u))
28 | }
29 |
30 | return us, nil
31 | }
32 |
33 | // ParseUint64s parses a slice of strings into a slice of uint64s.
34 | func ParseUint64s(ss []string) ([]uint64, error) {
35 | us := make([]uint64, 0, len(ss))
36 | for _, s := range ss {
37 | u, err := strconv.ParseUint(s, 10, 64)
38 | if err != nil {
39 | return nil, err
40 | }
41 |
42 | us = append(us, u)
43 | }
44 |
45 | return us, nil
46 | }
47 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/mdstat_test.go:
--------------------------------------------------------------------------------
1 | package procfs
2 |
3 | import (
4 | "testing"
5 | )
6 |
7 | func TestMDStat(t *testing.T) {
8 | mdStates, err := FS("fixtures").ParseMDStat()
9 | if err != nil {
10 | t.Fatalf("parsing of reference-file failed entirely: %s", err)
11 | }
12 |
13 | refs := map[string]MDStat{
14 | "md3": {"md3", "active", 8, 8, 5853468288, 5853468288},
15 | "md127": {"md127", "active", 2, 2, 312319552, 312319552},
16 | "md0": {"md0", "active", 2, 2, 248896, 248896},
17 | "md4": {"md4", "inactive", 2, 2, 4883648, 4883648},
18 | "md6": {"md6", "active", 1, 2, 195310144, 16775552},
19 | "md8": {"md8", "active", 2, 2, 195310144, 16775552},
20 | "md7": {"md7", "active", 3, 4, 7813735424, 7813735424},
21 | }
22 |
23 | if want, have := len(refs), len(mdStates); want != have {
24 | t.Errorf("want %d parsed md-devices, have %d", want, have)
25 | }
26 | for _, md := range mdStates {
27 | if want, have := refs[md.Name], md; want != have {
28 | t.Errorf("%s: want %v, have %v", md.Name, want, have)
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/net_dev_test.go:
--------------------------------------------------------------------------------
1 | package procfs
2 |
3 | import (
4 | "testing"
5 | )
6 |
7 | func TestNetDevParseLine(t *testing.T) {
8 | const rawLine = ` eth0: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16`
9 |
10 | have, err := NetDev{}.parseLine(rawLine)
11 | if err != nil {
12 | t.Fatal(err)
13 | }
14 |
15 | want := NetDevLine{"eth0", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}
16 | if want != *have {
17 | t.Errorf("want %v, have %v", want, have)
18 | }
19 | }
20 |
21 | func TestNewNetDev(t *testing.T) {
22 | fs, err := NewFS("fixtures")
23 | if err != nil {
24 | t.Fatal(err)
25 | }
26 |
27 | nd, err := fs.NewNetDev()
28 | if err != nil {
29 | t.Fatal(err)
30 | }
31 |
32 | lines := map[string]NetDevLine{
33 | "vethf345468": {Name: "vethf345468", RxBytes: 648, RxPackets: 8, TxBytes: 438, TxPackets: 5},
34 | "lo": {Name: "lo", RxBytes: 1664039048, RxPackets: 1566805, TxBytes: 1664039048, TxPackets: 1566805},
35 | "docker0": {Name: "docker0", RxBytes: 2568, RxPackets: 38, TxBytes: 438, TxPackets: 5},
36 | "eth0": {Name: "eth0", RxBytes: 874354587, RxPackets: 1036395, TxBytes: 563352563, TxPackets: 732147},
37 | }
38 |
39 | if want, have := len(lines), len(nd); want != have {
40 | t.Errorf("want %d parsed net/dev lines, have %d", want, have)
41 | }
42 | for _, line := range nd {
43 | if want, have := lines[line.Name], line; want != have {
44 | t.Errorf("%s: want %v, have %v", line.Name, want, have)
45 | }
46 | }
47 | }
48 |
49 | func TestProcNewNetDev(t *testing.T) {
50 | p, err := FS("fixtures").NewProc(26231)
51 | if err != nil {
52 | t.Fatal(err)
53 | }
54 |
55 | nd, err := p.NewNetDev()
56 | if err != nil {
57 | t.Fatal(err)
58 | }
59 |
60 | lines := map[string]NetDevLine{
61 | "lo": {Name: "lo"},
62 | "eth0": {Name: "eth0", RxBytes: 438, RxPackets: 5, TxBytes: 648, TxPackets: 8},
63 | }
64 |
65 | if want, have := len(lines), len(nd); want != have {
66 | t.Errorf("want %d parsed net/dev lines, have %d", want, have)
67 | }
68 | for _, line := range nd {
69 | if want, have := lines[line.Name], line; want != have {
70 | t.Errorf("%s: want %v, have %v", line.Name, want, have)
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/nfs/parse_nfs.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Prometheus Authors
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | package nfs
15 |
16 | import (
17 | "bufio"
18 | "fmt"
19 | "io"
20 | "strings"
21 |
22 | "github.com/prometheus/procfs/internal/util"
23 | )
24 |
25 | // ParseClientRPCStats returns stats read from /proc/net/rpc/nfs
26 | func ParseClientRPCStats(r io.Reader) (*ClientRPCStats, error) {
27 | stats := &ClientRPCStats{}
28 |
29 | scanner := bufio.NewScanner(r)
30 | for scanner.Scan() {
31 | line := scanner.Text()
32 | parts := strings.Fields(scanner.Text())
33 | // require at least
34 | if len(parts) < 2 {
35 | return nil, fmt.Errorf("invalid NFS metric line %q", line)
36 | }
37 |
38 | values, err := util.ParseUint64s(parts[1:])
39 | if err != nil {
40 | return nil, fmt.Errorf("error parsing NFS metric line: %s", err)
41 | }
42 |
43 | switch metricLine := parts[0]; metricLine {
44 | case "net":
45 | stats.Network, err = parseNetwork(values)
46 | case "rpc":
47 | stats.ClientRPC, err = parseClientRPC(values)
48 | case "proc2":
49 | stats.V2Stats, err = parseV2Stats(values)
50 | case "proc3":
51 | stats.V3Stats, err = parseV3Stats(values)
52 | case "proc4":
53 | stats.ClientV4Stats, err = parseClientV4Stats(values)
54 | default:
55 | return nil, fmt.Errorf("unknown NFS metric line %q", metricLine)
56 | }
57 | if err != nil {
58 | return nil, fmt.Errorf("errors parsing NFS metric line: %s", err)
59 | }
60 | }
61 |
62 | if err := scanner.Err(); err != nil {
63 | return nil, fmt.Errorf("error scanning NFS file: %s", err)
64 | }
65 |
66 | return stats, nil
67 | }
68 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/proc_io.go:
--------------------------------------------------------------------------------
1 | package procfs
2 |
3 | import (
4 | "fmt"
5 | "io/ioutil"
6 | "os"
7 | )
8 |
9 | // ProcIO models the content of /proc//io.
10 | type ProcIO struct {
11 | // Chars read.
12 | RChar uint64
13 | // Chars written.
14 | WChar uint64
15 | // Read syscalls.
16 | SyscR uint64
17 | // Write syscalls.
18 | SyscW uint64
19 | // Bytes read.
20 | ReadBytes uint64
21 | // Bytes written.
22 | WriteBytes uint64
23 | // Bytes written, but taking into account truncation. See
24 | // Documentation/filesystems/proc.txt in the kernel sources for
25 | // detailed explanation.
26 | CancelledWriteBytes int64
27 | }
28 |
29 | // NewIO creates a new ProcIO instance from a given Proc instance.
30 | func (p Proc) NewIO() (ProcIO, error) {
31 | pio := ProcIO{}
32 |
33 | f, err := os.Open(p.path("io"))
34 | if err != nil {
35 | return pio, err
36 | }
37 | defer f.Close()
38 |
39 | data, err := ioutil.ReadAll(f)
40 | if err != nil {
41 | return pio, err
42 | }
43 |
44 | ioFormat := "rchar: %d\nwchar: %d\nsyscr: %d\nsyscw: %d\n" +
45 | "read_bytes: %d\nwrite_bytes: %d\n" +
46 | "cancelled_write_bytes: %d\n"
47 |
48 | _, err = fmt.Sscanf(string(data), ioFormat, &pio.RChar, &pio.WChar, &pio.SyscR,
49 | &pio.SyscW, &pio.ReadBytes, &pio.WriteBytes, &pio.CancelledWriteBytes)
50 |
51 | return pio, err
52 | }
53 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/proc_io_test.go:
--------------------------------------------------------------------------------
1 | package procfs
2 |
3 | import "testing"
4 |
5 | func TestProcIO(t *testing.T) {
6 | p, err := FS("fixtures").NewProc(26231)
7 | if err != nil {
8 | t.Fatal(err)
9 | }
10 |
11 | s, err := p.NewIO()
12 | if err != nil {
13 | t.Fatal(err)
14 | }
15 |
16 | for _, test := range []struct {
17 | name string
18 | want int64
19 | have int64
20 | }{
21 | {name: "RChar", want: 750339, have: int64(s.RChar)},
22 | {name: "WChar", want: 818609, have: int64(s.WChar)},
23 | {name: "SyscR", want: 7405, have: int64(s.SyscR)},
24 | {name: "SyscW", want: 5245, have: int64(s.SyscW)},
25 | {name: "ReadBytes", want: 1024, have: int64(s.ReadBytes)},
26 | {name: "WriteBytes", want: 2048, have: int64(s.WriteBytes)},
27 | {name: "CancelledWriteBytes", want: -1024, have: s.CancelledWriteBytes},
28 | } {
29 | if test.want != test.have {
30 | t.Errorf("want %s %d, have %d", test.name, test.want, test.have)
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/proc_limits_test.go:
--------------------------------------------------------------------------------
1 | package procfs
2 |
3 | import "testing"
4 |
5 | func TestNewLimits(t *testing.T) {
6 | p, err := FS("fixtures").NewProc(26231)
7 | if err != nil {
8 | t.Fatal(err)
9 | }
10 |
11 | l, err := p.NewLimits()
12 | if err != nil {
13 | t.Fatal(err)
14 | }
15 |
16 | for _, test := range []struct {
17 | name string
18 | want int64
19 | have int64
20 | }{
21 | {name: "cpu time", want: -1, have: l.CPUTime},
22 | {name: "open files", want: 2048, have: l.OpenFiles},
23 | {name: "msgqueue size", want: 819200, have: l.MsqqueueSize},
24 | {name: "nice priority", want: 0, have: l.NicePriority},
25 | {name: "address space", want: 8589934592, have: l.AddressSpace},
26 | } {
27 | if test.want != test.have {
28 | t.Errorf("want %s %d, have %d", test.name, test.want, test.have)
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/proc_ns.go:
--------------------------------------------------------------------------------
1 | package procfs
2 |
3 | import (
4 | "fmt"
5 | "os"
6 | "strconv"
7 | "strings"
8 | )
9 |
10 | // Namespace represents a single namespace of a process.
11 | type Namespace struct {
12 | Type string // Namespace type.
13 | Inode uint32 // Inode number of the namespace. If two processes are in the same namespace their inodes will match.
14 | }
15 |
16 | // Namespaces contains all of the namespaces that the process is contained in.
17 | type Namespaces map[string]Namespace
18 |
19 | // NewNamespaces reads from /proc/[pid/ns/* to get the namespaces of which the
20 | // process is a member.
21 | func (p Proc) NewNamespaces() (Namespaces, error) {
22 | d, err := os.Open(p.path("ns"))
23 | if err != nil {
24 | return nil, err
25 | }
26 | defer d.Close()
27 |
28 | names, err := d.Readdirnames(-1)
29 | if err != nil {
30 | return nil, fmt.Errorf("failed to read contents of ns dir: %v", err)
31 | }
32 |
33 | ns := make(Namespaces, len(names))
34 | for _, name := range names {
35 | target, err := os.Readlink(p.path("ns", name))
36 | if err != nil {
37 | return nil, err
38 | }
39 |
40 | fields := strings.SplitN(target, ":", 2)
41 | if len(fields) != 2 {
42 | return nil, fmt.Errorf("failed to parse namespace type and inode from '%v'", target)
43 | }
44 |
45 | typ := fields[0]
46 | inode, err := strconv.ParseUint(strings.Trim(fields[1], "[]"), 10, 32)
47 | if err != nil {
48 | return nil, fmt.Errorf("failed to parse inode from '%v': %v", fields[1], err)
49 | }
50 |
51 | ns[name] = Namespace{typ, uint32(inode)}
52 | }
53 |
54 | return ns, nil
55 | }
56 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/proc_ns_test.go:
--------------------------------------------------------------------------------
1 | package procfs
2 |
3 | import (
4 | "testing"
5 | )
6 |
7 | func TestNewNamespaces(t *testing.T) {
8 | p, err := FS("fixtures").NewProc(26231)
9 | if err != nil {
10 | t.Fatal(err)
11 | }
12 |
13 | namespaces, err := p.NewNamespaces()
14 | if err != nil {
15 | t.Fatal(err)
16 | }
17 |
18 | expectedNamespaces := map[string]Namespace{
19 | "mnt": {"mnt", 4026531840},
20 | "net": {"net", 4026531993},
21 | }
22 |
23 | if want, have := len(expectedNamespaces), len(namespaces); want != have {
24 | t.Errorf("want %d parsed namespaces, have %d", want, have)
25 | }
26 | for _, ns := range namespaces {
27 | if want, have := expectedNamespaces[ns.Type], ns; want != have {
28 | t.Errorf("%s: want %v, have %v", ns.Type, want, have)
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/stat_test.go:
--------------------------------------------------------------------------------
1 | package procfs
2 |
3 | import "testing"
4 |
5 | func TestStat(t *testing.T) {
6 | s, err := FS("fixtures").NewStat()
7 | if err != nil {
8 | t.Fatal(err)
9 | }
10 |
11 | // cpu
12 | if want, have := float64(301854)/userHZ, s.CPUTotal.User; want != have {
13 | t.Errorf("want cpu/user %v, have %v", want, have)
14 | }
15 | if want, have := float64(31)/userHZ, s.CPU[7].SoftIRQ; want != have {
16 | t.Errorf("want cpu7/softirq %v, have %v", want, have)
17 | }
18 |
19 | // intr
20 | if want, have := uint64(8885917), s.IRQTotal; want != have {
21 | t.Errorf("want irq/total %d, have %d", want, have)
22 | }
23 | if want, have := uint64(1), s.IRQ[8]; want != have {
24 | t.Errorf("want irq8 %d, have %d", want, have)
25 | }
26 |
27 | // ctxt
28 | if want, have := uint64(38014093), s.ContextSwitches; want != have {
29 | t.Errorf("want context switches (ctxt) %d, have %d", want, have)
30 | }
31 |
32 | // btime
33 | if want, have := uint64(1418183276), s.BootTime; want != have {
34 | t.Errorf("want boot time (btime) %d, have %d", want, have)
35 | }
36 |
37 | // processes
38 | if want, have := uint64(26442), s.ProcessCreated; want != have {
39 | t.Errorf("want process created (processes) %d, have %d", want, have)
40 | }
41 |
42 | // procs_running
43 | if want, have := uint64(2), s.ProcessesRunning; want != have {
44 | t.Errorf("want processes running (procs_running) %d, have %d", want, have)
45 | }
46 |
47 | // procs_blocked
48 | if want, have := uint64(1), s.ProcessesBlocked; want != have {
49 | t.Errorf("want processes blocked (procs_blocked) %d, have %d", want, have)
50 | }
51 |
52 | // softirq
53 | if want, have := uint64(5057579), s.SoftIRQTotal; want != have {
54 | t.Errorf("want softirq total %d, have %d", want, have)
55 | }
56 |
57 | if want, have := uint64(508444), s.SoftIRQ.Rcu; want != have {
58 | t.Errorf("want softirq RCU %d, have %d", want, have)
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/sysfs/.gitignore:
--------------------------------------------------------------------------------
1 | fixtures/
2 |
--------------------------------------------------------------------------------
/vendor/github.com/prometheus/procfs/sysfs/doc.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Prometheus Authors
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | // Package sysfs provides functions to retrieve system and kernel metrics
15 | // from the pseudo-filesystem sys.
16 | package sysfs
17 |
--------------------------------------------------------------------------------