id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c18100 | Title: title,
Text: text,
Duration: int(duration / time.Millisecond),
Severity: int(sev),
})
} | |
c18101 | return NewTracerWithEverything(options, NewRecorder())
} | |
c18102 | MaxLogsPerSpan: MaxLogsPerSpan}}
ret.textPropagator = &textMapPropagator{ret}
return ret
} | |
c18103 | Timestamp: uint64(span.Start.UnixNano()) / uint64(time.Millisecond),
Duration: uint64(span.Duration) / uint64(time.Millisecond),
Name: "sdk",
Error: span.Error,
Ec: span.Ec,
Lang: "go",
From: sensor.agent.from,
Kind: span.getSpanKindInt(),
Data: data})
if r.testM... | |
c18104 | defer r.RUnlock()
return len(r.spans)
} | |
c18105 |
queuedSpans := make([]jsonSpan, len(r.spans))
copy(queuedSpans, r.spans)
// and clear out the source
r.clearQueuedSpans()
return queuedSpans
} | |
c18106 | {
log.debug("Posting traces failed in send(): ", err)
sensor.agent.reset()
}
}()
}
} | |
c18107 | fmt.Errorf("Character '%s' is not valid Latin-1", char)
}
if err := binary.Write(&buf, binary.BigEndian, uint8(char)); err != nil {
return err
}
}
dataLength := 8 + len(text)
if _, err := c.c.Write(buf.Bytes()[0:dataLength]); err != nil {
return err
}
return nil
} | |
c18108 |
data := []interface{}{
uint8(3),
incrementalByte,
x, y, width, height,
}
for _, val := range data {
if err := binary.Write(&buf, binary.BigEndian, val); err != nil {
return err
}
}
if _, err := c.c.Write(buf.Bytes()[0:10]); err != nil {
return err
}
return nil
} | |
c18109 |
for _, val := range data {
if err := binary.Write(c.c, binary.BigEndian, val); err != nil {
return err
}
}
return nil
} | |
c18110 | if err := binary.Write(&buf, binary.BigEndian, val); err != nil {
return err
}
}
if _, err := c.c.Write(buf.Bytes()[0:6]); err != nil {
return err
}
return nil
} | |
c18111 |
}
var buf bytes.Buffer
for _, val := range data {
if err := binary.Write(&buf, binary.BigEndian, val); err != nil {
return err
}
}
dataLength := 4 + (4 * len(encs))
if _, err := c.c.Write(buf.Bytes()[0:dataLength]); err != nil {
return err
}
c.Encs = encs
return nil
} | |
c18112 | connection
if _, err := c.c.Write(keyEvent[:]); err != nil {
return err
}
// Reset the color map as according to RFC.
var newColorMap [256]Color
c.ColorMap = newColorMap
return nil
} | |
c18113 | var messageType uint8
if err := binary.Read(c.c, binary.BigEndian, &messageType); err != nil {
break
}
msg, ok := typeMap[messageType]
if !ok {
// Unsupported message type! Bad!
break
}
parsedMsg, err := msg.Read(c, c.c)
if err != nil {
break
}
if c.config.ServerMessageCh == nil {
... | |
c18114 | {
hostname = "localhost"
}
return sc, hostname, err
} | |
c18115 | if hostname == "" {
hostname = c.LocalAddr().String()
}
}
return sc, hostname, err
} | |
c18116 | if hostname == "" {
hostname = c.LocalAddr().String()
}
}
return sc, hostname, err
} | |
c18117 | if hostname == "" {
hostname = c.LocalAddr().String()
}
}
return sc, hostname, err
} | |
c18118 | w.conn
w.mu.RUnlock()
return conn
} | |
c18119 | w.conn = c
w.mu.Unlock()
} | |
c18120 |
conn, hostname, err = dialer.Call()
if err == nil {
w.setConn(conn)
w.hostname = hostname
return conn, nil
} else {
return nil, err
}
} | |
c18121 | return w.writeAndRetryWithPriority(p, string(b))
} | |
c18122 | severityMask)
return w.writeAndRetryWithPriority(pr, s)
} | |
c18123 |
}
}
var err error
if conn, err = w.connect(); err != nil {
return 0, err
}
return w.write(conn, p, s)
} | |
c18124 |
// Note: return the length of the input, not the number of
// bytes printed by Fprintf, because this must behave like
// an io.Writer.
return len(msg), nil
} | |
c18125 | formattedMessage := framer(formatter(p, hostname, tag, msg))
_, err := n.conn.Write([]byte(formattedMessage))
return err
} | |
c18126 | fmt.Sprintf("<%d>%s %s[%d]: %s",
p, timestamp, tag, os.Getpid(), content)
return msg
} | |
c18127 | return s[len(s) - max:]
}
return s
} | |
c18128 | fmt.Sprintf("<%d>%d %s %s %s %d %s - %s",
p, 1, timestamp, hostname, appName, pid, tag, content)
return msg
} | |
c18129 | return DialWithTLSConfig(network, raddr, priority, tag, nil)
} | |
c18130 | error) {
if customDial == nil {
return nil, ErrNilDialFunc
}
return dialAllParameters(network, raddr, priority, tag, nil, customDial)
} | |
c18131 |
serverCert, err := ioutil.ReadFile(certPath)
if err != nil {
return nil, err
}
return DialWithTLSCert(network, raddr, priority, tag, serverCert)
} | |
c18132 | RootCAs: pool,
}
return DialWithTLSConfig(network, raddr, priority, tag, &config)
} | |
c18133 |
return dialAllParameters(network, raddr, priority, tag, tlsConfig, nil)
} | |
c18134 | tag,
hostname: hostname,
network: network,
raddr: raddr,
tlsConfig: tlsConfig,
customDial: customDial,
}
_, err := w.connect()
if err != nil {
return nil, err
}
return w, err
} | |
c18135 | {
return nil, err
}
return log.New(s, "", logFlag), nil
} | |
c18136 | logTypes {
for _, path := range logPaths {
conn, err := net.Dial(network, path)
if err != nil {
continue
} else {
return &localConn{conn: conn}, nil
}
}
}
return nil, errors.New("Unix syslog delivery error")
} | |
c18137 |
return "", ErrNoSocket
}
if !path.IsAbs(socket) {
return "", ErrNoSocket
}
if socket != "" {
return socket, nil
}
return "", ErrNoSocket
} | |
c18138 | socket, err = GetSocketFromProcessList(ctx)
if err != nil {
socket, err = GetSocketFromNetstat(ctx)
}
}
return socket, err
} | |
c18139 |
class, ok := a.classes[id]
if !ok {
class = NewClass(id, fingerprint, a.samples)
a.classes[id] = class
}
class.AddEvent(event, outlier)
} | |
c18140 | class.Example.Ts = t.Add(a.utcOffset).Format("2006-01-02 15:04:05")
}
}
}
return Result{
Global: a.global,
Class: a.classes,
RateLimit: a.rateLimit,
}
} | |
c18141 | false,
inQuery: false,
headerLines: 0,
queryLines: 0,
lineOffset: 0,
bytesRead: opt.StartOffset,
event: log.NewEvent(),
}
return p
} | |
c18142 |
}
p.stopChan <- true
return
} | |
c18143 | fmt.Println()
l.Printf("+%d line: %s", p.lineOffset, line)
}
// Filter out meta lines:
// /usr/local/bin/mysqld, Version: 5.6.15-62.0-tokudb-7.1.0-tokudb-log (binary). started with:
// Tcp port: 3306 Unix socket: /var/lib/mysql/mysql.sock
// Time Id Command Argument
if lineL... | |
c18144 | Fingerprint: fingerprint,
Metrics: NewMetrics(),
TotalQueries: 0,
Example: &Example{},
sample: sample,
}
return class
} | |
c18145 | c.Example.QueryTime = float64(n)
c.Example.Size = len(e.Query)
if e.Db != "" {
c.Example.Db = e.Db
} else {
c.Example.Db = c.lastDb
}
if len(e.Query) > MaxExampleBytes {
c.Example.Query = e.Query[0:MaxExampleBytes-len(TruncatedExampleSuffix)] + TruncatedExampleSuffix
} else {
... | |
c18146 | if Uint64Value(newStats.Min) < Uint64Value(stats.Min) || stats.Min == nil {
stats.Min = newStats.Min
}
if Uint64Value(newStats.Max) > Uint64Value(stats.Max) || stats.Max == nil {
stats.Max = newStats.Max
}
}
}
for newMetric, newStats := range newClass.Metrics.BoolMetrics {
stats, ok := c.Metr... | |
c18147 | = (c.TotalQueries * rateLimit) + c.outliers
c.Metrics.Finalize(rateLimit, c.TotalQueries)
if c.Example.QueryTime == 0 {
c.Example = nil
}
} | |
c18148 |
event.NumberMetrics = make(map[string]uint64)
event.BoolMetrics = make(map[string]bool)
return event
} | |
c18149 | fmt.Sprintf("%x", id.Sum(nil))
return strings.ToUpper(h[16:32])
} | |
c18150 |
BoolMetrics: make(map[string]*BoolStats),
}
return m
} | |
c18151 | e.NumberMetrics {
stats, seenMetric := m.NumberMetrics[metric]
if !seenMetric {
m.NumberMetrics[metric] = &NumberStats{
vals: []uint64{},
}
stats = m.NumberMetrics[metric]
}
if outlier {
stats.outlierSum += val
} else {
stats.Sum += val
}
stats.vals = append(stats.vals, val)
}
for m... | |
c18152 | Uint64(s.vals[0])
s.Med = Uint64(s.vals[(50*cnt)/100]) // median = 50th percentile
s.P95 = Uint64(s.vals[(95*cnt)/100])
s.Max = Uint64(s.vals[cnt-1])
s.Sum = (s.Sum * uint64(rateLimit)) + s.outlierSum
s.Avg = Uint64(s.Sum / uint64(totalQueries))
}
for _, s := range m.BoolMetrics {
s.Sum = (s.Sum * uint6... | |
c18153 |
return "DHT22|AM2302"
} else {
return "!!! unknown !!!"
}
} | |
c18154 | v == DHT22 || v == AM2302 {
return 18 * time.Millisecond
} else {
return 0
}
} | |
c18155 | err
}
defer C.free(unsafe.Pointer(arr))
// convert original C array arr to Go slice list
h := (*reflect.SliceHeader)(unsafe.Pointer(&list))
h.Data = uintptr(unsafe.Pointer(arr))
h.Len = int(arrLen)
h.Cap = int(arrLen)
pulses := make([]Pulse, len(list)/2)
// convert original int array ([pulse, duration, pulse,... | |
c18156 | is bit 0, bigger - bit 1.
// const HIGH_LOW_DUR_AVG = (24 + (70-24)/2) * time.Microsecond
if pulseH.Duration > HIGH_DUR_MAX {
return 0, fmt.Errorf("High edge value duration %v exceed "+
"maximum expected %v", pulseH.Duration, HIGH_DUR_MAX)
}
if pulseH.Duration > HIGH_LOW_DUR_AVG {
//fmt.Printf("bit %... | |
c18157 |
if err != nil {
return
}
masks = append(masks, *network)
}
return
} | |
c18158 | mask := range masks {
if mask.Contains(ip) {
return true
}
}
return false
} | |
c18159 | {
return false
}
return !ipInMasks(ip, privateMasks)
} | |
c18160 | IP := net.ParseIP(ip); IP != nil && IsPublicIP(IP) {
return ip
}
}
return ""
} | |
c18161 | GetRemoteAddrIfAllowed(r, func(sip string) bool { return true })
} | |
c18162 | {
if xip := Parse(xffh); xip != "" {
return net.JoinHostPort(xip, sport)
}
}
}
}
return r.RemoteAddr
} | |
c18163 | allowedMasks,
}
if options.Debug {
xff.Log = log.New(os.Stdout, "[xff] ", log.LstdFlags)
}
return xff, nil
} | |
c18164 | http.ResponseWriter, r *http.Request) {
r.RemoteAddr = GetRemoteAddrIfAllowed(r, xff.allowed)
h.ServeHTTP(w, r)
})
} | |
c18165 | r.RemoteAddr = GetRemoteAddrIfAllowed(r, xff.allowed)
next(w, r)
} | |
c18166 | && ipInMasks(ip, xff.allowedMasks) {
return true
}
return false
} | |
c18167 | t.Error(Scolorf(ErrorColorSyntaxCode, format, args...))
} | |
c18168 | t.Fatal(Scolorf(FatalColorSyntaxCode, format, args...))
} | |
c18169 | {
if len(k) > 0 {
buffer.WriteString(fmt.Sprintf("%s : %v\n", k, strings.Join(v, ",")))
}
}
if resp.Body != nil {
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
if resp.StatusCode/100 == 3 {
// redirect closes body ; nothing to read
buffer.WriteString("\n")
} else {
buffer.WriteS... | |
c18170 |
for _, other := range env {
if each == other {
return
}
}
}
t.Skipf("skipped because provided LABELS=%v does not include any of %v", env, labels)
} | |
c18171 | {
if l.InfoEnabled {
LoggingPrintf("\tinfo : "+tabify(format)+"\n", args...)
}
} | |
c18172 | args...)
}
if l.ExitOnFatal {
os.Exit(1)
}
} | |
c18173 | to receive err: %v", err))
}
return err != nil
} | |
c18174 | {
logerror(t, serrorf("ExpectHeader: got header %s=%s but want %s", name, rname, value))
}
return rname == value
} | |
c18175 | // put the body back for re-reads
r.Body = ioutil.NopCloser(bytes.NewReader(data))
dict := map[string]interface{}{}
err = json.Unmarshal(data, &dict)
if err != nil {
if verboseOnFailure {
Dump(t, r)
}
logerror(t, serrorf("ExpectJSONHash: unable to unmarshal Json:%v", err))
return false
}
callback(dic... | |
c18176 | // put the body back for re-reads
r.Body = ioutil.NopCloser(bytes.NewReader(data))
slice := []interface{}{}
err = json.Unmarshal(data, &slice)
if err != nil {
if verboseOnFailure {
Dump(t, r)
}
logerror(t, serrorf("ExpectJSONArray: unable to unmarshal Json:%v", err))
return false
}
callback(slice)
r... | |
c18177 | serrorf("ExpectString: unable to read response body:%v", err))
return false
}
// put the body back for re-reads
r.Body = ioutil.NopCloser(bytes.NewReader(data))
callback(string(data))
return true
} | |
c18178 | url.Values{},
}
cfg.Path(pathTemplate, pathParams...)
return cfg
} | |
c18179 | *RequestConfig)) *RequestConfig {
block(r)
return r
} | |
c18180 | *RequestConfig {
r.Values.Add(name, fmt.Sprintf("%v", value))
return r
} | |
c18181 | *RequestConfig {
r.HeaderMap.Add(name, value)
return r
} | |
c18182 | strings.NewReader(body)
return r
} | |
c18183 | *RequestConfig {
r.BodyReader = bodyReader
return r
} | |
c18184 | err = tmp.Execute(&buf, value)
if err != nil {
logfatal(t, sfatalf("failed to execute template:%v", err))
return ""
}
return buf.String()
} | |
c18185 | := tp.Field(i).Name
f := iv.Field(i)
ms[k] = valueToString(f)
}
return ms
} | |
c18186 | []string{strconv.FormatUint(f.Uint(), 10)}
case reflect.Float32:
v = []string{strconv.FormatFloat(f.Float(), 'f', 4, 32)}
case reflect.Float64:
v = []string{strconv.FormatFloat(f.Float(), 'f', 4, 64)}
case reflect.Bool:
v = []string{strconv.FormatBool(f.Bool())}
case reflect.Slice:
for i := 0; i < f.Len();... | |
c18187 | return s.Send(from, to, MessageParams{Body: body})
} | |
c18188 | UserAgent: userAgent,
BaseURL: baseURL,
AccountSid: accountSid,
AuthToken: authToken,
}
c.Messages = &MessageService{client: c}
return c
} | |
c18189 |
buf = make([]uint64, n)
default:
return nil, 0, fmt.Errorf("tag %d isn't an int type", tag)
}
if err := binary.Read(bytes.NewReader(ent.contents), binary.BigEndian, buf); err != nil {
return nil, 0, err
}
return
} | |
c18190 |
if v > (1<<31)-1 {
return nil, fmt.Errorf("value %d out of range for int32 array in tag %d", i, tag)
}
out[i] = int(v)
}
default:
return nil, fmt.Errorf("tag %d is too big for int type", tag)
}
return out, nil
} | |
c18191 | i, v := range bvals {
out[i] = uint32(v)
}
default:
return nil, fmt.Errorf("tag %d is too big for int type", tag)
}
return out, nil
} | |
c18192 | for i, v := range bvals {
out[i] = uint64(v)
}
case []uint32:
for i, v := range bvals {
out[i] = uint64(v)
}
}
return out, nil
} | |
c18193 | return hdr.GetUint64s(longTag)
} else {
return hdr.GetUint64s(intTag)
}
} | |
c18194 | err != nil {
return -1, err
}
return int64(u), nil
} | |
c18195 |
if err != nil {
return -1, err
} else if len(u) != 1 {
return -1, errors.New("incorrect number of values")
}
return int64(u[0]), err
} | |
c18196 | err := makeSignature(payloadTee, key, opts)
if err != nil {
return
}
if !checkMd5(sigHeader, payloadDigest) {
return nil, errors.New("md5 digest mismatch")
}
sigRsa, err := makeSignature(bytes.NewReader(genHeaderBlob), key, opts)
if err != nil {
return
}
insertSignatures(sigHeader, sigPgp, sigRsa)
retur... | |
c18197 | delete(header.sigHeader.entries, SIG_RESERVEDSPACE-_SIGHEADER_TAG_BASE)
return writeRpm(infile, outstream, header.sigHeader)
} | |
c18198 |
}
if len(b) > 2 && b[0] == 0x1f && b[1] == 0x8b {
compression = "gzip"
} else {
compression = "uncompressed"
}
}
switch compression {
case "gzip":
return gzip.NewReader(r)
case "bzip2":
return bzip2.NewReader(r), nil
case "lzma", "xz":
return xz.NewReader(r, 0)
case "uncompressed":
return ... | |
c18199 | return Vercmp(vs[i], vs[j]) == -1
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.