Documentation ¶
Overview ¶
Copyright (c) 2016-2019 Uber Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- type LeecherSummaries
- type LeecherSummary
- type Logger
- func (l *Logger) DownloadFailure(namespace string, d core.Digest, size int64, err error)
- func (l *Logger) DownloadSuccess(namespace string, d core.Digest, size int64, downloadTime time.Duration)
- func (l *Logger) IncomingConnectionAccept(d core.Digest, infoHash core.InfoHash, remotePeerID core.PeerID)
- func (l *Logger) IncomingConnectionReject(d core.Digest, infoHash core.InfoHash, remotePeerID core.PeerID, err error)
- func (l *Logger) LeechTimeout(d core.Digest, infoHash core.InfoHash)
- func (l *Logger) LeecherSummaries(d core.Digest, infoHash core.InfoHash, summaries LeecherSummaries) error
- func (l *Logger) OutgoingConnectionAccept(d core.Digest, infoHash core.InfoHash, remotePeerID core.PeerID)
- func (l *Logger) OutgoingConnectionReject(d core.Digest, infoHash core.InfoHash, remotePeerID core.PeerID, err error)
- func (l *Logger) SeedTimeout(d core.Digest, infoHash core.InfoHash)
- func (l *Logger) SeederSummaries(d core.Digest, infoHash core.InfoHash, summaries SeederSummaries) error
- func (l *Logger) Sync()
- type SeederSummaries
- type SeederSummary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LeecherSummaries ¶
type LeecherSummaries []LeecherSummary
LeecherSummaries represents a slice of type LeecherSummary that can be marshalled for logging.
func (LeecherSummaries) MarshalLogArray ¶
func (ls LeecherSummaries) MarshalLogArray(enc zapcore.ArrayEncoder) error
MarshalLogArray marshals a LeecherSummaries slice for logging.
type LeecherSummary ¶
LeecherSummary contains information about piece requests from and pieces sent to a peer.
func (LeecherSummary) MarshalLogObject ¶
func (s LeecherSummary) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject marshals a LeecherSummary for logging.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger wraps structured log entries for important torrent events. These events are intended to be consumed at the cluster level via ELK, and are distinct from the verbose stdout logs of the agent. In particular, Logger bridges host-agnostic metrics to individual hostnames.
For example, if there is a spike in download times, an engineer can cross-reference the spike with the torrent logs in ELK and zero-in on a single host. From there, the engineer can inspect the stdout logs of the host for more detailed information as to why the download took so long.
func NewNopLogger ¶
func NewNopLogger() *Logger
NewNopLogger returns a Logger containing a no-op zap logger for testing purposes.
func (*Logger) DownloadFailure ¶
DownloadFailure logs a failed download.
func (*Logger) DownloadSuccess ¶
func (l *Logger) DownloadSuccess(namespace string, d core.Digest, size int64, downloadTime time.Duration)
DownloadSuccess logs a successful download.
func (*Logger) IncomingConnectionAccept ¶
func (l *Logger) IncomingConnectionAccept( d core.Digest, infoHash core.InfoHash, remotePeerID core.PeerID)
IncomingConnectionAccept logs an accepted incoming connection.
func (*Logger) IncomingConnectionReject ¶
func (l *Logger) IncomingConnectionReject( d core.Digest, infoHash core.InfoHash, remotePeerID core.PeerID, err error)
IncomingConnectionReject logs a rejected incoming connection.
func (*Logger) LeechTimeout ¶
LeechTimeout logs a leeching torrent being torn down due to timeout.
func (*Logger) LeecherSummaries ¶
func (l *Logger) LeecherSummaries( d core.Digest, infoHash core.InfoHash, summaries LeecherSummaries) error
LeecherSummaries logs a summary of the pieces requested by and sent to peers for a torrent.
func (*Logger) OutgoingConnectionAccept ¶
func (l *Logger) OutgoingConnectionAccept( d core.Digest, infoHash core.InfoHash, remotePeerID core.PeerID)
OutgoingConnectionAccept logs an accepted outgoing connection.
func (*Logger) OutgoingConnectionReject ¶
func (l *Logger) OutgoingConnectionReject(d core.Digest, infoHash core.InfoHash, remotePeerID core.PeerID, err error)
OutgoingConnectionReject logs a rejected outgoing connection.
func (*Logger) SeedTimeout ¶
SeedTimeout logs a seeding torrent being torn down due to timeout.
func (*Logger) SeederSummaries ¶
func (l *Logger) SeederSummaries( d core.Digest, infoHash core.InfoHash, summaries SeederSummaries) error
SeederSummaries logs a summary of the pieces requested and received from peers for a torrent.
type SeederSummaries ¶
type SeederSummaries []SeederSummary
SeederSummaries represents a slice of type SeederSummary that can be marshalled for logging.
func (SeederSummaries) MarshalLogArray ¶
func (ss SeederSummaries) MarshalLogArray(enc zapcore.ArrayEncoder) error
MarshalLogArray marshals a SeederSummaries slice for logging.
type SeederSummary ¶
type SeederSummary struct { PeerID core.PeerID RequestsSent int GoodPiecesReceived int DuplicatePiecesReceived int }
SeederSummary contains information about piece requests to and pieces received from a peer.
func (SeederSummary) MarshalLogObject ¶
func (s SeederSummary) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject marshals a SeederSummary for logging.