id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
22,100 | kubernetes-retired/heapster | metrics/api/v1/api.go | NewApi | func NewApi(runningInKubernetes bool, metricSink *metricsink.MetricSink, historicalSource core.HistoricalSource, disableMetricExport bool) *Api {
gkeMetrics := make(map[string]core.MetricDescriptor)
gkeLabels := make(map[string]core.LabelDescriptor)
for _, val := range core.StandardMetrics {
gkeMetrics[val.Name] =... | go | func NewApi(runningInKubernetes bool, metricSink *metricsink.MetricSink, historicalSource core.HistoricalSource, disableMetricExport bool) *Api {
gkeMetrics := make(map[string]core.MetricDescriptor)
gkeLabels := make(map[string]core.LabelDescriptor)
for _, val := range core.StandardMetrics {
gkeMetrics[val.Name] =... | [
"func",
"NewApi",
"(",
"runningInKubernetes",
"bool",
",",
"metricSink",
"*",
"metricsink",
".",
"MetricSink",
",",
"historicalSource",
"core",
".",
"HistoricalSource",
",",
"disableMetricExport",
"bool",
")",
"*",
"Api",
"{",
"gkeMetrics",
":=",
"make",
"(",
"m... | // Create a new Api to serve from the specified cache. | [
"Create",
"a",
"new",
"Api",
"to",
"serve",
"from",
"the",
"specified",
"cache",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/api.go#L42-L72 |
22,101 | kubernetes-retired/heapster | metrics/api/v1/api.go | Register | func (a *Api) Register(container *restful.Container) {
ws := new(restful.WebService)
ws.Path("/api/v1/metric-export").
Doc("Exports the latest point for all Heapster metrics").
Produces(restful.MIME_JSON)
ws.Route(ws.GET("").
To(a.exportMetrics).
Doc("export the latest data point for all metrics").
Operati... | go | func (a *Api) Register(container *restful.Container) {
ws := new(restful.WebService)
ws.Path("/api/v1/metric-export").
Doc("Exports the latest point for all Heapster metrics").
Produces(restful.MIME_JSON)
ws.Route(ws.GET("").
To(a.exportMetrics).
Doc("export the latest data point for all metrics").
Operati... | [
"func",
"(",
"a",
"*",
"Api",
")",
"Register",
"(",
"container",
"*",
"restful",
".",
"Container",
")",
"{",
"ws",
":=",
"new",
"(",
"restful",
".",
"WebService",
")",
"\n",
"ws",
".",
"Path",
"(",
"\"",
"\"",
")",
".",
"Doc",
"(",
"\"",
"\"",
... | // Register the mainApi on the specified endpoint. | [
"Register",
"the",
"mainApi",
"on",
"the",
"specified",
"endpoint",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/api.go#L75-L104 |
22,102 | kubernetes-retired/heapster | metrics/sinks/hawkular/driver.go | NewHawkularSink | func NewHawkularSink(u *url.URL) (core.DataSink, error) {
sink := &hawkularSink{
uri: u,
batchSize: 1000,
}
if err := sink.init(); err != nil {
return nil, err
}
metrics := make([]core.MetricDescriptor, 0, len(core.AllMetrics))
for _, metric := range core.AllMetrics {
metrics = append(metrics, metr... | go | func NewHawkularSink(u *url.URL) (core.DataSink, error) {
sink := &hawkularSink{
uri: u,
batchSize: 1000,
}
if err := sink.init(); err != nil {
return nil, err
}
metrics := make([]core.MetricDescriptor, 0, len(core.AllMetrics))
for _, metric := range core.AllMetrics {
metrics = append(metrics, metr... | [
"func",
"NewHawkularSink",
"(",
"u",
"*",
"url",
".",
"URL",
")",
"(",
"core",
".",
"DataSink",
",",
"error",
")",
"{",
"sink",
":=",
"&",
"hawkularSink",
"{",
"uri",
":",
"u",
",",
"batchSize",
":",
"1000",
",",
"}",
"\n",
"if",
"err",
":=",
"si... | // NewHawkularSink Creates and returns a new hawkularSink instance | [
"NewHawkularSink",
"Creates",
"and",
"returns",
"a",
"new",
"hawkularSink",
"instance"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/hawkular/driver.go#L178-L193 |
22,103 | kubernetes-retired/heapster | common/elasticsearch/elasticsearch.go | SaveData | func (esSvc *ElasticSearchService) SaveData(date time.Time, typeName string, sinkData []interface{}) error {
if typeName == "" || len(sinkData) == 0 {
return nil
}
indexName := esSvc.Index(date)
// Use the IndexExists service to check if a specified index exists.
exists, err := esSvc.EsClient.IndexExists(index... | go | func (esSvc *ElasticSearchService) SaveData(date time.Time, typeName string, sinkData []interface{}) error {
if typeName == "" || len(sinkData) == 0 {
return nil
}
indexName := esSvc.Index(date)
// Use the IndexExists service to check if a specified index exists.
exists, err := esSvc.EsClient.IndexExists(index... | [
"func",
"(",
"esSvc",
"*",
"ElasticSearchService",
")",
"SaveData",
"(",
"date",
"time",
".",
"Time",
",",
"typeName",
"string",
",",
"sinkData",
"[",
"]",
"interface",
"{",
"}",
")",
"error",
"{",
"if",
"typeName",
"==",
"\"",
"\"",
"||",
"len",
"(",
... | // SaveDataIntoES save metrics and events to ES by using ES client | [
"SaveDataIntoES",
"save",
"metrics",
"and",
"events",
"to",
"ES",
"by",
"using",
"ES",
"client"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/common/elasticsearch/elasticsearch.go#L54-L122 |
22,104 | kubernetes-retired/heapster | metrics/sinks/influxdb/influxdb.go | newSink | func newSink(c influxdb_common.InfluxdbConfig) core.DataSink {
client, err := influxdb_common.NewClient(c)
if err != nil {
glog.Errorf("issues while creating an InfluxDB sink: %v, will retry on use", err)
}
return &influxdbSink{
client: client, // can be nil
c: c,
conChan: make(chan struct{}, c.Concu... | go | func newSink(c influxdb_common.InfluxdbConfig) core.DataSink {
client, err := influxdb_common.NewClient(c)
if err != nil {
glog.Errorf("issues while creating an InfluxDB sink: %v, will retry on use", err)
}
return &influxdbSink{
client: client, // can be nil
c: c,
conChan: make(chan struct{}, c.Concu... | [
"func",
"newSink",
"(",
"c",
"influxdb_common",
".",
"InfluxdbConfig",
")",
"core",
".",
"DataSink",
"{",
"client",
",",
"err",
":=",
"influxdb_common",
".",
"NewClient",
"(",
"c",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"glog",
".",
"Errorf",
"(",
"... | // Returns a thread-compatible implementation of influxdb interactions. | [
"Returns",
"a",
"thread",
"-",
"compatible",
"implementation",
"of",
"influxdb",
"interactions",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/influxdb/influxdb.go#L294-L304 |
22,105 | kubernetes-retired/heapster | integration/framework.go | ParseRBAC | func (self *realKubeFramework) ParseRBAC(filePath string) (*rbacv1.ClusterRoleBinding, error) {
obj, err := self.loadRBACObject(filePath)
if err != nil {
return nil, err
}
rbac, ok := obj.(*rbacv1.ClusterRoleBinding)
if !ok {
return nil, fmt.Errorf("Failed to cast clusterrolebinding: %v", obj)
}
return rbac... | go | func (self *realKubeFramework) ParseRBAC(filePath string) (*rbacv1.ClusterRoleBinding, error) {
obj, err := self.loadRBACObject(filePath)
if err != nil {
return nil, err
}
rbac, ok := obj.(*rbacv1.ClusterRoleBinding)
if !ok {
return nil, fmt.Errorf("Failed to cast clusterrolebinding: %v", obj)
}
return rbac... | [
"func",
"(",
"self",
"*",
"realKubeFramework",
")",
"ParseRBAC",
"(",
"filePath",
"string",
")",
"(",
"*",
"rbacv1",
".",
"ClusterRoleBinding",
",",
"error",
")",
"{",
"obj",
",",
"err",
":=",
"self",
".",
"loadRBACObject",
"(",
"filePath",
")",
"\n",
"i... | // Parses and Returns a RBAC object contained in 'filePath' | [
"Parses",
"and",
"Returns",
"a",
"RBAC",
"object",
"contained",
"in",
"filePath"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/integration/framework.go#L402-L413 |
22,106 | kubernetes-retired/heapster | integration/framework.go | CreateRBAC | func (self *realKubeFramework) CreateRBAC(rbac *rbacv1.ClusterRoleBinding) error {
_, err := self.kubeClient.RbacV1().ClusterRoleBindings().Create(rbac)
return err
} | go | func (self *realKubeFramework) CreateRBAC(rbac *rbacv1.ClusterRoleBinding) error {
_, err := self.kubeClient.RbacV1().ClusterRoleBindings().Create(rbac)
return err
} | [
"func",
"(",
"self",
"*",
"realKubeFramework",
")",
"CreateRBAC",
"(",
"rbac",
"*",
"rbacv1",
".",
"ClusterRoleBinding",
")",
"error",
"{",
"_",
",",
"err",
":=",
"self",
".",
"kubeClient",
".",
"RbacV1",
"(",
")",
".",
"ClusterRoleBindings",
"(",
")",
"... | // CreateRBAC creates the RBAC object | [
"CreateRBAC",
"creates",
"the",
"RBAC",
"object"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/integration/framework.go#L416-L419 |
22,107 | kubernetes-retired/heapster | integration/framework.go | ParseServiceAccount | func (self *realKubeFramework) ParseServiceAccount(filePath string) (*v1.ServiceAccount, error) {
obj, err := self.loadObject(filePath)
if err != nil {
return nil, err
}
sa, ok := obj.(*v1.ServiceAccount)
if !ok {
return nil, fmt.Errorf("Failed to cast serviceaccount: %v", obj)
}
return sa, nil
} | go | func (self *realKubeFramework) ParseServiceAccount(filePath string) (*v1.ServiceAccount, error) {
obj, err := self.loadObject(filePath)
if err != nil {
return nil, err
}
sa, ok := obj.(*v1.ServiceAccount)
if !ok {
return nil, fmt.Errorf("Failed to cast serviceaccount: %v", obj)
}
return sa, nil
} | [
"func",
"(",
"self",
"*",
"realKubeFramework",
")",
"ParseServiceAccount",
"(",
"filePath",
"string",
")",
"(",
"*",
"v1",
".",
"ServiceAccount",
",",
"error",
")",
"{",
"obj",
",",
"err",
":=",
"self",
".",
"loadObject",
"(",
"filePath",
")",
"\n",
"if"... | // Parses and Returns a ServiceAccount object contained in 'filePath' | [
"Parses",
"and",
"Returns",
"a",
"ServiceAccount",
"object",
"contained",
"in",
"filePath"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/integration/framework.go#L422-L433 |
22,108 | kubernetes-retired/heapster | integration/framework.go | CreateServiceAccount | func (self *realKubeFramework) CreateServiceAccount(sa *v1.ServiceAccount) error {
_, err := self.kubeClient.CoreV1().ServiceAccounts(sa.Namespace).Create(sa)
return err
} | go | func (self *realKubeFramework) CreateServiceAccount(sa *v1.ServiceAccount) error {
_, err := self.kubeClient.CoreV1().ServiceAccounts(sa.Namespace).Create(sa)
return err
} | [
"func",
"(",
"self",
"*",
"realKubeFramework",
")",
"CreateServiceAccount",
"(",
"sa",
"*",
"v1",
".",
"ServiceAccount",
")",
"error",
"{",
"_",
",",
"err",
":=",
"self",
".",
"kubeClient",
".",
"CoreV1",
"(",
")",
".",
"ServiceAccounts",
"(",
"sa",
".",... | // CreateServiceAccount creates the ServiceAccount object | [
"CreateServiceAccount",
"creates",
"the",
"ServiceAccount",
"object"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/integration/framework.go#L436-L439 |
22,109 | kubernetes-retired/heapster | common/honeycomb/honeycomb.go | SendBatch | func (c *HoneycombClient) SendBatch(batch Batch) error {
if len(batch) == 0 {
// Nothing to send
return nil
}
errs := []string{}
for i := 0; i < len(batch); i += maxBatchSize {
offset := i + maxBatchSize
if offset > len(batch) {
offset = len(batch)
}
if err := c.sendBatch(batch[i:offset]); err != ni... | go | func (c *HoneycombClient) SendBatch(batch Batch) error {
if len(batch) == 0 {
// Nothing to send
return nil
}
errs := []string{}
for i := 0; i < len(batch); i += maxBatchSize {
offset := i + maxBatchSize
if offset > len(batch) {
offset = len(batch)
}
if err := c.sendBatch(batch[i:offset]); err != ni... | [
"func",
"(",
"c",
"*",
"HoneycombClient",
")",
"SendBatch",
"(",
"batch",
"Batch",
")",
"error",
"{",
"if",
"len",
"(",
"batch",
")",
"==",
"0",
"{",
"// Nothing to send",
"return",
"nil",
"\n",
"}",
"\n\n",
"errs",
":=",
"[",
"]",
"string",
"{",
"}"... | // SendBatch splits the top-level batch into sub-batches if needed. Otherwise,
// requests that are too large will be rejected by the Honeycomb API. | [
"SendBatch",
"splits",
"the",
"top",
"-",
"level",
"batch",
"into",
"sub",
"-",
"batches",
"if",
"needed",
".",
"Otherwise",
"requests",
"that",
"are",
"too",
"large",
"will",
"be",
"rejected",
"by",
"the",
"Honeycomb",
"API",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/common/honeycomb/honeycomb.go#L108-L130 |
22,110 | kubernetes-retired/heapster | metrics/sinks/influxdb/influxdb_historical.go | checkSanitizedMetricName | func (sink *influxdbSink) checkSanitizedMetricName(name string) error {
if !metricAllowedChars.MatchString(name) {
return fmt.Errorf("Invalid metric name %q", name)
}
return nil
} | go | func (sink *influxdbSink) checkSanitizedMetricName(name string) error {
if !metricAllowedChars.MatchString(name) {
return fmt.Errorf("Invalid metric name %q", name)
}
return nil
} | [
"func",
"(",
"sink",
"*",
"influxdbSink",
")",
"checkSanitizedMetricName",
"(",
"name",
"string",
")",
"error",
"{",
"if",
"!",
"metricAllowedChars",
".",
"MatchString",
"(",
"name",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
... | // checkSanitizedMetricName errors out if invalid characters are found in the metric name, since InfluxDB
// does not widely support bound parameters yet, and we need to sanitize our inputs. | [
"checkSanitizedMetricName",
"errors",
"out",
"if",
"invalid",
"characters",
"are",
"found",
"in",
"the",
"metric",
"name",
"since",
"InfluxDB",
"does",
"not",
"widely",
"support",
"bound",
"parameters",
"yet",
"and",
"we",
"need",
"to",
"sanitize",
"our",
"input... | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/influxdb/influxdb_historical.go#L78-L84 |
22,111 | kubernetes-retired/heapster | metrics/sinks/influxdb/influxdb_historical.go | checkSanitizedMetricLabels | func (sink *influxdbSink) checkSanitizedMetricLabels(labels map[string]string) error {
// label names have the same restrictions as metric names, here
for k, v := range labels {
if !metricAllowedChars.MatchString(k) {
return fmt.Errorf("Invalid label name %q", k)
}
// for metric values, we're somewhat more ... | go | func (sink *influxdbSink) checkSanitizedMetricLabels(labels map[string]string) error {
// label names have the same restrictions as metric names, here
for k, v := range labels {
if !metricAllowedChars.MatchString(k) {
return fmt.Errorf("Invalid label name %q", k)
}
// for metric values, we're somewhat more ... | [
"func",
"(",
"sink",
"*",
"influxdbSink",
")",
"checkSanitizedMetricLabels",
"(",
"labels",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"// label names have the same restrictions as metric names, here",
"for",
"k",
",",
"v",
":=",
"range",
"labels",
"{",... | // checkSanitizedMetricLabels errors out if invalid characters are found in the label name or label value, since
// InfluxDb does not widely support bound parameters yet, and we need to sanitize our inputs. | [
"checkSanitizedMetricLabels",
"errors",
"out",
"if",
"invalid",
"characters",
"are",
"found",
"in",
"the",
"label",
"name",
"or",
"label",
"value",
"since",
"InfluxDb",
"does",
"not",
"widely",
"support",
"bound",
"parameters",
"yet",
"and",
"we",
"need",
"to",
... | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/influxdb/influxdb_historical.go#L88-L110 |
22,112 | kubernetes-retired/heapster | metrics/sinks/influxdb/influxdb_historical.go | aggregationFunc | func (sink *influxdbSink) aggregationFunc(aggregationName core.AggregationType, fieldName string) string {
switch aggregationName {
case core.AggregationTypeAverage:
return fmt.Sprintf("MEAN(%q)", fieldName)
case core.AggregationTypeMaximum:
return fmt.Sprintf("MAX(%q)", fieldName)
case core.AggregationTypeMini... | go | func (sink *influxdbSink) aggregationFunc(aggregationName core.AggregationType, fieldName string) string {
switch aggregationName {
case core.AggregationTypeAverage:
return fmt.Sprintf("MEAN(%q)", fieldName)
case core.AggregationTypeMaximum:
return fmt.Sprintf("MAX(%q)", fieldName)
case core.AggregationTypeMini... | [
"func",
"(",
"sink",
"*",
"influxdbSink",
")",
"aggregationFunc",
"(",
"aggregationName",
"core",
".",
"AggregationType",
",",
"fieldName",
"string",
")",
"string",
"{",
"switch",
"aggregationName",
"{",
"case",
"core",
".",
"AggregationTypeAverage",
":",
"return"... | // aggregationFunc converts an aggregation name into the equivalent call to an InfluxQL
// aggregation function | [
"aggregationFunc",
"converts",
"an",
"aggregation",
"name",
"into",
"the",
"equivalent",
"call",
"to",
"an",
"InfluxQL",
"aggregation",
"function"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/influxdb/influxdb_historical.go#L114-L136 |
22,113 | kubernetes-retired/heapster | metrics/sinks/influxdb/influxdb_historical.go | keyToSelector | func (sink *influxdbSink) keyToSelector(key core.HistoricalKey) string {
typeSel := fmt.Sprintf("type = '%s'", key.ObjectType)
switch key.ObjectType {
case core.MetricSetTypeNode:
return fmt.Sprintf("%s AND %s = '%s'", typeSel, core.LabelNodename.Key, key.NodeName)
case core.MetricSetTypeSystemContainer:
return... | go | func (sink *influxdbSink) keyToSelector(key core.HistoricalKey) string {
typeSel := fmt.Sprintf("type = '%s'", key.ObjectType)
switch key.ObjectType {
case core.MetricSetTypeNode:
return fmt.Sprintf("%s AND %s = '%s'", typeSel, core.LabelNodename.Key, key.NodeName)
case core.MetricSetTypeSystemContainer:
return... | [
"func",
"(",
"sink",
"*",
"influxdbSink",
")",
"keyToSelector",
"(",
"key",
"core",
".",
"HistoricalKey",
")",
"string",
"{",
"typeSel",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"key",
".",
"ObjectType",
")",
"\n",
"switch",
"key",
".",
"Obje... | // keyToSelector converts a HistoricalKey to an InfluxQL predicate | [
"keyToSelector",
"converts",
"a",
"HistoricalKey",
"to",
"an",
"InfluxQL",
"predicate"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/influxdb/influxdb_historical.go#L139-L166 |
22,114 | kubernetes-retired/heapster | metrics/sinks/influxdb/influxdb_historical.go | labelsToPredicate | func (sink *influxdbSink) labelsToPredicate(labels map[string]string) string {
if len(labels) == 0 {
return ""
}
parts := make([]string, 0, len(labels))
for k, v := range labels {
parts = append(parts, fmt.Sprintf("%q = '%s'", k, v))
}
return strings.Join(parts, " AND ")
} | go | func (sink *influxdbSink) labelsToPredicate(labels map[string]string) string {
if len(labels) == 0 {
return ""
}
parts := make([]string, 0, len(labels))
for k, v := range labels {
parts = append(parts, fmt.Sprintf("%q = '%s'", k, v))
}
return strings.Join(parts, " AND ")
} | [
"func",
"(",
"sink",
"*",
"influxdbSink",
")",
"labelsToPredicate",
"(",
"labels",
"map",
"[",
"string",
"]",
"string",
")",
"string",
"{",
"if",
"len",
"(",
"labels",
")",
"==",
"0",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"parts",
":=",
"make... | // labelsToPredicate composes an InfluxQL predicate based on the given map of labels | [
"labelsToPredicate",
"composes",
"an",
"InfluxQL",
"predicate",
"based",
"on",
"the",
"given",
"map",
"of",
"labels"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/influxdb/influxdb_historical.go#L169-L180 |
22,115 | kubernetes-retired/heapster | metrics/sinks/influxdb/influxdb_historical.go | composeRawQuery | func (sink *influxdbSink) composeRawQuery(metricName string, labels map[string]string, metricKeys []core.HistoricalKey, start, end time.Time) string {
seriesName, fieldName := sink.metricToSeriesAndField(metricName)
queries := make([]string, len(metricKeys))
for i, key := range metricKeys {
pred := sink.keyToSele... | go | func (sink *influxdbSink) composeRawQuery(metricName string, labels map[string]string, metricKeys []core.HistoricalKey, start, end time.Time) string {
seriesName, fieldName := sink.metricToSeriesAndField(metricName)
queries := make([]string, len(metricKeys))
for i, key := range metricKeys {
pred := sink.keyToSele... | [
"func",
"(",
"sink",
"*",
"influxdbSink",
")",
"composeRawQuery",
"(",
"metricName",
"string",
",",
"labels",
"map",
"[",
"string",
"]",
"string",
",",
"metricKeys",
"[",
"]",
"core",
".",
"HistoricalKey",
",",
"start",
",",
"end",
"time",
".",
"Time",
"... | // composeRawQuery creates the InfluxQL query to fetch the given metric values | [
"composeRawQuery",
"creates",
"the",
"InfluxQL",
"query",
"to",
"fetch",
"the",
"given",
"metric",
"values"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/influxdb/influxdb_historical.go#L198-L217 |
22,116 | kubernetes-retired/heapster | metrics/sinks/influxdb/influxdb_historical.go | parseRawQueryRow | func (sink *influxdbSink) parseRawQueryRow(rawRow influx_models.Row) ([]core.TimestampedMetricValue, error) {
vals := make([]core.TimestampedMetricValue, len(rawRow.Values))
wasInt := make(map[string]bool, 1)
for i, rawVal := range rawRow.Values {
val := core.TimestampedMetricValue{}
if ts, err := time.Parse(ti... | go | func (sink *influxdbSink) parseRawQueryRow(rawRow influx_models.Row) ([]core.TimestampedMetricValue, error) {
vals := make([]core.TimestampedMetricValue, len(rawRow.Values))
wasInt := make(map[string]bool, 1)
for i, rawVal := range rawRow.Values {
val := core.TimestampedMetricValue{}
if ts, err := time.Parse(ti... | [
"func",
"(",
"sink",
"*",
"influxdbSink",
")",
"parseRawQueryRow",
"(",
"rawRow",
"influx_models",
".",
"Row",
")",
"(",
"[",
"]",
"core",
".",
"TimestampedMetricValue",
",",
"error",
")",
"{",
"vals",
":=",
"make",
"(",
"[",
"]",
"core",
".",
"Timestamp... | // parseRawQueryRow parses a set of timestamped metric values from unstructured JSON output into the
// appropriate Heapster form | [
"parseRawQueryRow",
"parses",
"a",
"set",
"of",
"timestamped",
"metric",
"values",
"from",
"unstructured",
"JSON",
"output",
"into",
"the",
"appropriate",
"Heapster",
"form"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/influxdb/influxdb_historical.go#L221-L252 |
22,117 | kubernetes-retired/heapster | metrics/sinks/influxdb/influxdb_historical.go | composeAggregateQuery | func (sink *influxdbSink) composeAggregateQuery(metricName string, labels map[string]string, aggregations []core.AggregationType, metricKeys []core.HistoricalKey, start, end time.Time, bucketSize time.Duration) string {
seriesName, fieldName := sink.metricToSeriesAndField(metricName)
var bucketSizeNanoSeconds int64 ... | go | func (sink *influxdbSink) composeAggregateQuery(metricName string, labels map[string]string, aggregations []core.AggregationType, metricKeys []core.HistoricalKey, start, end time.Time, bucketSize time.Duration) string {
seriesName, fieldName := sink.metricToSeriesAndField(metricName)
var bucketSizeNanoSeconds int64 ... | [
"func",
"(",
"sink",
"*",
"influxdbSink",
")",
"composeAggregateQuery",
"(",
"metricName",
"string",
",",
"labels",
"map",
"[",
"string",
"]",
"string",
",",
"aggregations",
"[",
"]",
"core",
".",
"AggregationType",
",",
"metricKeys",
"[",
"]",
"core",
".",
... | // composeAggregateQuery creates the InfluxQL query to fetch the given aggregation values | [
"composeAggregateQuery",
"creates",
"the",
"InfluxQL",
"query",
"to",
"fetch",
"the",
"given",
"aggregation",
"values"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/influxdb/influxdb_historical.go#L337-L378 |
22,118 | kubernetes-retired/heapster | metrics/sinks/influxdb/influxdb_historical.go | parseAggregateQueryRow | func (sink *influxdbSink) parseAggregateQueryRow(rawRow influx_models.Row, aggregationLookup map[core.AggregationType]int, bucketSize time.Duration) ([]core.TimestampedAggregationValue, error) {
vals := make([]core.TimestampedAggregationValue, len(rawRow.Values))
wasInt := make(map[string]bool, len(aggregationLookup)... | go | func (sink *influxdbSink) parseAggregateQueryRow(rawRow influx_models.Row, aggregationLookup map[core.AggregationType]int, bucketSize time.Duration) ([]core.TimestampedAggregationValue, error) {
vals := make([]core.TimestampedAggregationValue, len(rawRow.Values))
wasInt := make(map[string]bool, len(aggregationLookup)... | [
"func",
"(",
"sink",
"*",
"influxdbSink",
")",
"parseAggregateQueryRow",
"(",
"rawRow",
"influx_models",
".",
"Row",
",",
"aggregationLookup",
"map",
"[",
"core",
".",
"AggregationType",
"]",
"int",
",",
"bucketSize",
"time",
".",
"Duration",
")",
"(",
"[",
... | // parseRawQueryRow parses a set of timestamped aggregation values from unstructured JSON output into the
// appropriate Heapster form | [
"parseRawQueryRow",
"parses",
"a",
"set",
"of",
"timestamped",
"aggregation",
"values",
"from",
"unstructured",
"JSON",
"output",
"into",
"the",
"appropriate",
"Heapster",
"form"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/influxdb/influxdb_historical.go#L382-L422 |
22,119 | kubernetes-retired/heapster | metrics/sinks/influxdb/influxdb_historical.go | setAggregationValueIfPresent | func setAggregationValueIfPresent(aggName core.AggregationType, rawVal []interface{}, aggregations *core.AggregationValue, indexLookup map[core.AggregationType]int, wasInt map[string]bool) error {
if fieldIndex, ok := indexLookup[aggName]; ok {
targetValue := &core.MetricValue{}
if err := tryParseMetricValue(strin... | go | func setAggregationValueIfPresent(aggName core.AggregationType, rawVal []interface{}, aggregations *core.AggregationValue, indexLookup map[core.AggregationType]int, wasInt map[string]bool) error {
if fieldIndex, ok := indexLookup[aggName]; ok {
targetValue := &core.MetricValue{}
if err := tryParseMetricValue(strin... | [
"func",
"setAggregationValueIfPresent",
"(",
"aggName",
"core",
".",
"AggregationType",
",",
"rawVal",
"[",
"]",
"interface",
"{",
"}",
",",
"aggregations",
"*",
"core",
".",
"AggregationValue",
",",
"indexLookup",
"map",
"[",
"core",
".",
"AggregationType",
"]"... | // setAggregationValueIfPresent checks if the given metric value is present in the list of raw values, and if so,
// copies it to the output format | [
"setAggregationValueIfPresent",
"checks",
"if",
"the",
"given",
"metric",
"value",
"is",
"present",
"in",
"the",
"list",
"of",
"raw",
"values",
"and",
"if",
"so",
"copies",
"it",
"to",
"the",
"output",
"format"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/influxdb/influxdb_historical.go#L524-L535 |
22,120 | kubernetes-retired/heapster | metrics/sinks/influxdb/influxdb_historical.go | tryParseMetricValue | func tryParseMetricValue(aggName string, rawVal []interface{}, targetValue *core.MetricValue, fieldIndex int, wasInt map[string]bool) error {
// the Influx client decodes numeric fields to json.Number (a string), so we have to deal with that --
// assume, starting off, that values may be either float or int. Try int... | go | func tryParseMetricValue(aggName string, rawVal []interface{}, targetValue *core.MetricValue, fieldIndex int, wasInt map[string]bool) error {
// the Influx client decodes numeric fields to json.Number (a string), so we have to deal with that --
// assume, starting off, that values may be either float or int. Try int... | [
"func",
"tryParseMetricValue",
"(",
"aggName",
"string",
",",
"rawVal",
"[",
"]",
"interface",
"{",
"}",
",",
"targetValue",
"*",
"core",
".",
"MetricValue",
",",
"fieldIndex",
"int",
",",
"wasInt",
"map",
"[",
"string",
"]",
"bool",
")",
"error",
"{",
"... | // tryParseMetricValue attempts to parse a raw metric value into the appropriate go type. | [
"tryParseMetricValue",
"attempts",
"to",
"parse",
"a",
"raw",
"metric",
"value",
"into",
"the",
"appropriate",
"go",
"type",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/influxdb/influxdb_historical.go#L538-L567 |
22,121 | kubernetes-retired/heapster | metrics/sinks/influxdb/influxdb_historical.go | GetMetricNames | func (sink *influxdbSink) GetMetricNames(metricKey core.HistoricalKey) ([]string, error) {
if err := sink.checkSanitizedKey(&metricKey); err != nil {
return nil, err
}
return sink.stringListQuery(fmt.Sprintf("SHOW MEASUREMENTS WHERE %s", sink.keyToSelector(metricKey)), "Unable to list available metrics")
} | go | func (sink *influxdbSink) GetMetricNames(metricKey core.HistoricalKey) ([]string, error) {
if err := sink.checkSanitizedKey(&metricKey); err != nil {
return nil, err
}
return sink.stringListQuery(fmt.Sprintf("SHOW MEASUREMENTS WHERE %s", sink.keyToSelector(metricKey)), "Unable to list available metrics")
} | [
"func",
"(",
"sink",
"*",
"influxdbSink",
")",
"GetMetricNames",
"(",
"metricKey",
"core",
".",
"HistoricalKey",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"if",
"err",
":=",
"sink",
".",
"checkSanitizedKey",
"(",
"&",
"metricKey",
")",
";",
... | // GetMetricNames retrieves the available metric names for the given object | [
"GetMetricNames",
"retrieves",
"the",
"available",
"metric",
"names",
"for",
"the",
"given",
"object"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/influxdb/influxdb_historical.go#L570-L575 |
22,122 | kubernetes-retired/heapster | metrics/sinks/influxdb/influxdb_historical.go | GetNodes | func (sink *influxdbSink) GetNodes() ([]string, error) {
return sink.stringListQuery(fmt.Sprintf("SHOW TAG VALUES WITH KEY = %s", core.LabelNodename.Key), "Unable to list all nodes")
} | go | func (sink *influxdbSink) GetNodes() ([]string, error) {
return sink.stringListQuery(fmt.Sprintf("SHOW TAG VALUES WITH KEY = %s", core.LabelNodename.Key), "Unable to list all nodes")
} | [
"func",
"(",
"sink",
"*",
"influxdbSink",
")",
"GetNodes",
"(",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"return",
"sink",
".",
"stringListQuery",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"core",
".",
"LabelNodename",
".",
"Key"... | // GetNodes retrieves the list of nodes in the cluster | [
"GetNodes",
"retrieves",
"the",
"list",
"of",
"nodes",
"in",
"the",
"cluster"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/influxdb/influxdb_historical.go#L578-L580 |
22,123 | kubernetes-retired/heapster | metrics/sinks/influxdb/influxdb_historical.go | GetNamespaces | func (sink *influxdbSink) GetNamespaces() ([]string, error) {
return sink.stringListQuery(fmt.Sprintf("SHOW TAG VALUES WITH KEY = %s", core.LabelNamespaceName.Key), "Unable to list all namespaces")
} | go | func (sink *influxdbSink) GetNamespaces() ([]string, error) {
return sink.stringListQuery(fmt.Sprintf("SHOW TAG VALUES WITH KEY = %s", core.LabelNamespaceName.Key), "Unable to list all namespaces")
} | [
"func",
"(",
"sink",
"*",
"influxdbSink",
")",
"GetNamespaces",
"(",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"return",
"sink",
".",
"stringListQuery",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"core",
".",
"LabelNamespaceName",
".... | // GetNamespaces retrieves the list of namespaces in the cluster | [
"GetNamespaces",
"retrieves",
"the",
"list",
"of",
"namespaces",
"in",
"the",
"cluster"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/influxdb/influxdb_historical.go#L583-L585 |
22,124 | kubernetes-retired/heapster | metrics/sinks/influxdb/influxdb_historical.go | GetPodsFromNamespace | func (sink *influxdbSink) GetPodsFromNamespace(namespace string) ([]string, error) {
if !nameAllowedChars.MatchString(namespace) {
return nil, fmt.Errorf("Invalid namespace name %q", namespace)
}
// This is a bit difficult for the influx query language, so we cheat a bit here --
// we just get all series for the ... | go | func (sink *influxdbSink) GetPodsFromNamespace(namespace string) ([]string, error) {
if !nameAllowedChars.MatchString(namespace) {
return nil, fmt.Errorf("Invalid namespace name %q", namespace)
}
// This is a bit difficult for the influx query language, so we cheat a bit here --
// we just get all series for the ... | [
"func",
"(",
"sink",
"*",
"influxdbSink",
")",
"GetPodsFromNamespace",
"(",
"namespace",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"if",
"!",
"nameAllowedChars",
".",
"MatchString",
"(",
"namespace",
")",
"{",
"return",
"nil",
",",
... | // GetPodsFromNamespace retrieves the list of pods in a given namespace | [
"GetPodsFromNamespace",
"retrieves",
"the",
"list",
"of",
"pods",
"in",
"a",
"given",
"namespace"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/influxdb/influxdb_historical.go#L588-L597 |
22,125 | kubernetes-retired/heapster | metrics/sinks/influxdb/influxdb_historical.go | GetSystemContainersFromNode | func (sink *influxdbSink) GetSystemContainersFromNode(node string) ([]string, error) {
if !nameAllowedChars.MatchString(node) {
return nil, fmt.Errorf("Invalid node name %q", node)
}
// This is a bit difficult for the influx query language, so we cheat a bit here --
// we just get all series for the uptime measur... | go | func (sink *influxdbSink) GetSystemContainersFromNode(node string) ([]string, error) {
if !nameAllowedChars.MatchString(node) {
return nil, fmt.Errorf("Invalid node name %q", node)
}
// This is a bit difficult for the influx query language, so we cheat a bit here --
// we just get all series for the uptime measur... | [
"func",
"(",
"sink",
"*",
"influxdbSink",
")",
"GetSystemContainersFromNode",
"(",
"node",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"if",
"!",
"nameAllowedChars",
".",
"MatchString",
"(",
"node",
")",
"{",
"return",
"nil",
",",
"fm... | // GetSystemContainersFromNode retrieves the list of free containers for a given node | [
"GetSystemContainersFromNode",
"retrieves",
"the",
"list",
"of",
"free",
"containers",
"for",
"a",
"given",
"node"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/influxdb/influxdb_historical.go#L600-L609 |
22,126 | kubernetes-retired/heapster | metrics/sinks/influxdb/influxdb_historical.go | stringListQueryCol | func (sink *influxdbSink) stringListQueryCol(q, colName string, errStr string) ([]string, error) {
sink.RLock()
defer sink.RUnlock()
resp, err := sink.runQuery(q)
if err != nil {
return nil, fmt.Errorf(errStr)
}
if len(resp[0].Series) < 1 {
return nil, fmt.Errorf(errStr)
}
colInd := -1
for i, col := ran... | go | func (sink *influxdbSink) stringListQueryCol(q, colName string, errStr string) ([]string, error) {
sink.RLock()
defer sink.RUnlock()
resp, err := sink.runQuery(q)
if err != nil {
return nil, fmt.Errorf(errStr)
}
if len(resp[0].Series) < 1 {
return nil, fmt.Errorf(errStr)
}
colInd := -1
for i, col := ran... | [
"func",
"(",
"sink",
"*",
"influxdbSink",
")",
"stringListQueryCol",
"(",
"q",
",",
"colName",
"string",
",",
"errStr",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"sink",
".",
"RLock",
"(",
")",
"\n",
"defer",
"sink",
".",
"RUnlo... | // stringListQueryCol runs the given query, and returns all results from the given column as a string list | [
"stringListQueryCol",
"runs",
"the",
"given",
"query",
"and",
"returns",
"all",
"results",
"from",
"the",
"given",
"column",
"as",
"a",
"string",
"list"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/influxdb/influxdb_historical.go#L612-L643 |
22,127 | kubernetes-retired/heapster | metrics/sinks/influxdb/influxdb_historical.go | stringListQuery | func (sink *influxdbSink) stringListQuery(q string, errStr string) ([]string, error) {
sink.RLock()
defer sink.RUnlock()
resp, err := sink.runQuery(q)
if err != nil {
return nil, fmt.Errorf(errStr)
}
if len(resp[0].Series) < 1 {
return nil, fmt.Errorf(errStr)
}
res := make([]string, len(resp[0].Series[0]... | go | func (sink *influxdbSink) stringListQuery(q string, errStr string) ([]string, error) {
sink.RLock()
defer sink.RUnlock()
resp, err := sink.runQuery(q)
if err != nil {
return nil, fmt.Errorf(errStr)
}
if len(resp[0].Series) < 1 {
return nil, fmt.Errorf(errStr)
}
res := make([]string, len(resp[0].Series[0]... | [
"func",
"(",
"sink",
"*",
"influxdbSink",
")",
"stringListQuery",
"(",
"q",
"string",
",",
"errStr",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"sink",
".",
"RLock",
"(",
")",
"\n",
"defer",
"sink",
".",
"RUnlock",
"(",
")",
"\... | // stringListQuery runs the given query, and returns all results from the first column as a string list | [
"stringListQuery",
"runs",
"the",
"given",
"query",
"and",
"returns",
"all",
"results",
"from",
"the",
"first",
"column",
"as",
"a",
"string",
"list"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/influxdb/influxdb_historical.go#L646-L664 |
22,128 | kubernetes-retired/heapster | metrics/sinks/influxdb/influxdb_historical.go | populateAggregations | func populateAggregations(rawRowName string, rawVal []interface{}, val *core.TimestampedAggregationValue, aggregationLookup map[core.AggregationType]int, wasInt map[string]bool) error {
for _, aggregation := range core.MultiTypedAggregations {
if err := setAggregationValueIfPresent(aggregation, rawVal, &val.Aggregat... | go | func populateAggregations(rawRowName string, rawVal []interface{}, val *core.TimestampedAggregationValue, aggregationLookup map[core.AggregationType]int, wasInt map[string]bool) error {
for _, aggregation := range core.MultiTypedAggregations {
if err := setAggregationValueIfPresent(aggregation, rawVal, &val.Aggregat... | [
"func",
"populateAggregations",
"(",
"rawRowName",
"string",
",",
"rawVal",
"[",
"]",
"interface",
"{",
"}",
",",
"val",
"*",
"core",
".",
"TimestampedAggregationValue",
",",
"aggregationLookup",
"map",
"[",
"core",
".",
"AggregationType",
"]",
"int",
",",
"wa... | // populateAggregations extracts aggregation values from a given data point | [
"populateAggregations",
"extracts",
"aggregation",
"values",
"from",
"a",
"given",
"data",
"point"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/influxdb/influxdb_historical.go#L700-L709 |
22,129 | kubernetes-retired/heapster | metrics/sinks/influxdb/influxdb_historical.go | setAggregationValueTypes | func setAggregationValueTypes(vals []core.TimestampedAggregationValue, wasInt map[string]bool) {
for _, aggregation := range core.MultiTypedAggregations {
if isInt, ok := wasInt[string(aggregation)]; ok && isInt {
for i := range vals {
val := vals[i].Aggregations[aggregation]
val.ValueType = core.ValueInt... | go | func setAggregationValueTypes(vals []core.TimestampedAggregationValue, wasInt map[string]bool) {
for _, aggregation := range core.MultiTypedAggregations {
if isInt, ok := wasInt[string(aggregation)]; ok && isInt {
for i := range vals {
val := vals[i].Aggregations[aggregation]
val.ValueType = core.ValueInt... | [
"func",
"setAggregationValueTypes",
"(",
"vals",
"[",
"]",
"core",
".",
"TimestampedAggregationValue",
",",
"wasInt",
"map",
"[",
"string",
"]",
"bool",
")",
"{",
"for",
"_",
",",
"aggregation",
":=",
"range",
"core",
".",
"MultiTypedAggregations",
"{",
"if",
... | // setAggregationValueTypes inspects a set of aggregation values and figures out whether each aggregation value
// returned as a float column, or an int column | [
"setAggregationValueTypes",
"inspects",
"a",
"set",
"of",
"aggregation",
"values",
"and",
"figures",
"out",
"whether",
"each",
"aggregation",
"value",
"returned",
"as",
"a",
"float",
"column",
"or",
"an",
"int",
"column"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/influxdb/influxdb_historical.go#L713-L729 |
22,130 | kubernetes-retired/heapster | metrics/sinks/gcm/gcm.go | register | func (sink *gcmSink) register(metrics []core.Metric) error {
sink.Lock()
defer sink.Unlock()
if sink.registered {
return nil
}
for _, metric := range metrics {
metricName := fullMetricName(sink.project, metric.MetricDescriptor.Name)
metricType := fullMetricType(metric.MetricDescriptor.Name)
if _, err := ... | go | func (sink *gcmSink) register(metrics []core.Metric) error {
sink.Lock()
defer sink.Unlock()
if sink.registered {
return nil
}
for _, metric := range metrics {
metricName := fullMetricName(sink.project, metric.MetricDescriptor.Name)
metricType := fullMetricType(metric.MetricDescriptor.Name)
if _, err := ... | [
"func",
"(",
"sink",
"*",
"gcmSink",
")",
"register",
"(",
"metrics",
"[",
"]",
"core",
".",
"Metric",
")",
"error",
"{",
"sink",
".",
"Lock",
"(",
")",
"\n",
"defer",
"sink",
".",
"Unlock",
"(",
")",
"\n",
"if",
"sink",
".",
"registered",
"{",
"... | // Adds the specified metrics or updates them if they already exist. | [
"Adds",
"the",
"specified",
"metrics",
"or",
"updates",
"them",
"if",
"they",
"already",
"exist",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/gcm/gcm.go#L217-L297 |
22,131 | kubernetes-retired/heapster | metrics/sinks/manager.go | ExportData | func (this *sinkManager) ExportData(data *core.DataBatch) {
var wg sync.WaitGroup
for _, sh := range this.sinkHolders {
wg.Add(1)
go func(sh sinkHolder, wg *sync.WaitGroup) {
defer wg.Done()
glog.V(2).Infof("Pushing data to: %s", sh.sink.Name())
select {
case sh.dataBatchChannel <- data:
glog.V(2)... | go | func (this *sinkManager) ExportData(data *core.DataBatch) {
var wg sync.WaitGroup
for _, sh := range this.sinkHolders {
wg.Add(1)
go func(sh sinkHolder, wg *sync.WaitGroup) {
defer wg.Done()
glog.V(2).Infof("Pushing data to: %s", sh.sink.Name())
select {
case sh.dataBatchChannel <- data:
glog.V(2)... | [
"func",
"(",
"this",
"*",
"sinkManager",
")",
"ExportData",
"(",
"data",
"*",
"core",
".",
"DataBatch",
")",
"{",
"var",
"wg",
"sync",
".",
"WaitGroup",
"\n",
"for",
"_",
",",
"sh",
":=",
"range",
"this",
".",
"sinkHolders",
"{",
"wg",
".",
"Add",
... | // Guarantees that the export will complete in sinkExportDataTimeout. | [
"Guarantees",
"that",
"the",
"export",
"will",
"complete",
"in",
"sinkExportDataTimeout",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/manager.go#L106-L124 |
22,132 | kubernetes-retired/heapster | metrics/sources/kubelet/kubelet_client.go | GetAllRawContainers | func (self *KubeletClient) GetAllRawContainers(host Host, start, end time.Time) ([]cadvisor.ContainerInfo, error) {
url := self.getUrl(host, "/stats/container/")
return self.getAllContainers(url, start, end)
} | go | func (self *KubeletClient) GetAllRawContainers(host Host, start, end time.Time) ([]cadvisor.ContainerInfo, error) {
url := self.getUrl(host, "/stats/container/")
return self.getAllContainers(url, start, end)
} | [
"func",
"(",
"self",
"*",
"KubeletClient",
")",
"GetAllRawContainers",
"(",
"host",
"Host",
",",
"start",
",",
"end",
"time",
".",
"Time",
")",
"(",
"[",
"]",
"cadvisor",
".",
"ContainerInfo",
",",
"error",
")",
"{",
"url",
":=",
"self",
".",
"getUrl",... | // Get stats for all non-Kubernetes containers. | [
"Get",
"stats",
"for",
"all",
"non",
"-",
"Kubernetes",
"containers",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sources/kubelet/kubelet_client.go#L152-L156 |
22,133 | kubernetes-retired/heapster | metrics/util/metrics/http.go | InstrumentRouteFunc | func InstrumentRouteFunc(handlerName string, routeFunc restful.RouteFunction) restful.RouteFunction {
opts := prometheus.SummaryOpts{
Subsystem: "http",
ConstLabels: prometheus.Labels{"handler": handlerName},
}
reqCnt := prometheus.NewCounterVec(
prometheus.CounterOpts{
Subsystem: opts.Subsystem,
Na... | go | func InstrumentRouteFunc(handlerName string, routeFunc restful.RouteFunction) restful.RouteFunction {
opts := prometheus.SummaryOpts{
Subsystem: "http",
ConstLabels: prometheus.Labels{"handler": handlerName},
}
reqCnt := prometheus.NewCounterVec(
prometheus.CounterOpts{
Subsystem: opts.Subsystem,
Na... | [
"func",
"InstrumentRouteFunc",
"(",
"handlerName",
"string",
",",
"routeFunc",
"restful",
".",
"RouteFunction",
")",
"restful",
".",
"RouteFunction",
"{",
"opts",
":=",
"prometheus",
".",
"SummaryOpts",
"{",
"Subsystem",
":",
"\"",
"\"",
",",
"ConstLabels",
":",... | // InstrumentRouteFunc works like Prometheus' InstrumentHandlerFunc but wraps
// the go-restful RouteFunction instead of a HandlerFunc | [
"InstrumentRouteFunc",
"works",
"like",
"Prometheus",
"InstrumentHandlerFunc",
"but",
"wraps",
"the",
"go",
"-",
"restful",
"RouteFunction",
"instead",
"of",
"a",
"HandlerFunc"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/util/metrics/http.go#L36-L103 |
22,134 | kubernetes-retired/heapster | metrics/core/ms_keys.go | PodContainerKey | func PodContainerKey(namespace, podName, containerName string) string {
return fmt.Sprintf("namespace:%s/pod:%s/container:%s", namespace, podName, containerName)
} | go | func PodContainerKey(namespace, podName, containerName string) string {
return fmt.Sprintf("namespace:%s/pod:%s/container:%s", namespace, podName, containerName)
} | [
"func",
"PodContainerKey",
"(",
"namespace",
",",
"podName",
",",
"containerName",
"string",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"namespace",
",",
"podName",
",",
"containerName",
")",
"\n",
"}"
] | // MetricsSet keys are inside of DataBatch. The structure of the returned string is
// an implementation detail and no component should rely on it as it may change
// anytime. It only guaranteed that it is unique for the unique combination of
// passed parameters. | [
"MetricsSet",
"keys",
"are",
"inside",
"of",
"DataBatch",
".",
"The",
"structure",
"of",
"the",
"returned",
"string",
"is",
"an",
"implementation",
"detail",
"and",
"no",
"component",
"should",
"rely",
"on",
"it",
"as",
"it",
"may",
"change",
"anytime",
".",... | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/core/ms_keys.go#L26-L28 |
22,135 | kubernetes-retired/heapster | metrics/processors/namespace_based_enricher.go | addNamespaceInfo | func (this *NamespaceBasedEnricher) addNamespaceInfo(metricSet *core.MetricSet) {
metricSetType, found := metricSet.Labels[core.LabelMetricSetType.Key]
if !found {
return
}
if metricSetType != core.MetricSetTypePodContainer &&
metricSetType != core.MetricSetTypePod &&
metricSetType != core.MetricSetTypeNamesp... | go | func (this *NamespaceBasedEnricher) addNamespaceInfo(metricSet *core.MetricSet) {
metricSetType, found := metricSet.Labels[core.LabelMetricSetType.Key]
if !found {
return
}
if metricSetType != core.MetricSetTypePodContainer &&
metricSetType != core.MetricSetTypePod &&
metricSetType != core.MetricSetTypeNamesp... | [
"func",
"(",
"this",
"*",
"NamespaceBasedEnricher",
")",
"addNamespaceInfo",
"(",
"metricSet",
"*",
"core",
".",
"MetricSet",
")",
"{",
"metricSetType",
",",
"found",
":=",
"metricSet",
".",
"Labels",
"[",
"core",
".",
"LabelMetricSetType",
".",
"Key",
"]",
... | // Adds UID to all namespaced elements. | [
"Adds",
"UID",
"to",
"all",
"namespaced",
"elements",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/processors/namespace_based_enricher.go#L49-L78 |
22,136 | kubernetes-retired/heapster | metrics/api/v1/model_handlers.go | availableClusterMetrics | func (a *Api) availableClusterMetrics(request *restful.Request, response *restful.Response) {
a.processMetricNamesRequest(core.ClusterKey(), response)
} | go | func (a *Api) availableClusterMetrics(request *restful.Request, response *restful.Response) {
a.processMetricNamesRequest(core.ClusterKey(), response)
} | [
"func",
"(",
"a",
"*",
"Api",
")",
"availableClusterMetrics",
"(",
"request",
"*",
"restful",
".",
"Request",
",",
"response",
"*",
"restful",
".",
"Response",
")",
"{",
"a",
".",
"processMetricNamesRequest",
"(",
"core",
".",
"ClusterKey",
"(",
")",
",",
... | // availableMetrics returns a list of available cluster metric names. | [
"availableMetrics",
"returns",
"a",
"list",
"of",
"available",
"cluster",
"metric",
"names",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/model_handlers.go#L283-L285 |
22,137 | kubernetes-retired/heapster | metrics/api/v1/model_handlers.go | availableNodeMetrics | func (a *Api) availableNodeMetrics(request *restful.Request, response *restful.Response) {
a.processMetricNamesRequest(core.NodeKey(request.PathParameter("node-name")), response)
} | go | func (a *Api) availableNodeMetrics(request *restful.Request, response *restful.Response) {
a.processMetricNamesRequest(core.NodeKey(request.PathParameter("node-name")), response)
} | [
"func",
"(",
"a",
"*",
"Api",
")",
"availableNodeMetrics",
"(",
"request",
"*",
"restful",
".",
"Request",
",",
"response",
"*",
"restful",
".",
"Response",
")",
"{",
"a",
".",
"processMetricNamesRequest",
"(",
"core",
".",
"NodeKey",
"(",
"request",
".",
... | // availableMetrics returns a list of available node metric names. | [
"availableMetrics",
"returns",
"a",
"list",
"of",
"available",
"node",
"metric",
"names",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/model_handlers.go#L288-L290 |
22,138 | kubernetes-retired/heapster | metrics/api/v1/model_handlers.go | availableNamespaceMetrics | func (a *Api) availableNamespaceMetrics(request *restful.Request, response *restful.Response) {
a.processMetricNamesRequest(core.NamespaceKey(request.PathParameter("namespace-name")), response)
} | go | func (a *Api) availableNamespaceMetrics(request *restful.Request, response *restful.Response) {
a.processMetricNamesRequest(core.NamespaceKey(request.PathParameter("namespace-name")), response)
} | [
"func",
"(",
"a",
"*",
"Api",
")",
"availableNamespaceMetrics",
"(",
"request",
"*",
"restful",
".",
"Request",
",",
"response",
"*",
"restful",
".",
"Response",
")",
"{",
"a",
".",
"processMetricNamesRequest",
"(",
"core",
".",
"NamespaceKey",
"(",
"request... | // availableMetrics returns a list of available namespace metric names. | [
"availableMetrics",
"returns",
"a",
"list",
"of",
"available",
"namespace",
"metric",
"names",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/model_handlers.go#L293-L295 |
22,139 | kubernetes-retired/heapster | metrics/api/v1/model_handlers.go | parseTimeParam | func parseTimeParam(queryParam string, defaultValue time.Time) (time.Time, error) {
if queryParam != "" {
reqStamp, err := time.Parse(time.RFC3339, queryParam)
if err != nil {
return time.Time{}, fmt.Errorf("timestamp argument cannot be parsed: %s", err)
}
return reqStamp, nil
}
return defaultValue, nil
} | go | func parseTimeParam(queryParam string, defaultValue time.Time) (time.Time, error) {
if queryParam != "" {
reqStamp, err := time.Parse(time.RFC3339, queryParam)
if err != nil {
return time.Time{}, fmt.Errorf("timestamp argument cannot be parsed: %s", err)
}
return reqStamp, nil
}
return defaultValue, nil
} | [
"func",
"parseTimeParam",
"(",
"queryParam",
"string",
",",
"defaultValue",
"time",
".",
"Time",
")",
"(",
"time",
".",
"Time",
",",
"error",
")",
"{",
"if",
"queryParam",
"!=",
"\"",
"\"",
"{",
"reqStamp",
",",
"err",
":=",
"time",
".",
"Parse",
"(",
... | // parseRequestParam parses a time.Time from a named QueryParam, using the RFC3339 format. | [
"parseRequestParam",
"parses",
"a",
"time",
".",
"Time",
"from",
"a",
"named",
"QueryParam",
"using",
"the",
"RFC3339",
"format",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/model_handlers.go#L429-L438 |
22,140 | kubernetes-retired/heapster | metrics/sinks/riemann/driver.go | appendEvent | func appendEvent(events []riemanngo.Event, sink *RiemannSink, host, name string, value interface{}, labels map[string]string, timestamp int64) []riemanngo.Event {
event := riemanngo.Event{
Time: timestamp,
Service: name,
Host: host,
Description: "",
Attributes: labels,
Metric: value... | go | func appendEvent(events []riemanngo.Event, sink *RiemannSink, host, name string, value interface{}, labels map[string]string, timestamp int64) []riemanngo.Event {
event := riemanngo.Event{
Time: timestamp,
Service: name,
Host: host,
Description: "",
Attributes: labels,
Metric: value... | [
"func",
"appendEvent",
"(",
"events",
"[",
"]",
"riemanngo",
".",
"Event",
",",
"sink",
"*",
"RiemannSink",
",",
"host",
",",
"name",
"string",
",",
"value",
"interface",
"{",
"}",
",",
"labels",
"map",
"[",
"string",
"]",
"string",
",",
"timestamp",
"... | // Receives a list of riemanngo.Event, the sink, and parameters.
// Creates a new event using the parameters and the sink config, and add it into the Event list.
// Can send events if events is full
// Return the list. | [
"Receives",
"a",
"list",
"of",
"riemanngo",
".",
"Event",
"the",
"sink",
"and",
"parameters",
".",
"Creates",
"a",
"new",
"event",
"using",
"the",
"parameters",
"and",
"the",
"sink",
"config",
"and",
"add",
"it",
"into",
"the",
"Event",
"list",
".",
"Can... | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/riemann/driver.go#L61-L85 |
22,141 | kubernetes-retired/heapster | metrics/sinks/riemann/driver.go | ExportData | func (sink *RiemannSink) ExportData(dataBatch *core.DataBatch) {
sink.Lock()
defer sink.Unlock()
if sink.client == nil {
// the client could be nil here, so we reconnect
client, err := riemannCommon.GetRiemannClient(sink.config)
if err != nil {
glog.Warningf("Riemann sink not connected: %v", err)
return... | go | func (sink *RiemannSink) ExportData(dataBatch *core.DataBatch) {
sink.Lock()
defer sink.Unlock()
if sink.client == nil {
// the client could be nil here, so we reconnect
client, err := riemannCommon.GetRiemannClient(sink.config)
if err != nil {
glog.Warningf("Riemann sink not connected: %v", err)
return... | [
"func",
"(",
"sink",
"*",
"RiemannSink",
")",
"ExportData",
"(",
"dataBatch",
"*",
"core",
".",
"DataBatch",
")",
"{",
"sink",
".",
"Lock",
"(",
")",
"\n",
"defer",
"sink",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"sink",
".",
"client",
"==",
"nil",
... | // ExportData Send a collection of Timeseries to Riemann | [
"ExportData",
"Send",
"a",
"collection",
"of",
"Timeseries",
"to",
"Riemann"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/riemann/driver.go#L88-L137 |
22,142 | kubernetes-retired/heapster | metrics/api/v1/historical_handlers.go | availableClusterMetrics | func (a *HistoricalApi) availableClusterMetrics(request *restful.Request, response *restful.Response) {
key := core.HistoricalKey{ObjectType: core.MetricSetTypeCluster}
a.processMetricNamesRequest(key, response)
} | go | func (a *HistoricalApi) availableClusterMetrics(request *restful.Request, response *restful.Response) {
key := core.HistoricalKey{ObjectType: core.MetricSetTypeCluster}
a.processMetricNamesRequest(key, response)
} | [
"func",
"(",
"a",
"*",
"HistoricalApi",
")",
"availableClusterMetrics",
"(",
"request",
"*",
"restful",
".",
"Request",
",",
"response",
"*",
"restful",
".",
"Response",
")",
"{",
"key",
":=",
"core",
".",
"HistoricalKey",
"{",
"ObjectType",
":",
"core",
"... | // availableClusterMetrics returns a list of available cluster metric names. | [
"availableClusterMetrics",
"returns",
"a",
"list",
"of",
"available",
"cluster",
"metric",
"names",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/historical_handlers.go#L259-L262 |
22,143 | kubernetes-retired/heapster | metrics/api/v1/historical_handlers.go | availableNodeMetrics | func (a *HistoricalApi) availableNodeMetrics(request *restful.Request, response *restful.Response) {
key := core.HistoricalKey{
ObjectType: core.MetricSetTypeNode,
NodeName: request.PathParameter("node-name"),
}
a.processMetricNamesRequest(key, response)
} | go | func (a *HistoricalApi) availableNodeMetrics(request *restful.Request, response *restful.Response) {
key := core.HistoricalKey{
ObjectType: core.MetricSetTypeNode,
NodeName: request.PathParameter("node-name"),
}
a.processMetricNamesRequest(key, response)
} | [
"func",
"(",
"a",
"*",
"HistoricalApi",
")",
"availableNodeMetrics",
"(",
"request",
"*",
"restful",
".",
"Request",
",",
"response",
"*",
"restful",
".",
"Response",
")",
"{",
"key",
":=",
"core",
".",
"HistoricalKey",
"{",
"ObjectType",
":",
"core",
".",... | // availableNodeMetrics returns a list of available node metric names. | [
"availableNodeMetrics",
"returns",
"a",
"list",
"of",
"available",
"node",
"metric",
"names",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/historical_handlers.go#L265-L271 |
22,144 | kubernetes-retired/heapster | metrics/api/v1/historical_handlers.go | availableNamespaceMetrics | func (a *HistoricalApi) availableNamespaceMetrics(request *restful.Request, response *restful.Response) {
key := core.HistoricalKey{
ObjectType: core.MetricSetTypeNamespace,
NamespaceName: request.PathParameter("namespace-name"),
}
a.processMetricNamesRequest(key, response)
} | go | func (a *HistoricalApi) availableNamespaceMetrics(request *restful.Request, response *restful.Response) {
key := core.HistoricalKey{
ObjectType: core.MetricSetTypeNamespace,
NamespaceName: request.PathParameter("namespace-name"),
}
a.processMetricNamesRequest(key, response)
} | [
"func",
"(",
"a",
"*",
"HistoricalApi",
")",
"availableNamespaceMetrics",
"(",
"request",
"*",
"restful",
".",
"Request",
",",
"response",
"*",
"restful",
".",
"Response",
")",
"{",
"key",
":=",
"core",
".",
"HistoricalKey",
"{",
"ObjectType",
":",
"core",
... | // availableNamespaceMetrics returns a list of available namespace metric names. | [
"availableNamespaceMetrics",
"returns",
"a",
"list",
"of",
"available",
"namespace",
"metric",
"names",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/historical_handlers.go#L274-L280 |
22,145 | kubernetes-retired/heapster | metrics/api/v1/historical_handlers.go | availablePodMetrics | func (a *HistoricalApi) availablePodMetrics(request *restful.Request, response *restful.Response) {
key := core.HistoricalKey{
ObjectType: core.MetricSetTypePod,
NamespaceName: request.PathParameter("namespace-name"),
PodName: request.PathParameter("pod-name"),
}
a.processMetricNamesRequest(key, respo... | go | func (a *HistoricalApi) availablePodMetrics(request *restful.Request, response *restful.Response) {
key := core.HistoricalKey{
ObjectType: core.MetricSetTypePod,
NamespaceName: request.PathParameter("namespace-name"),
PodName: request.PathParameter("pod-name"),
}
a.processMetricNamesRequest(key, respo... | [
"func",
"(",
"a",
"*",
"HistoricalApi",
")",
"availablePodMetrics",
"(",
"request",
"*",
"restful",
".",
"Request",
",",
"response",
"*",
"restful",
".",
"Response",
")",
"{",
"key",
":=",
"core",
".",
"HistoricalKey",
"{",
"ObjectType",
":",
"core",
".",
... | // availablePodMetrics returns a list of available pod metric names. | [
"availablePodMetrics",
"returns",
"a",
"list",
"of",
"available",
"pod",
"metric",
"names",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/historical_handlers.go#L283-L290 |
22,146 | kubernetes-retired/heapster | metrics/api/v1/historical_handlers.go | availablePodContainerMetrics | func (a *HistoricalApi) availablePodContainerMetrics(request *restful.Request, response *restful.Response) {
key := core.HistoricalKey{
ObjectType: core.MetricSetTypePodContainer,
NamespaceName: request.PathParameter("namespace-name"),
PodName: request.PathParameter("pod-name"),
ContainerName: request... | go | func (a *HistoricalApi) availablePodContainerMetrics(request *restful.Request, response *restful.Response) {
key := core.HistoricalKey{
ObjectType: core.MetricSetTypePodContainer,
NamespaceName: request.PathParameter("namespace-name"),
PodName: request.PathParameter("pod-name"),
ContainerName: request... | [
"func",
"(",
"a",
"*",
"HistoricalApi",
")",
"availablePodContainerMetrics",
"(",
"request",
"*",
"restful",
".",
"Request",
",",
"response",
"*",
"restful",
".",
"Response",
")",
"{",
"key",
":=",
"core",
".",
"HistoricalKey",
"{",
"ObjectType",
":",
"core"... | // availablePodContainerMetrics returns a list of available pod container metric names. | [
"availablePodContainerMetrics",
"returns",
"a",
"list",
"of",
"available",
"pod",
"container",
"metric",
"names",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/historical_handlers.go#L293-L301 |
22,147 | kubernetes-retired/heapster | metrics/api/v1/historical_handlers.go | availableFreeContainerMetrics | func (a *HistoricalApi) availableFreeContainerMetrics(request *restful.Request, response *restful.Response) {
key := core.HistoricalKey{
ObjectType: core.MetricSetTypeSystemContainer,
NodeName: request.PathParameter("node-name"),
ContainerName: request.PathParameter("container-name"),
}
a.processMetric... | go | func (a *HistoricalApi) availableFreeContainerMetrics(request *restful.Request, response *restful.Response) {
key := core.HistoricalKey{
ObjectType: core.MetricSetTypeSystemContainer,
NodeName: request.PathParameter("node-name"),
ContainerName: request.PathParameter("container-name"),
}
a.processMetric... | [
"func",
"(",
"a",
"*",
"HistoricalApi",
")",
"availableFreeContainerMetrics",
"(",
"request",
"*",
"restful",
".",
"Request",
",",
"response",
"*",
"restful",
".",
"Response",
")",
"{",
"key",
":=",
"core",
".",
"HistoricalKey",
"{",
"ObjectType",
":",
"core... | // availableFreeContainerMetrics returns a list of available pod metric names. | [
"availableFreeContainerMetrics",
"returns",
"a",
"list",
"of",
"available",
"pod",
"metric",
"names",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/historical_handlers.go#L304-L311 |
22,148 | kubernetes-retired/heapster | metrics/api/v1/historical_handlers.go | nodeList | func (a *HistoricalApi) nodeList(request *restful.Request, response *restful.Response) {
if resp, err := a.historicalSource.GetNodes(); err != nil {
response.WriteError(http.StatusInternalServerError, err)
} else {
response.WriteEntity(resp)
}
} | go | func (a *HistoricalApi) nodeList(request *restful.Request, response *restful.Response) {
if resp, err := a.historicalSource.GetNodes(); err != nil {
response.WriteError(http.StatusInternalServerError, err)
} else {
response.WriteEntity(resp)
}
} | [
"func",
"(",
"a",
"*",
"HistoricalApi",
")",
"nodeList",
"(",
"request",
"*",
"restful",
".",
"Request",
",",
"response",
"*",
"restful",
".",
"Response",
")",
"{",
"if",
"resp",
",",
"err",
":=",
"a",
".",
"historicalSource",
".",
"GetNodes",
"(",
")"... | // nodeList lists all nodes for which we have metrics | [
"nodeList",
"lists",
"all",
"nodes",
"for",
"which",
"we",
"have",
"metrics"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/historical_handlers.go#L314-L320 |
22,149 | kubernetes-retired/heapster | metrics/api/v1/historical_handlers.go | namespaceList | func (a *HistoricalApi) namespaceList(request *restful.Request, response *restful.Response) {
if resp, err := a.historicalSource.GetNamespaces(); err != nil {
response.WriteError(http.StatusInternalServerError, err)
} else {
response.WriteEntity(resp)
}
} | go | func (a *HistoricalApi) namespaceList(request *restful.Request, response *restful.Response) {
if resp, err := a.historicalSource.GetNamespaces(); err != nil {
response.WriteError(http.StatusInternalServerError, err)
} else {
response.WriteEntity(resp)
}
} | [
"func",
"(",
"a",
"*",
"HistoricalApi",
")",
"namespaceList",
"(",
"request",
"*",
"restful",
".",
"Request",
",",
"response",
"*",
"restful",
".",
"Response",
")",
"{",
"if",
"resp",
",",
"err",
":=",
"a",
".",
"historicalSource",
".",
"GetNamespaces",
... | // namespaceList lists all namespaces for which we have metrics | [
"namespaceList",
"lists",
"all",
"namespaces",
"for",
"which",
"we",
"have",
"metrics"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/historical_handlers.go#L323-L329 |
22,150 | kubernetes-retired/heapster | metrics/api/v1/historical_handlers.go | namespacePodList | func (a *HistoricalApi) namespacePodList(request *restful.Request, response *restful.Response) {
if resp, err := a.historicalSource.GetPodsFromNamespace(request.PathParameter("namespace-name")); err != nil {
response.WriteError(http.StatusInternalServerError, err)
} else {
response.WriteEntity(resp)
}
} | go | func (a *HistoricalApi) namespacePodList(request *restful.Request, response *restful.Response) {
if resp, err := a.historicalSource.GetPodsFromNamespace(request.PathParameter("namespace-name")); err != nil {
response.WriteError(http.StatusInternalServerError, err)
} else {
response.WriteEntity(resp)
}
} | [
"func",
"(",
"a",
"*",
"HistoricalApi",
")",
"namespacePodList",
"(",
"request",
"*",
"restful",
".",
"Request",
",",
"response",
"*",
"restful",
".",
"Response",
")",
"{",
"if",
"resp",
",",
"err",
":=",
"a",
".",
"historicalSource",
".",
"GetPodsFromName... | // namespacePodList lists all pods for which we have metrics in a particular namespace | [
"namespacePodList",
"lists",
"all",
"pods",
"for",
"which",
"we",
"have",
"metrics",
"in",
"a",
"particular",
"namespace"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/historical_handlers.go#L332-L338 |
22,151 | kubernetes-retired/heapster | metrics/api/v1/historical_handlers.go | freeContainerMetrics | func (a *HistoricalApi) freeContainerMetrics(request *restful.Request, response *restful.Response) {
key := core.HistoricalKey{
ObjectType: core.MetricSetTypeSystemContainer,
NodeName: request.PathParameter("node-name"),
ContainerName: request.PathParameter("container-name"),
}
a.processMetricRequest(k... | go | func (a *HistoricalApi) freeContainerMetrics(request *restful.Request, response *restful.Response) {
key := core.HistoricalKey{
ObjectType: core.MetricSetTypeSystemContainer,
NodeName: request.PathParameter("node-name"),
ContainerName: request.PathParameter("container-name"),
}
a.processMetricRequest(k... | [
"func",
"(",
"a",
"*",
"HistoricalApi",
")",
"freeContainerMetrics",
"(",
"request",
"*",
"restful",
".",
"Request",
",",
"response",
"*",
"restful",
".",
"Response",
")",
"{",
"key",
":=",
"core",
".",
"HistoricalKey",
"{",
"ObjectType",
":",
"core",
".",... | // freeContainerMetrics returns a metric timeseries for a metric of the Container entity.
// freeContainerMetrics addresses only free containers. | [
"freeContainerMetrics",
"returns",
"a",
"metric",
"timeseries",
"for",
"a",
"metric",
"of",
"the",
"Container",
"entity",
".",
"freeContainerMetrics",
"addresses",
"only",
"free",
"containers",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/historical_handlers.go#L393-L400 |
22,152 | kubernetes-retired/heapster | metrics/api/v1/historical_handlers.go | podListMetrics | func (a *HistoricalApi) podListMetrics(request *restful.Request, response *restful.Response) {
start, end, err := getStartEndTimeHistorical(request)
if err != nil {
response.WriteError(http.StatusBadRequest, err)
return
}
keys := []core.HistoricalKey{}
if request.PathParameter("pod-id-list") != "" {
for _, ... | go | func (a *HistoricalApi) podListMetrics(request *restful.Request, response *restful.Response) {
start, end, err := getStartEndTimeHistorical(request)
if err != nil {
response.WriteError(http.StatusBadRequest, err)
return
}
keys := []core.HistoricalKey{}
if request.PathParameter("pod-id-list") != "" {
for _, ... | [
"func",
"(",
"a",
"*",
"HistoricalApi",
")",
"podListMetrics",
"(",
"request",
"*",
"restful",
".",
"Request",
",",
"response",
"*",
"restful",
".",
"Response",
")",
"{",
"start",
",",
"end",
",",
"err",
":=",
"getStartEndTimeHistorical",
"(",
"request",
"... | // podListMetrics returns a list of metric timeseries for each for the listed nodes | [
"podListMetrics",
"returns",
"a",
"list",
"of",
"metric",
"timeseries",
"for",
"each",
"for",
"the",
"listed",
"nodes"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/historical_handlers.go#L403-L459 |
22,153 | kubernetes-retired/heapster | metrics/api/v1/historical_handlers.go | clusterAggregations | func (a *HistoricalApi) clusterAggregations(request *restful.Request, response *restful.Response) {
key := core.HistoricalKey{ObjectType: core.MetricSetTypeCluster}
a.processAggregationRequest(key, request, response)
} | go | func (a *HistoricalApi) clusterAggregations(request *restful.Request, response *restful.Response) {
key := core.HistoricalKey{ObjectType: core.MetricSetTypeCluster}
a.processAggregationRequest(key, request, response)
} | [
"func",
"(",
"a",
"*",
"HistoricalApi",
")",
"clusterAggregations",
"(",
"request",
"*",
"restful",
".",
"Request",
",",
"response",
"*",
"restful",
".",
"Response",
")",
"{",
"key",
":=",
"core",
".",
"HistoricalKey",
"{",
"ObjectType",
":",
"core",
".",
... | // clusterAggregations returns a metric timeseries for a metric of the Cluster entity. | [
"clusterAggregations",
"returns",
"a",
"metric",
"timeseries",
"for",
"a",
"metric",
"of",
"the",
"Cluster",
"entity",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/historical_handlers.go#L482-L485 |
22,154 | kubernetes-retired/heapster | metrics/api/v1/historical_handlers.go | nodeAggregations | func (a *HistoricalApi) nodeAggregations(request *restful.Request, response *restful.Response) {
key := core.HistoricalKey{
ObjectType: core.MetricSetTypeNode,
NodeName: request.PathParameter("node-name"),
}
a.processAggregationRequest(key, request, response)
} | go | func (a *HistoricalApi) nodeAggregations(request *restful.Request, response *restful.Response) {
key := core.HistoricalKey{
ObjectType: core.MetricSetTypeNode,
NodeName: request.PathParameter("node-name"),
}
a.processAggregationRequest(key, request, response)
} | [
"func",
"(",
"a",
"*",
"HistoricalApi",
")",
"nodeAggregations",
"(",
"request",
"*",
"restful",
".",
"Request",
",",
"response",
"*",
"restful",
".",
"Response",
")",
"{",
"key",
":=",
"core",
".",
"HistoricalKey",
"{",
"ObjectType",
":",
"core",
".",
"... | // nodeAggregations returns a metric timeseries for a metric of the Node entity. | [
"nodeAggregations",
"returns",
"a",
"metric",
"timeseries",
"for",
"a",
"metric",
"of",
"the",
"Node",
"entity",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/historical_handlers.go#L488-L494 |
22,155 | kubernetes-retired/heapster | metrics/api/v1/historical_handlers.go | namespaceAggregations | func (a *HistoricalApi) namespaceAggregations(request *restful.Request, response *restful.Response) {
key := core.HistoricalKey{
ObjectType: core.MetricSetTypeNamespace,
NamespaceName: request.PathParameter("namespace-name"),
}
a.processAggregationRequest(key, request, response)
} | go | func (a *HistoricalApi) namespaceAggregations(request *restful.Request, response *restful.Response) {
key := core.HistoricalKey{
ObjectType: core.MetricSetTypeNamespace,
NamespaceName: request.PathParameter("namespace-name"),
}
a.processAggregationRequest(key, request, response)
} | [
"func",
"(",
"a",
"*",
"HistoricalApi",
")",
"namespaceAggregations",
"(",
"request",
"*",
"restful",
".",
"Request",
",",
"response",
"*",
"restful",
".",
"Response",
")",
"{",
"key",
":=",
"core",
".",
"HistoricalKey",
"{",
"ObjectType",
":",
"core",
"."... | // namespaceAggregations returns a metric timeseries for a metric of the Namespace entity. | [
"namespaceAggregations",
"returns",
"a",
"metric",
"timeseries",
"for",
"a",
"metric",
"of",
"the",
"Namespace",
"entity",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/historical_handlers.go#L497-L503 |
22,156 | kubernetes-retired/heapster | metrics/api/v1/historical_handlers.go | podContainerAggregations | func (a *HistoricalApi) podContainerAggregations(request *restful.Request, response *restful.Response) {
var key core.HistoricalKey
if request.PathParameter("pod-id") != "" {
key = core.HistoricalKey{
ObjectType: core.MetricSetTypePodContainer,
PodId: request.PathParameter("pod-id"),
ContainerNa... | go | func (a *HistoricalApi) podContainerAggregations(request *restful.Request, response *restful.Response) {
var key core.HistoricalKey
if request.PathParameter("pod-id") != "" {
key = core.HistoricalKey{
ObjectType: core.MetricSetTypePodContainer,
PodId: request.PathParameter("pod-id"),
ContainerNa... | [
"func",
"(",
"a",
"*",
"HistoricalApi",
")",
"podContainerAggregations",
"(",
"request",
"*",
"restful",
".",
"Request",
",",
"response",
"*",
"restful",
".",
"Response",
")",
"{",
"var",
"key",
"core",
".",
"HistoricalKey",
"\n",
"if",
"request",
".",
"Pa... | // podContainerAggregations returns a metric timeseries for a metric of a Pod Container entity. | [
"podContainerAggregations",
"returns",
"a",
"metric",
"timeseries",
"for",
"a",
"metric",
"of",
"a",
"Pod",
"Container",
"entity",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/historical_handlers.go#L524-L541 |
22,157 | kubernetes-retired/heapster | metrics/api/v1/historical_handlers.go | freeContainerAggregations | func (a *HistoricalApi) freeContainerAggregations(request *restful.Request, response *restful.Response) {
key := core.HistoricalKey{
ObjectType: core.MetricSetTypeSystemContainer,
NodeName: request.PathParameter("node-name"),
ContainerName: request.PathParameter("container-name"),
}
a.processAggregatio... | go | func (a *HistoricalApi) freeContainerAggregations(request *restful.Request, response *restful.Response) {
key := core.HistoricalKey{
ObjectType: core.MetricSetTypeSystemContainer,
NodeName: request.PathParameter("node-name"),
ContainerName: request.PathParameter("container-name"),
}
a.processAggregatio... | [
"func",
"(",
"a",
"*",
"HistoricalApi",
")",
"freeContainerAggregations",
"(",
"request",
"*",
"restful",
".",
"Request",
",",
"response",
"*",
"restful",
".",
"Response",
")",
"{",
"key",
":=",
"core",
".",
"HistoricalKey",
"{",
"ObjectType",
":",
"core",
... | // freeContainerAggregations returns a metric timeseries for a metric of the Container entity.
// freeContainerAggregations addresses only free containers. | [
"freeContainerAggregations",
"returns",
"a",
"metric",
"timeseries",
"for",
"a",
"metric",
"of",
"the",
"Container",
"entity",
".",
"freeContainerAggregations",
"addresses",
"only",
"free",
"containers",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/historical_handlers.go#L545-L552 |
22,158 | kubernetes-retired/heapster | metrics/api/v1/historical_handlers.go | podListAggregations | func (a *HistoricalApi) podListAggregations(request *restful.Request, response *restful.Response) {
start, end, err := getStartEndTimeHistorical(request)
if err != nil {
response.WriteError(http.StatusBadRequest, err)
return
}
bucketSize, err := getBucketSize(request)
if err != nil {
response.WriteError(http... | go | func (a *HistoricalApi) podListAggregations(request *restful.Request, response *restful.Response) {
start, end, err := getStartEndTimeHistorical(request)
if err != nil {
response.WriteError(http.StatusBadRequest, err)
return
}
bucketSize, err := getBucketSize(request)
if err != nil {
response.WriteError(http... | [
"func",
"(",
"a",
"*",
"HistoricalApi",
")",
"podListAggregations",
"(",
"request",
"*",
"restful",
".",
"Request",
",",
"response",
"*",
"restful",
".",
"Response",
")",
"{",
"start",
",",
"end",
",",
"err",
":=",
"getStartEndTimeHistorical",
"(",
"request"... | // podListAggregations returns a list of metric timeseries for the specified pods. | [
"podListAggregations",
"returns",
"a",
"list",
"of",
"metric",
"timeseries",
"for",
"the",
"specified",
"pods",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/historical_handlers.go#L555-L616 |
22,159 | kubernetes-retired/heapster | metrics/api/v1/historical_handlers.go | processMetricRequest | func (a *HistoricalApi) processMetricRequest(key core.HistoricalKey, request *restful.Request, response *restful.Response) {
start, end, err := getStartEndTimeHistorical(request)
if err != nil {
response.WriteError(http.StatusBadRequest, err)
return
}
labels, err := getLabels(request)
if err != nil {
respons... | go | func (a *HistoricalApi) processMetricRequest(key core.HistoricalKey, request *restful.Request, response *restful.Response) {
start, end, err := getStartEndTimeHistorical(request)
if err != nil {
response.WriteError(http.StatusBadRequest, err)
return
}
labels, err := getLabels(request)
if err != nil {
respons... | [
"func",
"(",
"a",
"*",
"HistoricalApi",
")",
"processMetricRequest",
"(",
"key",
"core",
".",
"HistoricalKey",
",",
"request",
"*",
"restful",
".",
"Request",
",",
"response",
"*",
"restful",
".",
"Response",
")",
"{",
"start",
",",
"end",
",",
"err",
":... | // processMetricRequest retrieves a metric for the object at the requested key. | [
"processMetricRequest",
"retrieves",
"a",
"metric",
"for",
"the",
"object",
"at",
"the",
"requested",
"key",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/historical_handlers.go#L619-L646 |
22,160 | kubernetes-retired/heapster | metrics/api/v1/historical_handlers.go | processMetricNamesRequest | func (a *HistoricalApi) processMetricNamesRequest(key core.HistoricalKey, response *restful.Response) {
if resp, err := a.historicalSource.GetMetricNames(key); err != nil {
response.WriteError(http.StatusInternalServerError, err)
} else {
response.WriteEntity(resp)
}
} | go | func (a *HistoricalApi) processMetricNamesRequest(key core.HistoricalKey, response *restful.Response) {
if resp, err := a.historicalSource.GetMetricNames(key); err != nil {
response.WriteError(http.StatusInternalServerError, err)
} else {
response.WriteEntity(resp)
}
} | [
"func",
"(",
"a",
"*",
"HistoricalApi",
")",
"processMetricNamesRequest",
"(",
"key",
"core",
".",
"HistoricalKey",
",",
"response",
"*",
"restful",
".",
"Response",
")",
"{",
"if",
"resp",
",",
"err",
":=",
"a",
".",
"historicalSource",
".",
"GetMetricNames... | // processMetricNamesRequest retrieves the available metrics for the object at the specified key. | [
"processMetricNamesRequest",
"retrieves",
"the",
"available",
"metrics",
"for",
"the",
"object",
"at",
"the",
"specified",
"key",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/historical_handlers.go#L649-L655 |
22,161 | kubernetes-retired/heapster | metrics/api/v1/historical_handlers.go | getBucketSize | func getBucketSize(request *restful.Request) (time.Duration, error) {
rawSize := request.QueryParameter("bucket")
if rawSize == "" {
return 0, nil
}
if len(rawSize) < 2 {
return 0, fmt.Errorf("unable to parse bucket size: %q is too short to be a duration", rawSize)
}
var multiplier time.Duration
var num str... | go | func getBucketSize(request *restful.Request) (time.Duration, error) {
rawSize := request.QueryParameter("bucket")
if rawSize == "" {
return 0, nil
}
if len(rawSize) < 2 {
return 0, fmt.Errorf("unable to parse bucket size: %q is too short to be a duration", rawSize)
}
var multiplier time.Duration
var num str... | [
"func",
"getBucketSize",
"(",
"request",
"*",
"restful",
".",
"Request",
")",
"(",
"time",
".",
"Duration",
",",
"error",
")",
"{",
"rawSize",
":=",
"request",
".",
"QueryParameter",
"(",
"\"",
"\"",
")",
"\n",
"if",
"rawSize",
"==",
"\"",
"\"",
"{",
... | // getBucketSize parses the bucket size specifier into a | [
"getBucketSize",
"parses",
"the",
"bucket",
"size",
"specifier",
"into",
"a"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/historical_handlers.go#L698-L739 |
22,162 | kubernetes-retired/heapster | metrics/api/v1/historical_handlers.go | getAggregations | func getAggregations(request *restful.Request) ([]core.AggregationType, error) {
aggregationsRaw := strings.Split(request.PathParameter("aggregations"), ",")
if len(aggregationsRaw) == 0 {
return nil, fmt.Errorf("No aggregations specified")
}
aggregations := make([]core.AggregationType, len(aggregationsRaw))
f... | go | func getAggregations(request *restful.Request) ([]core.AggregationType, error) {
aggregationsRaw := strings.Split(request.PathParameter("aggregations"), ",")
if len(aggregationsRaw) == 0 {
return nil, fmt.Errorf("No aggregations specified")
}
aggregations := make([]core.AggregationType, len(aggregationsRaw))
f... | [
"func",
"getAggregations",
"(",
"request",
"*",
"restful",
".",
"Request",
")",
"(",
"[",
"]",
"core",
".",
"AggregationType",
",",
"error",
")",
"{",
"aggregationsRaw",
":=",
"strings",
".",
"Split",
"(",
"request",
".",
"PathParameter",
"(",
"\"",
"\"",
... | // getAggregations extracts and validates the list of requested aggregations | [
"getAggregations",
"extracts",
"and",
"validates",
"the",
"list",
"of",
"requested",
"aggregations"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/historical_handlers.go#L742-L759 |
22,163 | kubernetes-retired/heapster | metrics/api/v1/historical_handlers.go | exportMetricValue | func exportMetricValue(value *core.MetricValue) *types.MetricValue {
if value == nil {
return nil
}
if value.ValueType == core.ValueInt64 {
return &types.MetricValue{
IntValue: &value.IntValue,
}
} else {
floatVal := float64(value.FloatValue)
return &types.MetricValue{
FloatValue: &floatVal,
}
}... | go | func exportMetricValue(value *core.MetricValue) *types.MetricValue {
if value == nil {
return nil
}
if value.ValueType == core.ValueInt64 {
return &types.MetricValue{
IntValue: &value.IntValue,
}
} else {
floatVal := float64(value.FloatValue)
return &types.MetricValue{
FloatValue: &floatVal,
}
}... | [
"func",
"exportMetricValue",
"(",
"value",
"*",
"core",
".",
"MetricValue",
")",
"*",
"types",
".",
"MetricValue",
"{",
"if",
"value",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"value",
".",
"ValueType",
"==",
"core",
".",
"ValueInt64",... | // exportMetricValue converts a core.MetricValue into an API MetricValue | [
"exportMetricValue",
"converts",
"a",
"core",
".",
"MetricValue",
"into",
"an",
"API",
"MetricValue"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/historical_handlers.go#L762-L777 |
22,164 | kubernetes-retired/heapster | metrics/api/v1/historical_handlers.go | extractMetricValue | func extractMetricValue(aggregations *core.AggregationValue, aggName core.AggregationType) *types.MetricValue {
if inputVal, ok := aggregations.Aggregations[aggName]; ok {
return exportMetricValue(&inputVal)
} else {
return nil
}
} | go | func extractMetricValue(aggregations *core.AggregationValue, aggName core.AggregationType) *types.MetricValue {
if inputVal, ok := aggregations.Aggregations[aggName]; ok {
return exportMetricValue(&inputVal)
} else {
return nil
}
} | [
"func",
"extractMetricValue",
"(",
"aggregations",
"*",
"core",
".",
"AggregationValue",
",",
"aggName",
"core",
".",
"AggregationType",
")",
"*",
"types",
".",
"MetricValue",
"{",
"if",
"inputVal",
",",
"ok",
":=",
"aggregations",
".",
"Aggregations",
"[",
"a... | // extractMetricValue checks to see if the given metric was present in the results, and if so,
// returns it in API form | [
"extractMetricValue",
"checks",
"to",
"see",
"if",
"the",
"given",
"metric",
"was",
"present",
"in",
"the",
"results",
"and",
"if",
"so",
"returns",
"it",
"in",
"API",
"form"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/historical_handlers.go#L781-L787 |
22,165 | kubernetes-retired/heapster | metrics/api/v1/historical_handlers.go | exportTimestampedAggregationValue | func exportTimestampedAggregationValue(values []core.TimestampedAggregationValue) types.MetricAggregationResult {
result := types.MetricAggregationResult{
Buckets: make([]types.MetricAggregationBucket, 0, len(values)),
BucketSize: 0,
}
for _, value := range values {
// just use the largest bucket size, sinc... | go | func exportTimestampedAggregationValue(values []core.TimestampedAggregationValue) types.MetricAggregationResult {
result := types.MetricAggregationResult{
Buckets: make([]types.MetricAggregationBucket, 0, len(values)),
BucketSize: 0,
}
for _, value := range values {
// just use the largest bucket size, sinc... | [
"func",
"exportTimestampedAggregationValue",
"(",
"values",
"[",
"]",
"core",
".",
"TimestampedAggregationValue",
")",
"types",
".",
"MetricAggregationResult",
"{",
"result",
":=",
"types",
".",
"MetricAggregationResult",
"{",
"Buckets",
":",
"make",
"(",
"[",
"]",
... | // exportTimestampedAggregationValue converts a core.TimestampedAggregationValue into an API MetricAggregationResult | [
"exportTimestampedAggregationValue",
"converts",
"a",
"core",
".",
"TimestampedAggregationValue",
"into",
"an",
"API",
"MetricAggregationResult"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/api/v1/historical_handlers.go#L790-L828 |
22,166 | kubernetes-retired/heapster | metrics/sources/summary/summary.go | decodeSummary | func (this *summaryMetricsSource) decodeSummary(summary *stats.Summary) map[string]*MetricSet {
glog.V(9).Infof("Begin summary decode")
result := map[string]*MetricSet{}
labels := map[string]string{
LabelNodename.Key: this.node.NodeName,
LabelHostname.Key: this.node.HostName,
LabelHostID.Key: this.node.Host... | go | func (this *summaryMetricsSource) decodeSummary(summary *stats.Summary) map[string]*MetricSet {
glog.V(9).Infof("Begin summary decode")
result := map[string]*MetricSet{}
labels := map[string]string{
LabelNodename.Key: this.node.NodeName,
LabelHostname.Key: this.node.HostName,
LabelHostID.Key: this.node.Host... | [
"func",
"(",
"this",
"*",
"summaryMetricsSource",
")",
"decodeSummary",
"(",
"summary",
"*",
"stats",
".",
"Summary",
")",
"map",
"[",
"string",
"]",
"*",
"MetricSet",
"{",
"glog",
".",
"V",
"(",
"9",
")",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
... | // decodeSummary translates the kubelet statsSummary API into the flattened heapster MetricSet API. | [
"decodeSummary",
"translates",
"the",
"kubelet",
"statsSummary",
"API",
"into",
"the",
"flattened",
"heapster",
"MetricSet",
"API",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sources/summary/summary.go#L120-L137 |
22,167 | kubernetes-retired/heapster | metrics/sources/summary/summary.go | cloneLabels | func (this *summaryMetricsSource) cloneLabels(labels map[string]string) map[string]string {
clone := make(map[string]string, len(labels))
for k, v := range labels {
clone[k] = v
}
return clone
} | go | func (this *summaryMetricsSource) cloneLabels(labels map[string]string) map[string]string {
clone := make(map[string]string, len(labels))
for k, v := range labels {
clone[k] = v
}
return clone
} | [
"func",
"(",
"this",
"*",
"summaryMetricsSource",
")",
"cloneLabels",
"(",
"labels",
"map",
"[",
"string",
"]",
"string",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"clone",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"len",
"(",
... | // Convenience method for labels deep copy. | [
"Convenience",
"method",
"for",
"labels",
"deep",
"copy",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sources/summary/summary.go#L140-L146 |
22,168 | kubernetes-retired/heapster | metrics/sources/summary/summary.go | addIntMetric | func (this *summaryMetricsSource) addIntMetric(metrics *MetricSet, metric *Metric, value *uint64) {
if value == nil {
glog.V(9).Infof("skipping metric %s because the value was nil", metric.Name)
return
}
val := MetricValue{
ValueType: ValueInt64,
MetricType: metric.Type,
IntValue: int64(*value),
}
met... | go | func (this *summaryMetricsSource) addIntMetric(metrics *MetricSet, metric *Metric, value *uint64) {
if value == nil {
glog.V(9).Infof("skipping metric %s because the value was nil", metric.Name)
return
}
val := MetricValue{
ValueType: ValueInt64,
MetricType: metric.Type,
IntValue: int64(*value),
}
met... | [
"func",
"(",
"this",
"*",
"summaryMetricsSource",
")",
"addIntMetric",
"(",
"metrics",
"*",
"MetricSet",
",",
"metric",
"*",
"Metric",
",",
"value",
"*",
"uint64",
")",
"{",
"if",
"value",
"==",
"nil",
"{",
"glog",
".",
"V",
"(",
"9",
")",
".",
"Info... | // addIntMetric is a convenience method for adding the metric and value to the metric set. | [
"addIntMetric",
"is",
"a",
"convenience",
"method",
"for",
"adding",
"the",
"metric",
"and",
"value",
"to",
"the",
"metric",
"set",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sources/summary/summary.go#L370-L381 |
22,169 | kubernetes-retired/heapster | metrics/sources/summary/summary.go | addLabeledIntMetric | func (this *summaryMetricsSource) addLabeledIntMetric(metrics *MetricSet, metric *Metric, labels map[string]string, value *uint64) {
if value == nil {
glog.V(9).Infof("skipping labeled metric %s (%v) because the value was nil", metric.Name, labels)
return
}
val := LabeledMetric{
Name: metric.Name,
Labels:... | go | func (this *summaryMetricsSource) addLabeledIntMetric(metrics *MetricSet, metric *Metric, labels map[string]string, value *uint64) {
if value == nil {
glog.V(9).Infof("skipping labeled metric %s (%v) because the value was nil", metric.Name, labels)
return
}
val := LabeledMetric{
Name: metric.Name,
Labels:... | [
"func",
"(",
"this",
"*",
"summaryMetricsSource",
")",
"addLabeledIntMetric",
"(",
"metrics",
"*",
"MetricSet",
",",
"metric",
"*",
"Metric",
",",
"labels",
"map",
"[",
"string",
"]",
"string",
",",
"value",
"*",
"uint64",
")",
"{",
"if",
"value",
"==",
... | // addLabeledIntMetric is a convenience method for adding the labeled metric and value to the metric set. | [
"addLabeledIntMetric",
"is",
"a",
"convenience",
"method",
"for",
"adding",
"the",
"labeled",
"metric",
"and",
"value",
"to",
"the",
"metric",
"set",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sources/summary/summary.go#L384-L400 |
22,170 | kubernetes-retired/heapster | metrics/sources/summary/summary.go | getSystemContainerName | func (this *summaryMetricsSource) getSystemContainerName(c *stats.ContainerStats) string {
if legacyName, ok := systemNameMap[c.Name]; ok {
return legacyName
}
return c.Name
} | go | func (this *summaryMetricsSource) getSystemContainerName(c *stats.ContainerStats) string {
if legacyName, ok := systemNameMap[c.Name]; ok {
return legacyName
}
return c.Name
} | [
"func",
"(",
"this",
"*",
"summaryMetricsSource",
")",
"getSystemContainerName",
"(",
"c",
"*",
"stats",
".",
"ContainerStats",
")",
"string",
"{",
"if",
"legacyName",
",",
"ok",
":=",
"systemNameMap",
"[",
"c",
".",
"Name",
"]",
";",
"ok",
"{",
"return",
... | // Translate system container names to the legacy names for backwards compatibility. | [
"Translate",
"system",
"container",
"names",
"to",
"the",
"legacy",
"names",
"for",
"backwards",
"compatibility",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sources/summary/summary.go#L403-L408 |
22,171 | kubernetes-retired/heapster | common/riemann/riemann.go | GetRiemannClient | func GetRiemannClient(config RiemannConfig) (riemanngo.Client, error) {
glog.Infof("Connect Riemann client...")
client := riemanngo.NewTcpClient(config.Host)
runtime.SetFinalizer(client, func(c riemanngo.Client) { c.Close() })
// 5 seconds timeout
err := client.Connect(5)
if err != nil {
return nil, err
}
ret... | go | func GetRiemannClient(config RiemannConfig) (riemanngo.Client, error) {
glog.Infof("Connect Riemann client...")
client := riemanngo.NewTcpClient(config.Host)
runtime.SetFinalizer(client, func(c riemanngo.Client) { c.Close() })
// 5 seconds timeout
err := client.Connect(5)
if err != nil {
return nil, err
}
ret... | [
"func",
"GetRiemannClient",
"(",
"config",
"RiemannConfig",
")",
"(",
"riemanngo",
".",
"Client",
",",
"error",
")",
"{",
"glog",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"client",
":=",
"riemanngo",
".",
"NewTcpClient",
"(",
"config",
".",
"Host",
")",... | // Receives a sink, connect the riemann client. | [
"Receives",
"a",
"sink",
"connect",
"the",
"riemann",
"client",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/common/riemann/riemann.go#L102-L112 |
22,172 | kubernetes-retired/heapster | common/riemann/riemann.go | SendData | func SendData(client riemanngo.Client, events []riemanngo.Event) error {
// do nothing if we are not connected
if client == nil {
glog.Warningf("Riemann sink not connected")
return nil
}
start := time.Now()
_, err := riemanngo.SendEvents(client, &events)
end := time.Now()
if err == nil {
glog.V(4).Infof("E... | go | func SendData(client riemanngo.Client, events []riemanngo.Event) error {
// do nothing if we are not connected
if client == nil {
glog.Warningf("Riemann sink not connected")
return nil
}
start := time.Now()
_, err := riemanngo.SendEvents(client, &events)
end := time.Now()
if err == nil {
glog.V(4).Infof("E... | [
"func",
"SendData",
"(",
"client",
"riemanngo",
".",
"Client",
",",
"events",
"[",
"]",
"riemanngo",
".",
"Event",
")",
"error",
"{",
"// do nothing if we are not connected",
"if",
"client",
"==",
"nil",
"{",
"glog",
".",
"Warningf",
"(",
"\"",
"\"",
")",
... | // Send Events to Riemann using the client from the sink. | [
"Send",
"Events",
"to",
"Riemann",
"using",
"the",
"client",
"from",
"the",
"sink",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/common/riemann/riemann.go#L115-L131 |
22,173 | kubernetes-retired/heapster | events/sinks/manager.go | ExportEvents | func (this *sinkManager) ExportEvents(data *core.EventBatch) {
var wg sync.WaitGroup
for _, sh := range this.sinkHolders {
wg.Add(1)
go func(sh sinkHolder, wg *sync.WaitGroup) {
defer wg.Done()
glog.V(2).Infof("Pushing events to: %s", sh.sink.Name())
select {
case sh.eventBatchChannel <- data:
glo... | go | func (this *sinkManager) ExportEvents(data *core.EventBatch) {
var wg sync.WaitGroup
for _, sh := range this.sinkHolders {
wg.Add(1)
go func(sh sinkHolder, wg *sync.WaitGroup) {
defer wg.Done()
glog.V(2).Infof("Pushing events to: %s", sh.sink.Name())
select {
case sh.eventBatchChannel <- data:
glo... | [
"func",
"(",
"this",
"*",
"sinkManager",
")",
"ExportEvents",
"(",
"data",
"*",
"core",
".",
"EventBatch",
")",
"{",
"var",
"wg",
"sync",
".",
"WaitGroup",
"\n",
"for",
"_",
",",
"sh",
":=",
"range",
"this",
".",
"sinkHolders",
"{",
"wg",
".",
"Add",... | // Guarantees that the export will complete in exportEventsTimeout. | [
"Guarantees",
"that",
"the",
"export",
"will",
"complete",
"in",
"exportEventsTimeout",
"."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/events/sinks/manager.go#L96-L114 |
22,174 | kubernetes-retired/heapster | metrics/sinks/hawkular/client.go | cache | func (h *hawkularSink) cache(md *metrics.MetricDefinition) {
h.pushToCache(md.ID, hashDefinition(md))
} | go | func (h *hawkularSink) cache(md *metrics.MetricDefinition) {
h.pushToCache(md.ID, hashDefinition(md))
} | [
"func",
"(",
"h",
"*",
"hawkularSink",
")",
"cache",
"(",
"md",
"*",
"metrics",
".",
"MetricDefinition",
")",
"{",
"h",
".",
"pushToCache",
"(",
"md",
".",
"ID",
",",
"hashDefinition",
"(",
"md",
")",
")",
"\n",
"}"
] | // cache inserts the item to the cache | [
"cache",
"inserts",
"the",
"item",
"to",
"the",
"cache"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/hawkular/client.go#L50-L52 |
22,175 | kubernetes-retired/heapster | metrics/sinks/hawkular/client.go | pushToCache | func (h *hawkularSink) pushToCache(key string, hash uint64) {
h.regLock.Lock()
h.expReg[key] = &expiringItem{
hash: hash,
ttl: h.runId,
}
h.regLock.Unlock()
} | go | func (h *hawkularSink) pushToCache(key string, hash uint64) {
h.regLock.Lock()
h.expReg[key] = &expiringItem{
hash: hash,
ttl: h.runId,
}
h.regLock.Unlock()
} | [
"func",
"(",
"h",
"*",
"hawkularSink",
")",
"pushToCache",
"(",
"key",
"string",
",",
"hash",
"uint64",
")",
"{",
"h",
".",
"regLock",
".",
"Lock",
"(",
")",
"\n",
"h",
".",
"expReg",
"[",
"key",
"]",
"=",
"&",
"expiringItem",
"{",
"hash",
":",
"... | // toCache inserts the item and updates the TTL in the cache to current time | [
"toCache",
"inserts",
"the",
"item",
"and",
"updates",
"the",
"TTL",
"in",
"the",
"cache",
"to",
"current",
"time"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/hawkular/client.go#L55-L62 |
22,176 | kubernetes-retired/heapster | metrics/sinks/hawkular/client.go | checkCache | func (h *hawkularSink) checkCache(key string, hash uint64) bool {
h.regLock.Lock()
defer h.regLock.Unlock()
_, found := h.expReg[key]
if !found || h.expReg[key].hash != hash {
return false
}
// Update the TTL
h.expReg[key].ttl = h.runId
return true
} | go | func (h *hawkularSink) checkCache(key string, hash uint64) bool {
h.regLock.Lock()
defer h.regLock.Unlock()
_, found := h.expReg[key]
if !found || h.expReg[key].hash != hash {
return false
}
// Update the TTL
h.expReg[key].ttl = h.runId
return true
} | [
"func",
"(",
"h",
"*",
"hawkularSink",
")",
"checkCache",
"(",
"key",
"string",
",",
"hash",
"uint64",
")",
"bool",
"{",
"h",
".",
"regLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"h",
".",
"regLock",
".",
"Unlock",
"(",
")",
"\n",
"_",
",",
"fou... | // checkCache returns false if the cached instance is not current. Updates the TTL in the cache | [
"checkCache",
"returns",
"false",
"if",
"the",
"cached",
"instance",
"is",
"not",
"current",
".",
"Updates",
"the",
"TTL",
"in",
"the",
"cache"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/hawkular/client.go#L65-L75 |
22,177 | kubernetes-retired/heapster | metrics/sinks/hawkular/client.go | expireCache | func (h *hawkularSink) expireCache(runId uint64) {
h.regLock.Lock()
defer h.regLock.Unlock()
for k, v := range h.expReg {
if (v.ttl + h.cacheAge) <= runId {
delete(h.expReg, k)
}
}
} | go | func (h *hawkularSink) expireCache(runId uint64) {
h.regLock.Lock()
defer h.regLock.Unlock()
for k, v := range h.expReg {
if (v.ttl + h.cacheAge) <= runId {
delete(h.expReg, k)
}
}
} | [
"func",
"(",
"h",
"*",
"hawkularSink",
")",
"expireCache",
"(",
"runId",
"uint64",
")",
"{",
"h",
".",
"regLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"h",
".",
"regLock",
".",
"Unlock",
"(",
")",
"\n\n",
"for",
"k",
",",
"v",
":=",
"range",
"h"... | // expireCache will process the map and check for any item that has been expired and release it | [
"expireCache",
"will",
"process",
"the",
"map",
"and",
"check",
"for",
"any",
"item",
"that",
"has",
"been",
"expired",
"and",
"release",
"it"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/hawkular/client.go#L78-L87 |
22,178 | kubernetes-retired/heapster | metrics/sinks/hawkular/client.go | updateDefinitions | func (h *hawkularSink) updateDefinitions(mds []*metrics.MetricDefinition) error {
for _, p := range mds {
if model, f := h.models[p.Tags[descriptorTag]]; f && !h.recent(p, model) {
if err := h.client.UpdateTags(p.Type, p.ID, p.Tags, h.modifiers...); err != nil {
return err
}
}
h.cache(p)
}
return ni... | go | func (h *hawkularSink) updateDefinitions(mds []*metrics.MetricDefinition) error {
for _, p := range mds {
if model, f := h.models[p.Tags[descriptorTag]]; f && !h.recent(p, model) {
if err := h.client.UpdateTags(p.Type, p.ID, p.Tags, h.modifiers...); err != nil {
return err
}
}
h.cache(p)
}
return ni... | [
"func",
"(",
"h",
"*",
"hawkularSink",
")",
"updateDefinitions",
"(",
"mds",
"[",
"]",
"*",
"metrics",
".",
"MetricDefinition",
")",
"error",
"{",
"for",
"_",
",",
"p",
":=",
"range",
"mds",
"{",
"if",
"model",
",",
"f",
":=",
"h",
".",
"models",
"... | // Fetches definitions from the server and checks that they're matching the descriptors | [
"Fetches",
"definitions",
"from",
"the",
"server",
"and",
"checks",
"that",
"they",
"re",
"matching",
"the",
"descriptors"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/hawkular/client.go#L90-L101 |
22,179 | kubernetes-retired/heapster | metrics/sinks/hawkular/client.go | recent | func (h *hawkularSink) recent(live *metrics.MetricDefinition, model *metrics.MetricDefinition) bool {
recent := true
for k := range model.Tags {
if v, found := live.Tags[k]; !found {
// There's a label that wasn't in our stored definition
live.Tags[k] = v
recent = false
}
}
return recent
} | go | func (h *hawkularSink) recent(live *metrics.MetricDefinition, model *metrics.MetricDefinition) bool {
recent := true
for k := range model.Tags {
if v, found := live.Tags[k]; !found {
// There's a label that wasn't in our stored definition
live.Tags[k] = v
recent = false
}
}
return recent
} | [
"func",
"(",
"h",
"*",
"hawkularSink",
")",
"recent",
"(",
"live",
"*",
"metrics",
".",
"MetricDefinition",
",",
"model",
"*",
"metrics",
".",
"MetricDefinition",
")",
"bool",
"{",
"recent",
":=",
"true",
"\n",
"for",
"k",
":=",
"range",
"model",
".",
... | // Checks that stored definition is up to date with the model | [
"Checks",
"that",
"stored",
"definition",
"is",
"up",
"to",
"date",
"with",
"the",
"model"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/hawkular/client.go#L125-L136 |
22,180 | kubernetes-retired/heapster | metrics/sinks/hawkular/client.go | descriptorToDefinition | func (h *hawkularSink) descriptorToDefinition(md *core.MetricDescriptor) metrics.MetricDefinition {
tags := make(map[string]string)
// Postfix description tags with _description
for _, l := range md.Labels {
if len(l.Description) > 0 {
tags[l.Key+descriptionTag] = l.Description
}
}
if len(md.Units.String()... | go | func (h *hawkularSink) descriptorToDefinition(md *core.MetricDescriptor) metrics.MetricDefinition {
tags := make(map[string]string)
// Postfix description tags with _description
for _, l := range md.Labels {
if len(l.Description) > 0 {
tags[l.Key+descriptionTag] = l.Description
}
}
if len(md.Units.String()... | [
"func",
"(",
"h",
"*",
"hawkularSink",
")",
"descriptorToDefinition",
"(",
"md",
"*",
"core",
".",
"MetricDescriptor",
")",
"metrics",
".",
"MetricDefinition",
"{",
"tags",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"// Postfix descri... | // Transform the MetricDescriptor to a format used by Hawkular-Metrics | [
"Transform",
"the",
"MetricDescriptor",
"to",
"a",
"format",
"used",
"by",
"Hawkular",
"-",
"Metrics"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/hawkular/client.go#L139-L161 |
22,181 | kubernetes-retired/heapster | metrics/sinks/hawkular/client.go | pointToLabeledMetricHeader | func (h *hawkularSink) pointToLabeledMetricHeader(ms *core.MetricSet, metric core.LabeledMetric, timestamp time.Time) (*metrics.MetricHeader, error) {
name := h.idName(ms, metric.Name)
if resourceID, found := metric.Labels[core.LabelResourceID.Key]; found {
name = h.idName(ms, metric.Name+separator+resourceID)
}
... | go | func (h *hawkularSink) pointToLabeledMetricHeader(ms *core.MetricSet, metric core.LabeledMetric, timestamp time.Time) (*metrics.MetricHeader, error) {
name := h.idName(ms, metric.Name)
if resourceID, found := metric.Labels[core.LabelResourceID.Key]; found {
name = h.idName(ms, metric.Name+separator+resourceID)
}
... | [
"func",
"(",
"h",
"*",
"hawkularSink",
")",
"pointToLabeledMetricHeader",
"(",
"ms",
"*",
"core",
".",
"MetricSet",
",",
"metric",
"core",
".",
"LabeledMetric",
",",
"timestamp",
"time",
".",
"Time",
")",
"(",
"*",
"metrics",
".",
"MetricHeader",
",",
"err... | // Converts Timeseries to metric structure used by the Hawkular | [
"Converts",
"Timeseries",
"to",
"metric",
"structure",
"used",
"by",
"the",
"Hawkular"
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/hawkular/client.go#L356-L382 |
22,182 | kubernetes-retired/heapster | metrics/sinks/hawkular/client.go | parseFilters | func parseFilters(v []string) ([]Filter, error) {
fs := make([]Filter, 0, len(v))
for _, s := range v {
p := strings.Index(s, "(")
if p < 0 {
return nil, fmt.Errorf("Incorrect syntax in filter parameters, missing (")
}
if strings.Index(s, ")") != len(s)-1 {
return nil, fmt.Errorf("Incorrect syntax in f... | go | func parseFilters(v []string) ([]Filter, error) {
fs := make([]Filter, 0, len(v))
for _, s := range v {
p := strings.Index(s, "(")
if p < 0 {
return nil, fmt.Errorf("Incorrect syntax in filter parameters, missing (")
}
if strings.Index(s, ")") != len(s)-1 {
return nil, fmt.Errorf("Incorrect syntax in f... | [
"func",
"parseFilters",
"(",
"v",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"Filter",
",",
"error",
")",
"{",
"fs",
":=",
"make",
"(",
"[",
"]",
"Filter",
",",
"0",
",",
"len",
"(",
"v",
")",
")",
"\n",
"for",
"_",
",",
"s",
":=",
"range",
"v... | // If Heapster gets filters, remove these.. | [
"If",
"Heapster",
"gets",
"filters",
"remove",
"these",
".."
] | e1e83412787b60d8a70088f09a2cb12339b305c3 | https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/hawkular/client.go#L385-L426 |
22,183 | gdamore/tcell | _demos/mouse.go | main | func main() {
encoding.Register()
s, e := tcell.NewScreen()
if e != nil {
fmt.Fprintf(os.Stderr, "%v\n", e)
os.Exit(1)
}
if e := s.Init(); e != nil {
fmt.Fprintf(os.Stderr, "%v\n", e)
os.Exit(1)
}
defStyle = tcell.StyleDefault.
Background(tcell.ColorBlack).
Foreground(tcell.ColorWhite)
s.SetStyle(... | go | func main() {
encoding.Register()
s, e := tcell.NewScreen()
if e != nil {
fmt.Fprintf(os.Stderr, "%v\n", e)
os.Exit(1)
}
if e := s.Init(); e != nil {
fmt.Fprintf(os.Stderr, "%v\n", e)
os.Exit(1)
}
defStyle = tcell.StyleDefault.
Background(tcell.ColorBlack).
Foreground(tcell.ColorWhite)
s.SetStyle(... | [
"func",
"main",
"(",
")",
"{",
"encoding",
".",
"Register",
"(",
")",
"\n\n",
"s",
",",
"e",
":=",
"tcell",
".",
"NewScreen",
"(",
")",
"\n",
"if",
"e",
"!=",
"nil",
"{",
"fmt",
".",
"Fprintf",
"(",
"os",
".",
"Stderr",
",",
"\"",
"\\n",
"\"",
... | // This program just shows simple mouse and keyboard events. Press ESC twice to
// exit. | [
"This",
"program",
"just",
"shows",
"simple",
"mouse",
"and",
"keyboard",
"events",
".",
"Press",
"ESC",
"twice",
"to",
"exit",
"."
] | dcf1bb30770eb1158b67005e1e472de6d74f055d | https://github.com/gdamore/tcell/blob/dcf1bb30770eb1158b67005e1e472de6d74f055d/_demos/mouse.go#L101-L250 |
22,184 | gdamore/tcell | views/view.go | Fill | func (v *ViewPort) Fill(ch rune, style tcell.Style) {
if v.v != nil {
for y := 0; y < v.height; y++ {
for x := 0; x < v.width; x++ {
v.v.SetContent(x+v.physx, y+v.physy, ch, nil, style)
}
}
}
} | go | func (v *ViewPort) Fill(ch rune, style tcell.Style) {
if v.v != nil {
for y := 0; y < v.height; y++ {
for x := 0; x < v.width; x++ {
v.v.SetContent(x+v.physx, y+v.physy, ch, nil, style)
}
}
}
} | [
"func",
"(",
"v",
"*",
"ViewPort",
")",
"Fill",
"(",
"ch",
"rune",
",",
"style",
"tcell",
".",
"Style",
")",
"{",
"if",
"v",
".",
"v",
"!=",
"nil",
"{",
"for",
"y",
":=",
"0",
";",
"y",
"<",
"v",
".",
"height",
";",
"y",
"++",
"{",
"for",
... | // Fill fills the displayed view port with the given character and style. | [
"Fill",
"fills",
"the",
"displayed",
"view",
"port",
"with",
"the",
"given",
"character",
"and",
"style",
"."
] | dcf1bb30770eb1158b67005e1e472de6d74f055d | https://github.com/gdamore/tcell/blob/dcf1bb30770eb1158b67005e1e472de6d74f055d/views/view.go#L73-L81 |
22,185 | gdamore/tcell | views/view.go | Reset | func (v *ViewPort) Reset() {
v.limx = 0
v.limy = 0
v.viewx = 0
v.viewy = 0
} | go | func (v *ViewPort) Reset() {
v.limx = 0
v.limy = 0
v.viewx = 0
v.viewy = 0
} | [
"func",
"(",
"v",
"*",
"ViewPort",
")",
"Reset",
"(",
")",
"{",
"v",
".",
"limx",
"=",
"0",
"\n",
"v",
".",
"limy",
"=",
"0",
"\n",
"v",
".",
"viewx",
"=",
"0",
"\n",
"v",
".",
"viewy",
"=",
"0",
"\n",
"}"
] | // Reset resets the record of content, and also resets the offset back
// to the origin. It doesn't alter the dimensions of the view port, nor
// the physical location relative to its parent. | [
"Reset",
"resets",
"the",
"record",
"of",
"content",
"and",
"also",
"resets",
"the",
"offset",
"back",
"to",
"the",
"origin",
".",
"It",
"doesn",
"t",
"alter",
"the",
"dimensions",
"of",
"the",
"view",
"port",
"nor",
"the",
"physical",
"location",
"relativ... | dcf1bb30770eb1158b67005e1e472de6d74f055d | https://github.com/gdamore/tcell/blob/dcf1bb30770eb1158b67005e1e472de6d74f055d/views/view.go#L91-L96 |
22,186 | gdamore/tcell | views/view.go | MakeVisible | func (v *ViewPort) MakeVisible(x, y int) {
if x < v.limx && x >= v.viewx+v.width {
v.viewx = x - (v.width - 1)
}
if x >= 0 && x < v.viewx {
v.viewx = x
}
if y < v.limy && y >= v.viewy+v.height {
v.viewy = y - (v.height - 1)
}
if y >= 0 && y < v.viewy {
v.viewy = y
}
v.ValidateView()
} | go | func (v *ViewPort) MakeVisible(x, y int) {
if x < v.limx && x >= v.viewx+v.width {
v.viewx = x - (v.width - 1)
}
if x >= 0 && x < v.viewx {
v.viewx = x
}
if y < v.limy && y >= v.viewy+v.height {
v.viewy = y - (v.height - 1)
}
if y >= 0 && y < v.viewy {
v.viewy = y
}
v.ValidateView()
} | [
"func",
"(",
"v",
"*",
"ViewPort",
")",
"MakeVisible",
"(",
"x",
",",
"y",
"int",
")",
"{",
"if",
"x",
"<",
"v",
".",
"limx",
"&&",
"x",
">=",
"v",
".",
"viewx",
"+",
"v",
".",
"width",
"{",
"v",
".",
"viewx",
"=",
"x",
"-",
"(",
"v",
"."... | // MakeVisible moves the ViewPort the minimum necessary to make the given
// point visible. This should be called before any content is changed with
// SetContent, since otherwise it may be possible to move the location onto
// a region whose contents have been discarded. | [
"MakeVisible",
"moves",
"the",
"ViewPort",
"the",
"minimum",
"necessary",
"to",
"make",
"the",
"given",
"point",
"visible",
".",
"This",
"should",
"be",
"called",
"before",
"any",
"content",
"is",
"changed",
"with",
"SetContent",
"since",
"otherwise",
"it",
"m... | dcf1bb30770eb1158b67005e1e472de6d74f055d | https://github.com/gdamore/tcell/blob/dcf1bb30770eb1158b67005e1e472de6d74f055d/views/view.go#L130-L144 |
22,187 | gdamore/tcell | views/view.go | ValidateViewY | func (v *ViewPort) ValidateViewY() {
if v.viewy >= v.limy-v.height {
v.viewy = (v.limy - v.height)
}
if v.viewy < 0 {
v.viewy = 0
}
} | go | func (v *ViewPort) ValidateViewY() {
if v.viewy >= v.limy-v.height {
v.viewy = (v.limy - v.height)
}
if v.viewy < 0 {
v.viewy = 0
}
} | [
"func",
"(",
"v",
"*",
"ViewPort",
")",
"ValidateViewY",
"(",
")",
"{",
"if",
"v",
".",
"viewy",
">=",
"v",
".",
"limy",
"-",
"v",
".",
"height",
"{",
"v",
".",
"viewy",
"=",
"(",
"v",
".",
"limy",
"-",
"v",
".",
"height",
")",
"\n",
"}",
"... | // ValidateViewY ensures that the Y offset of the view port is limited so that
// it cannot scroll away from the content. | [
"ValidateViewY",
"ensures",
"that",
"the",
"Y",
"offset",
"of",
"the",
"view",
"port",
"is",
"limited",
"so",
"that",
"it",
"cannot",
"scroll",
"away",
"from",
"the",
"content",
"."
] | dcf1bb30770eb1158b67005e1e472de6d74f055d | https://github.com/gdamore/tcell/blob/dcf1bb30770eb1158b67005e1e472de6d74f055d/views/view.go#L148-L155 |
22,188 | gdamore/tcell | views/view.go | ValidateViewX | func (v *ViewPort) ValidateViewX() {
if v.viewx >= v.limx-v.width {
v.viewx = (v.limx - v.width)
}
if v.viewx < 0 {
v.viewx = 0
}
} | go | func (v *ViewPort) ValidateViewX() {
if v.viewx >= v.limx-v.width {
v.viewx = (v.limx - v.width)
}
if v.viewx < 0 {
v.viewx = 0
}
} | [
"func",
"(",
"v",
"*",
"ViewPort",
")",
"ValidateViewX",
"(",
")",
"{",
"if",
"v",
".",
"viewx",
">=",
"v",
".",
"limx",
"-",
"v",
".",
"width",
"{",
"v",
".",
"viewx",
"=",
"(",
"v",
".",
"limx",
"-",
"v",
".",
"width",
")",
"\n",
"}",
"\n... | // ValidateViewX ensures that the X offset of the view port is limited so that
// it cannot scroll away from the content. | [
"ValidateViewX",
"ensures",
"that",
"the",
"X",
"offset",
"of",
"the",
"view",
"port",
"is",
"limited",
"so",
"that",
"it",
"cannot",
"scroll",
"away",
"from",
"the",
"content",
"."
] | dcf1bb30770eb1158b67005e1e472de6d74f055d | https://github.com/gdamore/tcell/blob/dcf1bb30770eb1158b67005e1e472de6d74f055d/views/view.go#L159-L166 |
22,189 | gdamore/tcell | views/view.go | Center | func (v *ViewPort) Center(x, y int) {
if x < 0 || y < 0 || x >= v.limx || y >= v.limy || v.v == nil {
return
}
v.viewx = x - (v.width / 2)
v.viewy = y - (v.height / 2)
v.ValidateView()
} | go | func (v *ViewPort) Center(x, y int) {
if x < 0 || y < 0 || x >= v.limx || y >= v.limy || v.v == nil {
return
}
v.viewx = x - (v.width / 2)
v.viewy = y - (v.height / 2)
v.ValidateView()
} | [
"func",
"(",
"v",
"*",
"ViewPort",
")",
"Center",
"(",
"x",
",",
"y",
"int",
")",
"{",
"if",
"x",
"<",
"0",
"||",
"y",
"<",
"0",
"||",
"x",
">=",
"v",
".",
"limx",
"||",
"y",
">=",
"v",
".",
"limy",
"||",
"v",
".",
"v",
"==",
"nil",
"{"... | // Center centers the point, if possible, in the View. | [
"Center",
"centers",
"the",
"point",
"if",
"possible",
"in",
"the",
"View",
"."
] | dcf1bb30770eb1158b67005e1e472de6d74f055d | https://github.com/gdamore/tcell/blob/dcf1bb30770eb1158b67005e1e472de6d74f055d/views/view.go#L176-L183 |
22,190 | gdamore/tcell | views/view.go | ScrollUp | func (v *ViewPort) ScrollUp(rows int) {
v.viewy -= rows
v.ValidateViewY()
} | go | func (v *ViewPort) ScrollUp(rows int) {
v.viewy -= rows
v.ValidateViewY()
} | [
"func",
"(",
"v",
"*",
"ViewPort",
")",
"ScrollUp",
"(",
"rows",
"int",
")",
"{",
"v",
".",
"viewy",
"-=",
"rows",
"\n",
"v",
".",
"ValidateViewY",
"(",
")",
"\n",
"}"
] | // ScrollUp moves the view up, showing lower numbered rows of content. | [
"ScrollUp",
"moves",
"the",
"view",
"up",
"showing",
"lower",
"numbered",
"rows",
"of",
"content",
"."
] | dcf1bb30770eb1158b67005e1e472de6d74f055d | https://github.com/gdamore/tcell/blob/dcf1bb30770eb1158b67005e1e472de6d74f055d/views/view.go#L186-L189 |
22,191 | gdamore/tcell | views/view.go | ScrollDown | func (v *ViewPort) ScrollDown(rows int) {
v.viewy += rows
v.ValidateViewY()
} | go | func (v *ViewPort) ScrollDown(rows int) {
v.viewy += rows
v.ValidateViewY()
} | [
"func",
"(",
"v",
"*",
"ViewPort",
")",
"ScrollDown",
"(",
"rows",
"int",
")",
"{",
"v",
".",
"viewy",
"+=",
"rows",
"\n",
"v",
".",
"ValidateViewY",
"(",
")",
"\n",
"}"
] | // ScrollDown moves the view down, showingh higher numbered rows of content. | [
"ScrollDown",
"moves",
"the",
"view",
"down",
"showingh",
"higher",
"numbered",
"rows",
"of",
"content",
"."
] | dcf1bb30770eb1158b67005e1e472de6d74f055d | https://github.com/gdamore/tcell/blob/dcf1bb30770eb1158b67005e1e472de6d74f055d/views/view.go#L192-L195 |
22,192 | gdamore/tcell | views/view.go | ScrollLeft | func (v *ViewPort) ScrollLeft(cols int) {
v.viewx -= cols
v.ValidateViewX()
} | go | func (v *ViewPort) ScrollLeft(cols int) {
v.viewx -= cols
v.ValidateViewX()
} | [
"func",
"(",
"v",
"*",
"ViewPort",
")",
"ScrollLeft",
"(",
"cols",
"int",
")",
"{",
"v",
".",
"viewx",
"-=",
"cols",
"\n",
"v",
".",
"ValidateViewX",
"(",
")",
"\n",
"}"
] | // ScrollLeft moves the view to the left. | [
"ScrollLeft",
"moves",
"the",
"view",
"to",
"the",
"left",
"."
] | dcf1bb30770eb1158b67005e1e472de6d74f055d | https://github.com/gdamore/tcell/blob/dcf1bb30770eb1158b67005e1e472de6d74f055d/views/view.go#L198-L201 |
22,193 | gdamore/tcell | views/view.go | ScrollRight | func (v *ViewPort) ScrollRight(cols int) {
v.viewx += cols
v.ValidateViewX()
} | go | func (v *ViewPort) ScrollRight(cols int) {
v.viewx += cols
v.ValidateViewX()
} | [
"func",
"(",
"v",
"*",
"ViewPort",
")",
"ScrollRight",
"(",
"cols",
"int",
")",
"{",
"v",
".",
"viewx",
"+=",
"cols",
"\n",
"v",
".",
"ValidateViewX",
"(",
")",
"\n",
"}"
] | // ScrollRight moves the view to the left. | [
"ScrollRight",
"moves",
"the",
"view",
"to",
"the",
"left",
"."
] | dcf1bb30770eb1158b67005e1e472de6d74f055d | https://github.com/gdamore/tcell/blob/dcf1bb30770eb1158b67005e1e472de6d74f055d/views/view.go#L204-L207 |
22,194 | gdamore/tcell | views/view.go | SetSize | func (v *ViewPort) SetSize(width, height int) {
v.height = height
v.width = width
v.ValidateView()
} | go | func (v *ViewPort) SetSize(width, height int) {
v.height = height
v.width = width
v.ValidateView()
} | [
"func",
"(",
"v",
"*",
"ViewPort",
")",
"SetSize",
"(",
"width",
",",
"height",
"int",
")",
"{",
"v",
".",
"height",
"=",
"height",
"\n",
"v",
".",
"width",
"=",
"width",
"\n",
"v",
".",
"ValidateView",
"(",
")",
"\n",
"}"
] | // SetSize is used to set the visible size of the view. Enclosing views or
// layout managers can use this to inform the View of its correct visible size. | [
"SetSize",
"is",
"used",
"to",
"set",
"the",
"visible",
"size",
"of",
"the",
"view",
".",
"Enclosing",
"views",
"or",
"layout",
"managers",
"can",
"use",
"this",
"to",
"inform",
"the",
"View",
"of",
"its",
"correct",
"visible",
"size",
"."
] | dcf1bb30770eb1158b67005e1e472de6d74f055d | https://github.com/gdamore/tcell/blob/dcf1bb30770eb1158b67005e1e472de6d74f055d/views/view.go#L211-L215 |
22,195 | gdamore/tcell | views/view.go | GetVisible | func (v *ViewPort) GetVisible() (int, int, int, int) {
return v.viewx, v.viewy, v.viewx + v.width - 1, v.viewy + v.height - 1
} | go | func (v *ViewPort) GetVisible() (int, int, int, int) {
return v.viewx, v.viewy, v.viewx + v.width - 1, v.viewy + v.height - 1
} | [
"func",
"(",
"v",
"*",
"ViewPort",
")",
"GetVisible",
"(",
")",
"(",
"int",
",",
"int",
",",
"int",
",",
"int",
")",
"{",
"return",
"v",
".",
"viewx",
",",
"v",
".",
"viewy",
",",
"v",
".",
"viewx",
"+",
"v",
".",
"width",
"-",
"1",
",",
"v... | // GetVisible returns the upper left and lower right coordinates of the visible
// content. That is, it will return x1, y1, x2, y2 where the upper left cell
// is position x1, y1, and the lower right is x2, y2. These coordinates are
// in the space of the content, that is the content area uses coordinate 0,0
// as it... | [
"GetVisible",
"returns",
"the",
"upper",
"left",
"and",
"lower",
"right",
"coordinates",
"of",
"the",
"visible",
"content",
".",
"That",
"is",
"it",
"will",
"return",
"x1",
"y1",
"x2",
"y2",
"where",
"the",
"upper",
"left",
"cell",
"is",
"position",
"x1",
... | dcf1bb30770eb1158b67005e1e472de6d74f055d | https://github.com/gdamore/tcell/blob/dcf1bb30770eb1158b67005e1e472de6d74f055d/views/view.go#L222-L224 |
22,196 | gdamore/tcell | views/view.go | GetPhysical | func (v *ViewPort) GetPhysical() (int, int, int, int) {
return v.physx, v.physy, v.physx + v.width - 1, v.physy + v.height - 1
} | go | func (v *ViewPort) GetPhysical() (int, int, int, int) {
return v.physx, v.physy, v.physx + v.width - 1, v.physy + v.height - 1
} | [
"func",
"(",
"v",
"*",
"ViewPort",
")",
"GetPhysical",
"(",
")",
"(",
"int",
",",
"int",
",",
"int",
",",
"int",
")",
"{",
"return",
"v",
".",
"physx",
",",
"v",
".",
"physy",
",",
"v",
".",
"physx",
"+",
"v",
".",
"width",
"-",
"1",
",",
"... | // GetPhysical returns the upper left and lower right coordinates of the visible
// content in the coordinate space of the parent. This is may be the physical
// coordinates of the screen, if the screen is the view's parent. | [
"GetPhysical",
"returns",
"the",
"upper",
"left",
"and",
"lower",
"right",
"coordinates",
"of",
"the",
"visible",
"content",
"in",
"the",
"coordinate",
"space",
"of",
"the",
"parent",
".",
"This",
"is",
"may",
"be",
"the",
"physical",
"coordinates",
"of",
"t... | dcf1bb30770eb1158b67005e1e472de6d74f055d | https://github.com/gdamore/tcell/blob/dcf1bb30770eb1158b67005e1e472de6d74f055d/views/view.go#L229-L231 |
22,197 | gdamore/tcell | views/view.go | Resize | func (v *ViewPort) Resize(x, y, width, height int) {
if v.v == nil {
return
}
px, py := v.v.Size()
if x >= 0 && x < px {
v.physx = x
}
if y >= 0 && y < py {
v.physy = y
}
if width < 0 {
width = px - x
}
if height < 0 {
height = py - y
}
if width <= x+px {
v.width = width
}
if height <= y+py {
... | go | func (v *ViewPort) Resize(x, y, width, height int) {
if v.v == nil {
return
}
px, py := v.v.Size()
if x >= 0 && x < px {
v.physx = x
}
if y >= 0 && y < py {
v.physy = y
}
if width < 0 {
width = px - x
}
if height < 0 {
height = py - y
}
if width <= x+px {
v.width = width
}
if height <= y+py {
... | [
"func",
"(",
"v",
"*",
"ViewPort",
")",
"Resize",
"(",
"x",
",",
"y",
",",
"width",
",",
"height",
"int",
")",
"{",
"if",
"v",
".",
"v",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"px",
",",
"py",
":=",
"v",
".",
"v",
".",
"Size",
"(",
... | // Resize is called by the enclosing view to change the size of the ViewPort,
// usually in response to a window resize event. The x, y refer are the
// ViewPort's location relative to the parent View. A negative value for either
// width or height will cause the ViewPort to expand to fill to the end of parent
// Vie... | [
"Resize",
"is",
"called",
"by",
"the",
"enclosing",
"view",
"to",
"change",
"the",
"size",
"of",
"the",
"ViewPort",
"usually",
"in",
"response",
"to",
"a",
"window",
"resize",
"event",
".",
"The",
"x",
"y",
"refer",
"are",
"the",
"ViewPort",
"s",
"locati... | dcf1bb30770eb1158b67005e1e472de6d74f055d | https://github.com/gdamore/tcell/blob/dcf1bb30770eb1158b67005e1e472de6d74f055d/views/view.go#L257-L280 |
22,198 | gdamore/tcell | views/textbar.go | SetCenter | func (t *TextBar) SetCenter(s string, style tcell.Style) {
t.initialize()
if style == tcell.StyleDefault {
style = t.style
}
t.center.SetText(s)
t.center.SetStyle(style)
} | go | func (t *TextBar) SetCenter(s string, style tcell.Style) {
t.initialize()
if style == tcell.StyleDefault {
style = t.style
}
t.center.SetText(s)
t.center.SetStyle(style)
} | [
"func",
"(",
"t",
"*",
"TextBar",
")",
"SetCenter",
"(",
"s",
"string",
",",
"style",
"tcell",
".",
"Style",
")",
"{",
"t",
".",
"initialize",
"(",
")",
"\n",
"if",
"style",
"==",
"tcell",
".",
"StyleDefault",
"{",
"style",
"=",
"t",
".",
"style",
... | // SetCenter sets the center text for the textbar. The text is
// always center aligned. | [
"SetCenter",
"sets",
"the",
"center",
"text",
"for",
"the",
"textbar",
".",
"The",
"text",
"is",
"always",
"center",
"aligned",
"."
] | dcf1bb30770eb1158b67005e1e472de6d74f055d | https://github.com/gdamore/tcell/blob/dcf1bb30770eb1158b67005e1e472de6d74f055d/views/textbar.go#L44-L51 |
22,199 | gdamore/tcell | views/textbar.go | SetStyle | func (t *TextBar) SetStyle(style tcell.Style) {
t.initialize()
t.style = style
} | go | func (t *TextBar) SetStyle(style tcell.Style) {
t.initialize()
t.style = style
} | [
"func",
"(",
"t",
"*",
"TextBar",
")",
"SetStyle",
"(",
"style",
"tcell",
".",
"Style",
")",
"{",
"t",
".",
"initialize",
"(",
")",
"\n",
"t",
".",
"style",
"=",
"style",
"\n",
"}"
] | // SetStyle is used to set a default style to use for the textbar, including
// areas where no text is present. Note that this will not change the text
// already displayed, so call this before changing or setting text. | [
"SetStyle",
"is",
"used",
"to",
"set",
"a",
"default",
"style",
"to",
"use",
"for",
"the",
"textbar",
"including",
"areas",
"where",
"no",
"text",
"is",
"present",
".",
"Note",
"that",
"this",
"will",
"not",
"change",
"the",
"text",
"already",
"displayed",... | dcf1bb30770eb1158b67005e1e472de6d74f055d | https://github.com/gdamore/tcell/blob/dcf1bb30770eb1158b67005e1e472de6d74f055d/views/textbar.go#L76-L79 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.