id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c13400 |
}
case setTypeName:
if err := w.wm.sets[other.MetricKey].Combine(other.Value); err != nil {
log.WithError(err).Error("Could not merge sets")
}
case histogramTypeName:
if err := w.wm.histograms[other.MetricKey].Combine(other.Value); err != nil {
log.WithError(err).Error("Could not merge histograms")
}... | |
c13401 | metricpb.Type_Timer:
if other.Scope == metricpb.Scope_Mixed {
w.wm.timers[key].Merge(v.Histogram)
} else if other.Scope == metricpb.Scope_Global {
w.wm.globalTimers[key].Merge(v.Histogram)
}
}
case nil:
err = errors.New("Can't import a metric with a nil value")
default:
err = fmt.Errorf("Unkno... | |
c13402 |
w.mutex.Lock()
ret := w.wm
processed := w.processed
imported := w.imported
w.wm = wm
w.processed = 0
w.imported = 0
w.mutex.Unlock()
w.stats.Count("worker.metrics_processed_total", processed, []string{}, 1.0)
w.stats.Count("worker.metrics_imported_total", imported, []string{}, 1.0)
return ret
} | |
c13403 | &sync.Mutex{},
traceClient: cl,
stats: stats,
}
} | |
c13404 | append(ew.samples, s)
ew.mutex.Unlock()
}
}
} | |
c13405 | ew.stats.Count("worker.other_samples_flushed_total", int64(len(retsamples)), nil, 1.0)
}
return retsamples
} | |
c13406 | sinks: sinks,
sinkTags: tags,
commonTags: commonTags,
cumulativeTimes: make([]int64, len(sinks)),
traceClient: cl,
statsd: statsd,
}
} | |
c13407 | 0)) * time.Nanosecond
tw.statsd.Timing(sinks.MetricKeySpanIngestDuration, cumulative, tags, 1.0)
}
metrics.Report(tw.traceClient, samples)
tw.statsd.Count("worker.span.hit_chan_cap", atomic.SwapInt64(&tw.capCount, 0), nil, 1.0)
tw.statsd.Count("worker.ssf.empty_total", atomic.SwapInt64(&tw.emptySSFCount, 0), ni... | |
c13408 | if err != nil {
return c, err
}
defer f.Close()
c, err = readProxyConfig(f)
c.applyDefaults()
return
} | |
c13409 | time.ParseDuration(c.Interval)
} | |
c13410 | "errorType": reflect.TypeOf(err),
"numDestinations": len(destinations),
}).Error("Discoverer found zero destinations and/or returned an error. Destinations may be stale!")
samples.Add(ssf.Count("discoverer.errors", 1, srvTags))
// Return since we got no hosts. We don't want to zero out the list. This
... | |
c13411 | jm)
}
// nb The response has already been returned at this point, because we
wg := sync.WaitGroup{}
wg.Add(len(jsonMetricsByDestination)) // Make our waitgroup the size of our destinations
for dest, batch := range jsonMetricsByDestination {
go p.doPost(ctx, &wg, dest, batch)
}
wg.Wait() // Wait for all the ... | |
c13412 | in the array,
// and sort the array by the hashes
sortedIter := newJSONMetricsByWorker(jsonMetrics, len(s.Workers))
for sortedIter.Next() {
nextChunk, workerIndex := sortedIter.Chunk()
s.Workers[workerIndex].ImportChan <- nextChunk
}
metrics.ReportOne(s.TraceClient, ssf.Timing("import.response_duration_ns", t... | |
c13413 | {
ret := &jsonMetricsByWorker{
sjm: newSortableJSONMetrics(metrics, numWorkers),
}
sort.Sort(ret.sjm)
return ret
} | |
c13414 | exit := sss.submitBatch(ctx, sync, ready)
if exit {
return
}
}
} | |
c13415 | w, err := hecReq.Start(ctx)
if err != nil {
cancel()
return nil, nil, nil, err
}
// At this point, we have a workable HTTP connection;
// open it in the background:
go sss.makeHTTPRequest(req, cancel)
return cancel, hecReq, w, nil
} | |
c13416 | {
err := enc.Encode(ev)
select {
case encodeErrors <- err:
case <-ctx.Done():
}
}()
select {
case <-ctx.Done():
return ctx.Err()
case err := <-encodeErrors:
return err
}
} | |
c13417 | ),
ssf.Count(
sinks.MetricKeyTotalSpansSkipped,
float32(atomic.SwapUint32(&sss.skippedSpans, 0)),
map[string]string{"sink": sss.Name()},
),
)
metrics.Report(sss.traceClient, samples)
} | |
c13418 | one client
if lightstepMultiplexTracerNum <= 0 {
lightstepMultiplexTracerNum = 1
}
tracers := make([]opentracing.Tracer, 0, lightstepMultiplexTracerNum)
plaintext := false
if host.Scheme == "http" {
plaintext = true
}
for i := 0; i < lightstepMultiplexTracerNum; i++ {
tracers = append(tracers, lightste... | |
c13419 | flag error spans.
ext.Error.Set(sp, true)
}
endTime := time.Unix(ssfSpan.EndTimestamp/1e9, ssfSpan.EndTimestamp%1e9)
finishOpts := opentracing.FinishOptions{FinishTime: endTime}
sp.FinishWithOptions(finishOpts)
service := ssfSpan.Service
if service == "" {
service = "unknown"
}
count, ok := ls.serviceCo... | |
c13420 | Lightstep client")
return true
}
value, ok := valueI.(*int64)
if !ok {
ls.log.WithFields(logrus.Fields{
"value": valueI,
"type": reflect.TypeOf(valueI),
}).Error("Invalid value type in map when flushing Lightstep client")
return true
}
count := atomic.SwapInt64(value, 0)
totalCount +... | |
c13421 | if err != nil {
return nil, err
}
return &Consul{
ConsulHealth: consulClient.Health(),
}, nil
} | |
c13422 |
m.workers[metric.Digest%uint32(len(m.workers))].IngestUDP(metric)
}
} | |
c13423 | {
return err
}
// If we made it here, we are dealing with a fully-fledged
// trace span, not just a mere carrier for Samples:
indicatorMetrics, err := samplers.ConvertIndicatorMetrics(span, m.indicatorSpanTimerName, m.objectiveSpanTimerName)
if err != nil {
m.log.WithError(err).
WithField("span_name", spa... | |
c13424 | return nil, err
}
if err := serverConn.SetReadBuffer(recvBuf); err != nil {
return nil, err
}
return serverConn, nil
} | |
c13425 |
defer f.Close()
if err != nil {
return fmt.Errorf("couldn't open %s for appending: %s", p.FilePath, err)
}
appendToWriter(f, metrics, p.hostname, p.interval)
return nil
} | |
c13426 | return true
case *errFrameLength:
return true
}
return false
} | |
c13427 | }
s.Batch = append(s.Batch, sample...)
} | |
c13428 |
return func(s *SSFSample) {
s.Timestamp = ts.UnixNano()
}
} | |
c13429 | resolutions[resolution]; ok {
s.Unit = unit
}
}
} | |
c13430 | name,
Value: value,
Tags: tags,
SampleRate: 1.0,
}, opts)
} | |
c13431 | name,
Value: value,
Tags: tags,
SampleRate: 1.0,
}, opts)
} | |
c13432 | name,
Message: value,
Tags: tags,
SampleRate: 1.0,
}, opts)
} | |
c13433 | name,
Status: state,
Tags: tags,
SampleRate: 1.0,
}, opts)
} | |
c13434 | return true
}
return metric.Sinks.RouteTo(sink.Name())
} | |
c13435 |
sampledCDF := floatCDF(allSamples, sampledMean)
// this csv is equivalent to errors.csv from dunning's tests, but
// instead of testing a fixed range of quantiles, we test every centroid
centroidErrors.Write(stringifySlice(
distname,
run,
centroid.Mean,
realMean, // this column is equivalent to th... | |
c13436 | ok bool) {
m.RLock()
conn, ok = m.conns[dest]
m.RUnlock()
return
} | |
c13437 |
if !ok && err == nil {
m.conns[dest] = conn
}
m.Unlock()
if ok && err == nil {
_ = conn.Close()
}
return err
} | |
c13438 | = conn.Close()
}
delete(m.conns, dest)
m.Unlock()
} | |
c13439 |
res = append(res, k)
}
m.RUnlock()
return res
} | |
c13440 |
m.conns = make(map[string]*grpc.ClientConn)
m.Unlock()
} | |
c13441 | err))
}
httpSink := sfxclient.NewHTTPSink()
httpSink.AuthToken = apiKey
httpSink.DatapointEndpoint = baseURL.ResolveReference(datapointURL).String()
httpSink.EventEndpoint = baseURL.ResolveReference(eventURL).String()
httpSink.Client = client
return httpSink
} | |
c13442 | &SignalFxSink{
defaultClient: client,
clientsByTagValue: perTagClients,
hostnameTag: hostnameTag,
hostname: hostname,
commonDimensions: commonDimensions,
log: log,
varyBy: varyBy,
metricNamePrefixDrops: metricNamePrefixDrops,
me... | |
c13443 | error {
sfx.traceClient = traceClient
return nil
} | |
c13444 | ok {
return cl
}
return sfx.defaultClient
} | |
c13445 | []*datapoint.Datapoint{},
pointsByKey: map[string][]*datapoint.Datapoint{},
}
} | |
c13446 | }
}
}
if countSuccess > 0 {
span.Add(ssf.Count(sinks.EventReportedCount, float32(countSuccess), successSpanTags))
}
if countFailed > 0 {
span.Add(ssf.Count(sinks.EventReportedCount, float32(countFailed), failureSpanTags))
}
} | |
c13447 |
}
// we want to keep track of this, because it's a client problem, but still
// handle the span normally
if span.Id == 0 {
reason := "reason:" + "empty_id"
s.Statsd.Count("ssf.error_total", 1, []string{"ssf_format:packet", "packet_type:ssf_metric", reason}, 1.0)
log.WithError(err).Warn("ParseSSF")
}
s.han... | |
c13448 | reading from UDP metrics socket")
continue
}
s.processMetricPacket(n, buf, packetPool)
}
} | |
c13449 | samplers.NewSplitBytes(buf[:numBytes], '\n')
for splitPacket.Next() {
s.HandleMetricPacket(splitPacket.Chunk())
}
// the Metric struct created by HandleMetricPacket has no byte slices in it,
// only strings
// therefore there are no outstanding references to this byte slice, we
// can return it to the pool
p... | |
c13450 |
select {
case <-s.shutdown:
log.WithError(err).Info("Ignoring ReadFrom error while shutting down")
return
default:
log.WithError(err).Error("Error reading packet from Unix domain socket")
continue
}
}
s.processMetricPacket(n, buf, packetPool)
}
} | |
c13451 | buf := packetPool.Get().([]byte)
n, _, err := serverConn.ReadFrom(buf)
if err != nil {
// In tests, the probably-best way to
// terminate this reader is to issue a shutdown and close the listening
// socket, which returns an error, so let's handle it here:
select {
case <-s.shutdown:
log.WithEr... | |
c13452 | down")
return
default:
log.WithError(err).Fatal("TCP accept failed")
}
}
go s.handleTCPGoroutine(conn)
}
} | |
c13453 | // when *not* running under einhorn.
graceful.AddSignal(syscall.SIGUSR2, syscall.SIGHUP)
graceful.HandleSignals()
gracefulSocket := graceful.WrapListener(httpSocket)
log.WithField("address", s.HTTPAddr).Info("HTTP server listening")
// Signal that the HTTP server is starting
atomic.AddInt32(s.numListeningHTTP, ... | |
c13454 | s.pluginMtx.Unlock()
s.plugins = append(s.plugins, p)
} | |
c13455 | t.Truncate(interval).Add(interval).Sub(t)
} | |
c13456 | "sink": sink.Name(),
"excludedTags": excludedTags,
}).Debug("Setting excluded tags on sink")
s.SetExcludedTags(excludedTags)
}
}
} | |
c13457 | 0 &&
span.EndTimestamp != 0 &&
span.Name != ""
} | |
c13458 | return &InvalidTrace{span}
}
return nil
} | |
c13459 | {
return 0, &errFramingIO{err}
}
if err = binary.Write(out, binary.BigEndian, uint32(len(pbuf.Bytes()))); err != nil {
return 0, &errFramingIO{err}
}
n, err := out.Write(pbuf.Bytes())
if err != nil {
return n, &errFramingIO{err}
}
return n, nil
} | |
c13460 |
interval: interval,
flushMaxPerBody: flushMaxPerBody,
hostname: hostname,
tags: tags,
log: log,
}, nil
} | |
c13461 | ((len(ddmetrics) - 1) / dd.flushMaxPerBody) + 1
chunkSize := ((len(ddmetrics) - 1) / workers) + 1
dd.log.WithField("workers", workers).Debug("Worker count chosen")
dd.log.WithField("chunkSize", chunkSize).Debug("Chunk size chosen")
var wg sync.WaitGroup
flushStart := time.Now()
for i := 0; i < workers; i++ {
c... | |
c13462 | bufferSize,
buffer: ring.New(bufferSize),
mutex: &sync.Mutex{},
traceAddress: address,
log: log,
}, nil
} | |
c13463 | }
dd.mutex.Lock()
defer dd.mutex.Unlock()
dd.buffer.Value = span
dd.buffer = dd.buffer.Next()
return nil
} | |
c13464 |
cl.cap = n
return nil
}
} | |
c13465 | cl.backendParams != nil {
cl.backendParams.bufferSize = size
return nil
}
return ErrClientNotNetworked
}
} | |
c13466 | time.NewTicker(interval)
return FlushChannel(t.C, t.Stop)
} | |
c13467 | for {
select {
case <-ch:
_ = Flush(cl)
case <-ctx.Done():
return
}
}
}
return nil
}
} | |
c13468 | cl.backendParams.maxBackoff = t
return nil
}
return ErrClientNotNetworked
}
} | |
c13469 | return ErrClientNotNetworked
}
cl.nBackends = nBackends
return nil
}
} | |
c13470 | = spanChan
for _, opt := range opts {
if err := opt(cl); err != nil {
return nil, err
}
}
ctx := context.Background()
ctx, cl.cancel = context.WithCancel(ctx)
cl.run(ctx)
return cl, nil
} | |
c13471 | closed so it does not leak connections
if oldClient != nil {
oldClient.Close()
}
} | |
c13472 | client.records = nil
client.spans = nil
client.flushBackends = []flushNotifier{}
} | |
c13473 | atomic.AddInt64(&cl.successfulRecords, 1)
if done != nil {
go func() { done <- nil }()
}
return nil
case cl.records <- op:
atomic.AddInt64(&cl.successfulRecords, 1)
return nil
default:
}
atomic.AddInt64(&cl.failedRecords, 1)
return ErrWouldBlock
} | |
c13474 | 0, sizeBound),
tempCentroids: make([]Centroid, 0, estimateTempBuffer(compression)),
min: math.Inf(+1),
max: math.Inf(-1),
debug: debug,
}
} | |
c13475 | // Initialize the weight to the sum of the weights of the centroids
td.mainWeight = 0
for _, c := range td.mainCentroids {
td.mainWeight += c.Weight
}
return td
} | |
c13476 | / value) * weight
next := Centroid{
Mean: value,
Weight: weight,
}
if td.debug {
next.Samples = []float64{value}
}
td.tempCentroids = append(td.tempCentroids, next)
td.tempWeight += weight
} | |
c13477 | // the next main centroid at the end
// this copy is probably the most expensive part of the
// in-place merge, compared to merging into a separate buffer
copy(swappedCentroids, swappedCentroids[1:])
swappedCentroids[len(swappedCentroids)-1] = actualMainCentroids[0]
}
actualMainCentroids = ... | |
c13478 | return td.compression * ((math.Asin(2*quantile-1) / math.Pi) + 0.5)
} | |
c13479 | <= weightSoFar+c.Weight {
// the target quantile is somewhere inside this centroid
// we compute how much of this centroid's weight falls into the quantile
proportion := (q - weightSoFar) / c.Weight
// and interpolate what value that corresponds to inside a uniform
// distribution
return lowerBound +... | |
c13480 | }
// we did not merge other's temps, so we need to add those too
// they're unsorted so there's no need to shuffle them
for i := range other.tempCentroids {
td.Add(other.tempCentroids[i].Mean, other.tempCentroids[i].Weight)
}
td.reciprocalSum = oldReciprocalSum + other.reciprocalSum
} | |
c13481 |
panic("must enable debug to call Centroids()")
}
td.mergeAllTemps()
return td.mainCentroids
} | |
c13482 | the original percentile list here.
// remember that both the global veneur and the local instances have
// 'local-only' histograms.
ms.totalLocalSets + (ms.totalLocalTimers+ms.totalLocalHistograms)*(s.HistogramAggregates.Count+len(s.HistogramPercentiles))
// Global instances also flush sets and global counters... | |
c13483 | ok &&
(statErr.Message() == "all SubConns are in TransientFailure" || statErr.Message() == "transport is closing") {
// We could check statErr.Code() == codes.Unavailable, but we don't know all of the cases that
// could return that code. These two particular cases are fairly safe and usually associated
//... | |
c13484 |
}
err = xpath.Evaluate(nodePtr, xpathExpr)
if err != nil {
return
}
nodes, err = xpath.ResultAsNodeset()
return
} | |
c13485 | int(nodesetPtr.nodeNr); nodesetSize > 0 {
nodes = make([]unsafe.Pointer, nodesetSize)
for i := 0; i < nodesetSize; i++ {
nodes[i] = unsafe.Pointer(C.fetchNode(nodesetPtr, C.int(i)))
}
}
}
return
} | |
c13486 | val = C.GoString((*C.char)(unsafe.Pointer(xpath.ResultPtr.stringval)))
return
} | |
c13487 | xpath.ResultPtr = C.xmlXPathConvertNumber(xpath.ResultPtr)
}
val = float64(xpath.ResultPtr.floatval)
return
} | |
c13488 | = C.xmlXPathConvertBoolean(xpath.ResultPtr)
val = xpath.ResultPtr.boolval != 0
return
} | |
c13489 | C.set_function_lookup(xpath.ContextPtr, unsafe.Pointer(&v))
} | |
c13490 | node = xmlNode
case XML_ATTRIBUTE_NODE:
node = &AttributeNode{XmlNode: xmlNode}
case XML_ELEMENT_NODE:
node = &ElementNode{XmlNode: xmlNode}
case XML_CDATA_SECTION_NODE:
node = &CDataNode{XmlNode: xmlNode}
case XML_COMMENT_NODE:
node = &CommentNode{XmlNode: xmlNode}
case XML_PI_NODE:
node = &ProcessingI... | |
c13491 |
for _, node := range nodes {
if err = xmlNode.addChild(node); err != nil {
break
}
}
}
case Node:
err = xmlNode.addChild(t)
}
return
} | |
c13492 |
for _, node := range nodes {
if err = xmlNode.addPreviousSibling(node); err != nil {
break
}
}
}
case Node:
err = xmlNode.addPreviousSibling(t)
}
return
} | |
c13493 | nil {
for i := len(nodes) - 1; i >= 0; i-- {
node := nodes[i]
if err = xmlNode.addNextSibling(node); err != nil {
break
}
}
}
case Node:
err = xmlNode.addNextSibling(t)
}
return
} | |
c13494 | unsafe.Pointer(xmlNode.Ptr)
return
} | |
c13495 | := (*C.char)(unsafe.Pointer(pathPtr))
defer C.xmlFreeChars(p)
path = C.GoString(p)
}
return
} | |
c13496 | {
node := NewNode(unsafe.Pointer(attrPtr), xmlNode.Document)
if node, ok := node.(*AttributeNode); ok {
attribute = node
}
}
return
} | |
c13497 | valPtr == nil {
return
}
p := unsafe.Pointer(valPtr)
defer C.xmlFreeChars((*C.char)(p))
val = C.GoString((*C.char)(p))
return
} | |
c13498 | := xpathCtx.EvaluateAsNodeset(unsafe.Pointer(xmlNode.Ptr), data)
if nodePtrs == nil || err != nil {
return nil, err
}
for _, nodePtr := range nodePtrs {
result = append(result, NewNode(nodePtr, xmlNode.Document))
}
}
return
} | |
c13499 | //err = errors.New("cannot compile xpath: " + data)
}
case []byte:
result = xmlNode.EvalXPathAsBoolean(string(data), v)
case *xpath.Expression:
xpathCtx := xmlNode.Document.DocXPathCtx()
xpathCtx.SetResolver(v)
err := xpathCtx.Evaluate(unsafe.Pointer(xmlNode.Ptr), data)
if err != nil {
return false
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.