// NewStatsdBuffer Factory
491540
func NewStatsdBuffer(interval time.Duration, client Statsd) *StatsdBuffer {
	sb := &StatsdBuffer{
		flushInterval: interval,
		statsd:        client,
		eventChannel:  make(chan event.Event, 100),
		events:        make(map[string]event.Event),
		closeChannel:  make(chan closeRequest),
		Logger:        log.New(os.Stdout, "[BufferedStatsdClient] ", log.Ldate|log.Ltime),
		Verbose:       true,
	}
	go sb.collector()
	return sb
}
94393
func NewStat() *Stat {
	s := &Stat{}
	runtime.SetFinalizer(s, (*Stat).free)

	initDone := make(chan bool)
	s.exitMessage = make(chan bool)

	C.sg_init(1)

	go func() {
		// We need some function calls to be performed on the same thread
		// Those for which statgrab is using a thread local
		runtime.LockOSThread()
		defer runtime.UnlockOSThread()

		// Throw away the first reading as thats averaged over the machines uptime
		C.sg_get_cpu_stats_diff(nil)
		C.sg_get_network_io_stats_diff(nil)
		C.sg_get_page_stats_diff(nil)
		C.sg_get_disk_io_stats_diff(nil)

		initDone <- true

		for {
			select {
			case <-s.exitMessage:
				return
			case f := <-mainfunc:
				f()
			}
		}

	}()

	<-initDone

	return s
}
836457
func NewStatsdSink(addr string) (*StatsdSink, error) {
	s := &StatsdSink{
		addr:        addr,
		metricQueue: make(chan string, 4096),
	}
	go s.flushMetrics()
	return s, nil
}
1165482
func NewStaticProperty(key interface{}, value Type) *StaticProperty {
	return &StaticProperty{
		Key:   key,
		Value: value,
	}
}
470677
func (b *Buffer) StatsUpdate(ts *discovery.TabletStats) {
	if ts.Target.TabletType != topodatapb.TabletType_MASTER {
		panic(fmt.Sprintf("BUG: non MASTER TabletStats object must not be forwarded: %#v", ts))
	}

	timestamp := ts.TabletExternallyReparentedTimestamp
	if timestamp == 0 {
		// Masters where TabletExternallyReparented was never called will return 0.
		// Ignore them.
		return
	}

	sb := b.getOrCreateBuffer(ts.Target.Keyspace, ts.Target.Shard)
	if sb == nil {
		// Buffer is shut down. Ignore all calls.
		return
	}
	sb.recordExternallyReparentedTimestamp(timestamp, ts.Tablet.Alias)
}
939341
func (s *StatsdCollectorClient) NewStatsdCollector(name string) metricCollector.MetricCollector {
	if s.client == nil {
		log.Fatalf("Statsd client must be initialized before circuits are created.")
	}
	name = strings.Replace(name, "/", "-", -1)
	name = strings.Replace(name, ":", "-", -1)
	name = strings.Replace(name, ".", "-", -1)
	return &StatsdCollector{
		client:                  s.client,
		circuitOpenPrefix:       name + ".circuitOpen",
		attemptsPrefix:          name + ".attempts",
		errorsPrefix:            name + ".errors",
		successesPrefix:         name + ".successes",
		failuresPrefix:          name + ".failures",
		rejectsPrefix:           name + ".rejects",
		shortCircuitsPrefix:     name + ".shortCircuits",
		timeoutsPrefix:          name + ".timeouts",
		fallbackSuccessesPrefix: name + ".fallbackSuccesses",
		fallbackFailuresPrefix:  name + ".fallbackFailures",
		canceledPrefix:          name + ".contextCanceled",
		deadlinePrefix:          name + ".contextDeadlineExceeded",
		totalDurationPrefix:     name + ".totalDuration",
		runDurationPrefix:       name + ".runDuration",
		concurrencyInUsePrefix:  name + ".concurrencyInUse",
		sampleRate:              s.sampleRate,
	}
}
321889
func NewStatus(body []interface{}) (s Status) {
	s.LastCheckedTime = body[0].(int64)
	s.Progress = body[1].(float64)
	s.CurrentOperation = body[2].(string)
	s.NewVersion = body[3].(string)
	s.NewSize = body[4].(int64)

	return
}
413600
func newStream(r io.Reader) *stream {
	return &stream{r, make([]byte, buffer), buffer}
}
205169
func NewServiceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
	return NewFilteredServiceInformer(client, namespace, resyncPeriod, indexers, nil)
}
783589
func NewStaticDataValue(name string, data interface{}) *StaticDataSource {
	row := []driver.Value{data}
	ds := NewStaticDataSource(name, 0, [][]driver.Value{row}, []string{name})
	return ds
}
957962
func NewStatistic(name string) Statistic {
	return Statistic{
		Name:   name,
		Tags:   make(map[string]string),
		Values: make(map[string]interface{}),
	}
}
152571
func NewStatsiteSink(addr string) (*StatsiteSink, error) {
	s := &StatsiteSink{
		addr:        addr,
		metricQueue: make(chan string, 4096),
	}
	go s.flushMetrics()
	return s, nil
}
416120
func NewSerializer(meta MetaFactory, creater runtime.ObjectCreater, typer runtime.ObjectTyper, pretty bool) *Serializer {
	return NewSerializerWithOptions(meta, creater, typer, SerializerOptions{false, pretty, false})
}
341242
func NewSpritesheetWithBorderFromTexture(tr *TextureResource, cellWidth, cellHeight, borderWidth, borderHeight int) *Spritesheet {
	spriteRegions := generateSymmetricSpriteRegions(tr.Width, tr.Height, cellWidth, cellHeight, borderWidth, borderHeight)
	return NewAsymmetricSpritesheetFromTexture(tr, spriteRegions)
}
1283264
func NewSampleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
	return NewFilteredSampleInformer(client, namespace, resyncPeriod, indexers, nil)
}
710402
func NewStatustext(SEVERITY uint8, TEXT [50]uint8) *Statustext {
	m := Statustext{}
	m.SEVERITY = SEVERITY
	m.TEXT = TEXT
	return &m
}
739898
func (s *Application) NewStatic(urlPath string, absPath string, f ...map[string]interface{}) *resource.Static {
	st := resource.NewStatic(urlPath, absPath)
	if len(f) > 0 {
		f[0] = st.Register(f[0])
	}
	return st
}