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
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
partition
stringclasses
1 value
anacrolix/torrent
torrent.go
bytesCompleted
func (t *Torrent) bytesCompleted() int64 { if !t.haveInfo() { return 0 } return t.info.TotalLength() - t.bytesLeft() }
go
func (t *Torrent) bytesCompleted() int64 { if !t.haveInfo() { return 0 } return t.info.TotalLength() - t.bytesLeft() }
[ "func", "(", "t", "*", "Torrent", ")", "bytesCompleted", "(", ")", "int64", "{", "if", "!", "t", ".", "haveInfo", "(", ")", "{", "return", "0", "\n", "}", "\n", "return", "t", ".", "info", ".", "TotalLength", "(", ")", "-", "t", ".", "bytesLeft",...
// Don't call this before the info is available.
[ "Don", "t", "call", "this", "before", "the", "info", "is", "available", "." ]
d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb
https://github.com/anacrolix/torrent/blob/d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb/torrent.go#L1162-L1167
train
anacrolix/torrent
torrent.go
deleteConnection
func (t *Torrent) deleteConnection(c *connection) (ret bool) { if !c.closed.IsSet() { panic("connection is not closed") // There are behaviours prevented by the closed state that will fail // if the connection has been deleted. } _, ret = t.conns[c] delete(t.conns, c) torrent.Add("deleted connections", 1) c...
go
func (t *Torrent) deleteConnection(c *connection) (ret bool) { if !c.closed.IsSet() { panic("connection is not closed") // There are behaviours prevented by the closed state that will fail // if the connection has been deleted. } _, ret = t.conns[c] delete(t.conns, c) torrent.Add("deleted connections", 1) c...
[ "func", "(", "t", "*", "Torrent", ")", "deleteConnection", "(", "c", "*", "connection", ")", "(", "ret", "bool", ")", "{", "if", "!", "c", ".", "closed", ".", "IsSet", "(", ")", "{", "panic", "(", "\"", "\"", ")", "\n", "// There are behaviours preve...
// Returns true if connection is removed from torrent.Conns.
[ "Returns", "true", "if", "connection", "is", "removed", "from", "torrent", ".", "Conns", "." ]
d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb
https://github.com/anacrolix/torrent/blob/d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb/torrent.go#L1176-L1190
train
anacrolix/torrent
torrent.go
seeding
func (t *Torrent) seeding() bool { cl := t.cl if t.closed.IsSet() { return false } if cl.config.NoUpload { return false } if !cl.config.Seed { return false } if cl.config.DisableAggressiveUpload && t.needData() { return false } return true }
go
func (t *Torrent) seeding() bool { cl := t.cl if t.closed.IsSet() { return false } if cl.config.NoUpload { return false } if !cl.config.Seed { return false } if cl.config.DisableAggressiveUpload && t.needData() { return false } return true }
[ "func", "(", "t", "*", "Torrent", ")", "seeding", "(", ")", "bool", "{", "cl", ":=", "t", ".", "cl", "\n", "if", "t", ".", "closed", ".", "IsSet", "(", ")", "{", "return", "false", "\n", "}", "\n", "if", "cl", ".", "config", ".", "NoUpload", ...
// Returns whether the client should make effort to seed the torrent.
[ "Returns", "whether", "the", "client", "should", "make", "effort", "to", "seed", "the", "torrent", "." ]
d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb
https://github.com/anacrolix/torrent/blob/d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb/torrent.go#L1228-L1243
train
anacrolix/torrent
torrent.go
startMissingTrackerScrapers
func (t *Torrent) startMissingTrackerScrapers() { if t.cl.config.DisableTrackers { return } t.startScrapingTracker(t.metainfo.Announce) for _, tier := range t.metainfo.AnnounceList { for _, url := range tier { t.startScrapingTracker(url) } } }
go
func (t *Torrent) startMissingTrackerScrapers() { if t.cl.config.DisableTrackers { return } t.startScrapingTracker(t.metainfo.Announce) for _, tier := range t.metainfo.AnnounceList { for _, url := range tier { t.startScrapingTracker(url) } } }
[ "func", "(", "t", "*", "Torrent", ")", "startMissingTrackerScrapers", "(", ")", "{", "if", "t", ".", "cl", ".", "config", ".", "DisableTrackers", "{", "return", "\n", "}", "\n", "t", ".", "startScrapingTracker", "(", "t", ".", "metainfo", ".", "Announce"...
// Adds and starts tracker scrapers for tracker URLs that aren't already // running.
[ "Adds", "and", "starts", "tracker", "scrapers", "for", "tracker", "URLs", "that", "aren", "t", "already", "running", "." ]
d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb
https://github.com/anacrolix/torrent/blob/d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb/torrent.go#L1287-L1297
train
anacrolix/torrent
torrent.go
announceRequest
func (t *Torrent) announceRequest() tracker.AnnounceRequest { // Note that IPAddress is not set. It's set for UDP inside the tracker // code, since it's dependent on the network in use. return tracker.AnnounceRequest{ Event: tracker.None, NumWant: -1, Port: uint16(t.cl.incomingPeerPort()), PeerId: ...
go
func (t *Torrent) announceRequest() tracker.AnnounceRequest { // Note that IPAddress is not set. It's set for UDP inside the tracker // code, since it's dependent on the network in use. return tracker.AnnounceRequest{ Event: tracker.None, NumWant: -1, Port: uint16(t.cl.incomingPeerPort()), PeerId: ...
[ "func", "(", "t", "*", "Torrent", ")", "announceRequest", "(", ")", "tracker", ".", "AnnounceRequest", "{", "// Note that IPAddress is not set. It's set for UDP inside the tracker", "// code, since it's dependent on the network in use.", "return", "tracker", ".", "AnnounceRequest...
// Returns an AnnounceRequest with fields filled out to defaults and current // values.
[ "Returns", "an", "AnnounceRequest", "with", "fields", "filled", "out", "to", "defaults", "and", "current", "values", "." ]
d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb
https://github.com/anacrolix/torrent/blob/d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb/torrent.go#L1301-L1319
train
anacrolix/torrent
torrent.go
consumeDhtAnnouncePeers
func (t *Torrent) consumeDhtAnnouncePeers(pvs <-chan dht.PeersValues) { cl := t.cl for v := range pvs { cl.lock() for _, cp := range v.Peers { if cp.Port == 0 { // Can't do anything with this. continue } t.addPeer(Peer{ IP: cp.IP[:], Port: cp.Port, Source: peerSourceDHTGetPeers,...
go
func (t *Torrent) consumeDhtAnnouncePeers(pvs <-chan dht.PeersValues) { cl := t.cl for v := range pvs { cl.lock() for _, cp := range v.Peers { if cp.Port == 0 { // Can't do anything with this. continue } t.addPeer(Peer{ IP: cp.IP[:], Port: cp.Port, Source: peerSourceDHTGetPeers,...
[ "func", "(", "t", "*", "Torrent", ")", "consumeDhtAnnouncePeers", "(", "pvs", "<-", "chan", "dht", ".", "PeersValues", ")", "{", "cl", ":=", "t", ".", "cl", "\n", "for", "v", ":=", "range", "pvs", "{", "cl", ".", "lock", "(", ")", "\n", "for", "_...
// Adds peers revealed in an announce until the announce ends, or we have // enough peers.
[ "Adds", "peers", "revealed", "in", "an", "announce", "until", "the", "announce", "ends", "or", "we", "have", "enough", "peers", "." ]
d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb
https://github.com/anacrolix/torrent/blob/d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb/torrent.go#L1323-L1340
train
anacrolix/torrent
torrent.go
numTotalPeers
func (t *Torrent) numTotalPeers() int { peers := make(map[string]struct{}) for conn := range t.conns { ra := conn.conn.RemoteAddr() if ra == nil { // It's been closed and doesn't support RemoteAddr. continue } peers[ra.String()] = struct{}{} } for addr := range t.halfOpen { peers[addr] = struct{}{} ...
go
func (t *Torrent) numTotalPeers() int { peers := make(map[string]struct{}) for conn := range t.conns { ra := conn.conn.RemoteAddr() if ra == nil { // It's been closed and doesn't support RemoteAddr. continue } peers[ra.String()] = struct{}{} } for addr := range t.halfOpen { peers[addr] = struct{}{} ...
[ "func", "(", "t", "*", "Torrent", ")", "numTotalPeers", "(", ")", "int", "{", "peers", ":=", "make", "(", "map", "[", "string", "]", "struct", "{", "}", ")", "\n", "for", "conn", ":=", "range", "t", ".", "conns", "{", "ra", ":=", "conn", ".", "...
// The total number of peers in the torrent.
[ "The", "total", "number", "of", "peers", "in", "the", "torrent", "." ]
d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb
https://github.com/anacrolix/torrent/blob/d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb/torrent.go#L1402-L1419
train
anacrolix/torrent
torrent.go
reconcileHandshakeStats
func (t *Torrent) reconcileHandshakeStats(c *connection) { if c.stats != (ConnStats{ // Handshakes should only increment these fields: BytesWritten: c.stats.BytesWritten, BytesRead: c.stats.BytesRead, }) { panic("bad stats") } c.postHandshakeStats(func(cs *ConnStats) { cs.BytesRead.Add(c.stats.BytesRea...
go
func (t *Torrent) reconcileHandshakeStats(c *connection) { if c.stats != (ConnStats{ // Handshakes should only increment these fields: BytesWritten: c.stats.BytesWritten, BytesRead: c.stats.BytesRead, }) { panic("bad stats") } c.postHandshakeStats(func(cs *ConnStats) { cs.BytesRead.Add(c.stats.BytesRea...
[ "func", "(", "t", "*", "Torrent", ")", "reconcileHandshakeStats", "(", "c", "*", "connection", ")", "{", "if", "c", ".", "stats", "!=", "(", "ConnStats", "{", "// Handshakes should only increment these fields:", "BytesWritten", ":", "c", ".", "stats", ".", "By...
// Reconcile bytes transferred before connection was associated with a // torrent.
[ "Reconcile", "bytes", "transferred", "before", "connection", "was", "associated", "with", "a", "torrent", "." ]
d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb
https://github.com/anacrolix/torrent/blob/d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb/torrent.go#L1423-L1436
train
anacrolix/torrent
torrent.go
addConnection
func (t *Torrent) addConnection(c *connection) (err error) { defer func() { if err == nil { torrent.Add("added connections", 1) } }() if t.closed.IsSet() { return errors.New("torrent closed") } for c0 := range t.conns { if c.PeerID != c0.PeerID { continue } if !t.cl.config.dropDuplicatePeerIds { ...
go
func (t *Torrent) addConnection(c *connection) (err error) { defer func() { if err == nil { torrent.Add("added connections", 1) } }() if t.closed.IsSet() { return errors.New("torrent closed") } for c0 := range t.conns { if c.PeerID != c0.PeerID { continue } if !t.cl.config.dropDuplicatePeerIds { ...
[ "func", "(", "t", "*", "Torrent", ")", "addConnection", "(", "c", "*", "connection", ")", "(", "err", "error", ")", "{", "defer", "func", "(", ")", "{", "if", "err", "==", "nil", "{", "torrent", ".", "Add", "(", "\"", "\"", ",", "1", ")", "\n",...
// Returns true if the connection is added.
[ "Returns", "true", "if", "the", "connection", "is", "added", "." ]
d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb
https://github.com/anacrolix/torrent/blob/d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb/torrent.go#L1439-L1475
train
anacrolix/torrent
torrent.go
onIncompletePiece
func (t *Torrent) onIncompletePiece(piece pieceIndex) { if t.pieceAllDirty(piece) { t.pendAllChunkSpecs(piece) } if !t.wantPieceIndex(piece) { // t.logger.Printf("piece %d incomplete and unwanted", piece) return } // We could drop any connections that we told we have a piece that we // don't here. But there...
go
func (t *Torrent) onIncompletePiece(piece pieceIndex) { if t.pieceAllDirty(piece) { t.pendAllChunkSpecs(piece) } if !t.wantPieceIndex(piece) { // t.logger.Printf("piece %d incomplete and unwanted", piece) return } // We could drop any connections that we told we have a piece that we // don't here. But there...
[ "func", "(", "t", "*", "Torrent", ")", "onIncompletePiece", "(", "piece", "pieceIndex", ")", "{", "if", "t", ".", "pieceAllDirty", "(", "piece", ")", "{", "t", ".", "pendAllChunkSpecs", "(", "piece", ")", "\n", "}", "\n", "if", "!", "t", ".", "wantPi...
// Called when a piece is found to be not complete.
[ "Called", "when", "a", "piece", "is", "found", "to", "be", "not", "complete", "." ]
d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb
https://github.com/anacrolix/torrent/blob/d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb/torrent.go#L1580-L1604
train
anacrolix/torrent
torrent.go
reapPieceTouchers
func (t *Torrent) reapPieceTouchers(piece pieceIndex) (ret []*connection) { for c := range t.pieces[piece].dirtiers { delete(c.peerTouchedPieces, piece) ret = append(ret, c) } t.pieces[piece].dirtiers = nil return }
go
func (t *Torrent) reapPieceTouchers(piece pieceIndex) (ret []*connection) { for c := range t.pieces[piece].dirtiers { delete(c.peerTouchedPieces, piece) ret = append(ret, c) } t.pieces[piece].dirtiers = nil return }
[ "func", "(", "t", "*", "Torrent", ")", "reapPieceTouchers", "(", "piece", "pieceIndex", ")", "(", "ret", "[", "]", "*", "connection", ")", "{", "for", "c", ":=", "range", "t", ".", "pieces", "[", "piece", "]", ".", "dirtiers", "{", "delete", "(", "...
// Return the connections that touched a piece, and clear the entries while // doing it.
[ "Return", "the", "connections", "that", "touched", "a", "piece", "and", "clear", "the", "entries", "while", "doing", "it", "." ]
d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb
https://github.com/anacrolix/torrent/blob/d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb/torrent.go#L1641-L1648
train
anacrolix/torrent
torrent.go
queuePieceCheck
func (t *Torrent) queuePieceCheck(pieceIndex pieceIndex) { piece := &t.pieces[pieceIndex] if piece.queuedForHash() { return } t.piecesQueuedForHash.Add(bitmap.BitIndex(pieceIndex)) t.publishPieceChange(pieceIndex) t.updatePiecePriority(pieceIndex) go t.verifyPiece(pieceIndex) }
go
func (t *Torrent) queuePieceCheck(pieceIndex pieceIndex) { piece := &t.pieces[pieceIndex] if piece.queuedForHash() { return } t.piecesQueuedForHash.Add(bitmap.BitIndex(pieceIndex)) t.publishPieceChange(pieceIndex) t.updatePiecePriority(pieceIndex) go t.verifyPiece(pieceIndex) }
[ "func", "(", "t", "*", "Torrent", ")", "queuePieceCheck", "(", "pieceIndex", "pieceIndex", ")", "{", "piece", ":=", "&", "t", ".", "pieces", "[", "pieceIndex", "]", "\n", "if", "piece", ".", "queuedForHash", "(", ")", "{", "return", "\n", "}", "\n", ...
// Currently doesn't really queue, but should in the future.
[ "Currently", "doesn", "t", "really", "queue", "but", "should", "in", "the", "future", "." ]
d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb
https://github.com/anacrolix/torrent/blob/d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb/torrent.go#L1658-L1667
train
anacrolix/torrent
torrent.go
initiateConn
func (t *Torrent) initiateConn(peer Peer) { if peer.Id == t.cl.peerID { return } if t.cl.badPeerIPPort(peer.IP, peer.Port) { return } addr := IpPort{peer.IP, uint16(peer.Port)} if t.addrActive(addr.String()) { return } t.halfOpen[addr.String()] = peer go t.cl.outgoingConnection(t, addr, peer.Source) }
go
func (t *Torrent) initiateConn(peer Peer) { if peer.Id == t.cl.peerID { return } if t.cl.badPeerIPPort(peer.IP, peer.Port) { return } addr := IpPort{peer.IP, uint16(peer.Port)} if t.addrActive(addr.String()) { return } t.halfOpen[addr.String()] = peer go t.cl.outgoingConnection(t, addr, peer.Source) }
[ "func", "(", "t", "*", "Torrent", ")", "initiateConn", "(", "peer", "Peer", ")", "{", "if", "peer", ".", "Id", "==", "t", ".", "cl", ".", "peerID", "{", "return", "\n", "}", "\n", "if", "t", ".", "cl", ".", "badPeerIPPort", "(", "peer", ".", "I...
// Start the process of connecting to the given peer for the given torrent if // appropriate.
[ "Start", "the", "process", "of", "connecting", "to", "the", "given", "peer", "for", "the", "given", "torrent", "if", "appropriate", "." ]
d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb
https://github.com/anacrolix/torrent/blob/d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb/torrent.go#L1677-L1690
train
anacrolix/torrent
torrent.go
allStats
func (t *Torrent) allStats(f func(*ConnStats)) { f(&t.stats) f(&t.cl.stats) }
go
func (t *Torrent) allStats(f func(*ConnStats)) { f(&t.stats) f(&t.cl.stats) }
[ "func", "(", "t", "*", "Torrent", ")", "allStats", "(", "f", "func", "(", "*", "ConnStats", ")", ")", "{", "f", "(", "&", "t", ".", "stats", ")", "\n", "f", "(", "&", "t", ".", "cl", ".", "stats", ")", "\n", "}" ]
// All stats that include this Torrent. Useful when we want to increment // ConnStats but not for every connection.
[ "All", "stats", "that", "include", "this", "Torrent", ".", "Useful", "when", "we", "want", "to", "increment", "ConnStats", "but", "not", "for", "every", "connection", "." ]
d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb
https://github.com/anacrolix/torrent/blob/d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb/torrent.go#L1706-L1709
train
anacrolix/torrent
metainfo/info.go
BuildFromFilePath
func (info *Info) BuildFromFilePath(root string) (err error) { info.Name = filepath.Base(root) info.Files = nil err = filepath.Walk(root, func(path string, fi os.FileInfo, err error) error { if err != nil { return err } if fi.IsDir() { // Directories are implicit in torrent files. return nil } else ...
go
func (info *Info) BuildFromFilePath(root string) (err error) { info.Name = filepath.Base(root) info.Files = nil err = filepath.Walk(root, func(path string, fi os.FileInfo, err error) error { if err != nil { return err } if fi.IsDir() { // Directories are implicit in torrent files. return nil } else ...
[ "func", "(", "info", "*", "Info", ")", "BuildFromFilePath", "(", "root", "string", ")", "(", "err", "error", ")", "{", "info", ".", "Name", "=", "filepath", ".", "Base", "(", "root", ")", "\n", "info", ".", "Files", "=", "nil", "\n", "err", "=", ...
// This is a helper that sets Files and Pieces from a root path and its // children.
[ "This", "is", "a", "helper", "that", "sets", "Files", "and", "Pieces", "from", "a", "root", "path", "and", "its", "children", "." ]
d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb
https://github.com/anacrolix/torrent/blob/d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb/metainfo/info.go#L29-L67
train
anacrolix/torrent
metainfo/info.go
writeFiles
func (info *Info) writeFiles(w io.Writer, open func(fi FileInfo) (io.ReadCloser, error)) error { for _, fi := range info.UpvertedFiles() { r, err := open(fi) if err != nil { return fmt.Errorf("error opening %v: %s", fi, err) } wn, err := io.CopyN(w, r, fi.Length) r.Close() if wn != fi.Length { return...
go
func (info *Info) writeFiles(w io.Writer, open func(fi FileInfo) (io.ReadCloser, error)) error { for _, fi := range info.UpvertedFiles() { r, err := open(fi) if err != nil { return fmt.Errorf("error opening %v: %s", fi, err) } wn, err := io.CopyN(w, r, fi.Length) r.Close() if wn != fi.Length { return...
[ "func", "(", "info", "*", "Info", ")", "writeFiles", "(", "w", "io", ".", "Writer", ",", "open", "func", "(", "fi", "FileInfo", ")", "(", "io", ".", "ReadCloser", ",", "error", ")", ")", "error", "{", "for", "_", ",", "fi", ":=", "range", "info",...
// Concatenates all the files in the torrent into w. open is a function that // gets at the contents of the given file.
[ "Concatenates", "all", "the", "files", "in", "the", "torrent", "into", "w", ".", "open", "is", "a", "function", "that", "gets", "at", "the", "contents", "of", "the", "given", "file", "." ]
d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb
https://github.com/anacrolix/torrent/blob/d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb/metainfo/info.go#L71-L84
train
anacrolix/torrent
metainfo/info.go
UpvertedFiles
func (info *Info) UpvertedFiles() []FileInfo { if len(info.Files) == 0 { return []FileInfo{{ Length: info.Length, // Callers should determine that Info.Name is the basename, and // thus a regular file. Path: nil, }} } return info.Files }
go
func (info *Info) UpvertedFiles() []FileInfo { if len(info.Files) == 0 { return []FileInfo{{ Length: info.Length, // Callers should determine that Info.Name is the basename, and // thus a regular file. Path: nil, }} } return info.Files }
[ "func", "(", "info", "*", "Info", ")", "UpvertedFiles", "(", ")", "[", "]", "FileInfo", "{", "if", "len", "(", "info", ".", "Files", ")", "==", "0", "{", "return", "[", "]", "FileInfo", "{", "{", "Length", ":", "info", ".", "Length", ",", "// Cal...
// The files field, converted up from the old single-file in the parent info // dict if necessary. This is a helper to avoid having to conditionally handle // single and multi-file torrent infos.
[ "The", "files", "field", "converted", "up", "from", "the", "old", "single", "-", "file", "in", "the", "parent", "info", "dict", "if", "necessary", ".", "This", "is", "a", "helper", "to", "avoid", "having", "to", "conditionally", "handle", "single", "and", ...
d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb
https://github.com/anacrolix/torrent/blob/d2400968fc54c3d8a6482d4ca5ff16cc5e5139cb/metainfo/info.go#L142-L152
train
kubernetes-retired/heapster
metrics/util/label_copier.go
makeStoredLabels
func makeStoredLabels(labels []string) map[string]string { storedLabels := make(map[string]string) for _, s := range labels { split := strings.SplitN(s, "=", 2) if len(split) == 1 { storedLabels[split[0]] = split[0] } else { storedLabels[split[1]] = split[0] } } return storedLabels }
go
func makeStoredLabels(labels []string) map[string]string { storedLabels := make(map[string]string) for _, s := range labels { split := strings.SplitN(s, "=", 2) if len(split) == 1 { storedLabels[split[0]] = split[0] } else { storedLabels[split[1]] = split[0] } } return storedLabels }
[ "func", "makeStoredLabels", "(", "labels", "[", "]", "string", ")", "map", "[", "string", "]", "string", "{", "storedLabels", ":=", "make", "(", "map", "[", "string", "]", "string", ")", "\n", "for", "_", ",", "s", ":=", "range", "labels", "{", "spli...
// makeStoredLabels converts labels into a map for quicker retrieval. // Incoming labels, if desired, may contain mappings in format "newName=oldName"
[ "makeStoredLabels", "converts", "labels", "into", "a", "map", "for", "quicker", "retrieval", ".", "Incoming", "labels", "if", "desired", "may", "contain", "mappings", "in", "format", "newName", "=", "oldName" ]
e1e83412787b60d8a70088f09a2cb12339b305c3
https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/util/label_copier.go#L56-L67
train
kubernetes-retired/heapster
metrics/util/label_copier.go
makeIgnoredLabels
func makeIgnoredLabels(labels []string) map[string]string { ignoredLabels := make(map[string]string) for _, s := range labels { ignoredLabels[s] = "" } return ignoredLabels }
go
func makeIgnoredLabels(labels []string) map[string]string { ignoredLabels := make(map[string]string) for _, s := range labels { ignoredLabels[s] = "" } return ignoredLabels }
[ "func", "makeIgnoredLabels", "(", "labels", "[", "]", "string", ")", "map", "[", "string", "]", "string", "{", "ignoredLabels", ":=", "make", "(", "map", "[", "string", "]", "string", ")", "\n", "for", "_", ",", "s", ":=", "range", "labels", "{", "ig...
// makeIgnoredLabels converts label slice into a map for later use.
[ "makeIgnoredLabels", "converts", "label", "slice", "into", "a", "map", "for", "later", "use", "." ]
e1e83412787b60d8a70088f09a2cb12339b305c3
https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/util/label_copier.go#L70-L76
train
kubernetes-retired/heapster
metrics/util/label_copier.go
NewLabelCopier
func NewLabelCopier(separator string, storedLabels, ignoredLabels []string) (*LabelCopier, error) { return &LabelCopier{ labelSeparator: separator, storedLabels: makeStoredLabels(storedLabels), ignoredLabels: makeIgnoredLabels(ignoredLabels), }, nil }
go
func NewLabelCopier(separator string, storedLabels, ignoredLabels []string) (*LabelCopier, error) { return &LabelCopier{ labelSeparator: separator, storedLabels: makeStoredLabels(storedLabels), ignoredLabels: makeIgnoredLabels(ignoredLabels), }, nil }
[ "func", "NewLabelCopier", "(", "separator", "string", ",", "storedLabels", ",", "ignoredLabels", "[", "]", "string", ")", "(", "*", "LabelCopier", ",", "error", ")", "{", "return", "&", "LabelCopier", "{", "labelSeparator", ":", "separator", ",", "storedLabels...
// NewLabelCopier creates a new instance of LabelCopier type
[ "NewLabelCopier", "creates", "a", "new", "instance", "of", "LabelCopier", "type" ]
e1e83412787b60d8a70088f09a2cb12339b305c3
https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/util/label_copier.go#L79-L85
train
kubernetes-retired/heapster
events/sinks/influxdb/influxdb.go
getEventValue
func getEventValue(event *kube_api.Event) (string, error) { // TODO: check whether indenting is required. bytes, err := json.MarshalIndent(event, "", " ") if err != nil { return "", err } return string(bytes), nil }
go
func getEventValue(event *kube_api.Event) (string, error) { // TODO: check whether indenting is required. bytes, err := json.MarshalIndent(event, "", " ") if err != nil { return "", err } return string(bytes), nil }
[ "func", "getEventValue", "(", "event", "*", "kube_api", ".", "Event", ")", "(", "string", ",", "error", ")", "{", "// TODO: check whether indenting is required.", "bytes", ",", "err", ":=", "json", ".", "MarshalIndent", "(", "event", ",", "\"", "\"", ",", "\...
// Generate point value for event
[ "Generate", "point", "value", "for", "event" ]
e1e83412787b60d8a70088f09a2cb12339b305c3
https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/events/sinks/influxdb/influxdb.go#L61-L68
train
kubernetes-retired/heapster
events/sinks/influxdb/influxdb.go
newSink
func newSink(c influxdb_common.InfluxdbConfig) core.EventSink { 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, } }
go
func newSink(c influxdb_common.InfluxdbConfig) core.EventSink { 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, } }
[ "func", "newSink", "(", "c", "influxdb_common", ".", "InfluxdbConfig", ")", "core", ".", "EventSink", "{", "client", ",", "err", ":=", "influxdb_common", ".", "NewClient", "(", "c", ")", "\n", "if", "err", "!=", "nil", "{", "glog", ".", "Errorf", "(", ...
// Returns a thread-safe implementation of core.EventSink for InfluxDB.
[ "Returns", "a", "thread", "-", "safe", "implementation", "of", "core", ".", "EventSink", "for", "InfluxDB", "." ]
e1e83412787b60d8a70088f09a2cb12339b305c3
https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/events/sinks/influxdb/influxdb.go#L230-L239
train
kubernetes-retired/heapster
metrics/sinks/opentsdb/driver.go
metricToPoint
func (tsdbSink *openTSDBSink) metricToPoint(name string, value core.MetricValue, timestamp time.Time, labels map[string]string) opentsdbclient.DataPoint { seriesName := strings.Replace(toValidOpenTsdbName(name), "/", "_", -1) if value.MetricType.String() != "" { seriesName = fmt.Sprintf("%s_%s", seriesName, value....
go
func (tsdbSink *openTSDBSink) metricToPoint(name string, value core.MetricValue, timestamp time.Time, labels map[string]string) opentsdbclient.DataPoint { seriesName := strings.Replace(toValidOpenTsdbName(name), "/", "_", -1) if value.MetricType.String() != "" { seriesName = fmt.Sprintf("%s_%s", seriesName, value....
[ "func", "(", "tsdbSink", "*", "openTSDBSink", ")", "metricToPoint", "(", "name", "string", ",", "value", "core", ".", "MetricValue", ",", "timestamp", "time", ".", "Time", ",", "labels", "map", "[", "string", "]", "string", ")", "opentsdbclient", ".", "Dat...
// timeSeriesToPoint transfers the contents holding in the given pointer of sink_api.Timeseries // into the instance of opentsdbclient.DataPoint
[ "timeSeriesToPoint", "transfers", "the", "contents", "holding", "in", "the", "given", "pointer", "of", "sink_api", ".", "Timeseries", "into", "the", "instance", "of", "opentsdbclient", ".", "DataPoint" ]
e1e83412787b60d8a70088f09a2cb12339b305c3
https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/opentsdb/driver.go#L117-L146
train
kubernetes-retired/heapster
metrics/sinks/opentsdb/driver.go
putDefaultTags
func (tsdbSink *openTSDBSink) putDefaultTags(datapoint *opentsdbclient.DataPoint) { datapoint.Tags[clusterNameTagName] = tsdbSink.clusterName }
go
func (tsdbSink *openTSDBSink) putDefaultTags(datapoint *opentsdbclient.DataPoint) { datapoint.Tags[clusterNameTagName] = tsdbSink.clusterName }
[ "func", "(", "tsdbSink", "*", "openTSDBSink", ")", "putDefaultTags", "(", "datapoint", "*", "opentsdbclient", ".", "DataPoint", ")", "{", "datapoint", ".", "Tags", "[", "clusterNameTagName", "]", "=", "tsdbSink", ".", "clusterName", "\n", "}" ]
// putDefaultTags just fills in the default key-value pair for the tags. // OpenTSDB requires at least one non-empty tag otherwise the OpenTSDB will return error and the operation of putting // datapoint will be failed.
[ "putDefaultTags", "just", "fills", "in", "the", "default", "key", "-", "value", "pair", "for", "the", "tags", ".", "OpenTSDB", "requires", "at", "least", "one", "non", "-", "empty", "tag", "otherwise", "the", "OpenTSDB", "will", "return", "error", "and", "...
e1e83412787b60d8a70088f09a2cb12339b305c3
https://github.com/kubernetes-retired/heapster/blob/e1e83412787b60d8a70088f09a2cb12339b305c3/metrics/sinks/opentsdb/driver.go#L151-L153
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train