qiniu / logkit

@@ -276,6 +276,11 @@
Loading
276 276
		return true
277 277
	}
278 278
279 +
	if hour == 0 && minute == 0 {
280 +
		now := time.Now()
281 +
		hour = now.Hour()
282 +
		minute = now.Minute()
283 +
	}
279 284
	if !runTime.isStartLessThanEnd() {
280 285
		if runTime.GreaterThanStart(hour, minute) || runTime.LessThanEnd(hour, minute) {
281 286
			return true

@@ -356,7 +356,7 @@
Loading
356 356
	// Use readSlice to look for array,
357 357
	// accumulating full buffers.
358 358
	var frag []byte
359 -
	var full [][]byte
359 +
	var full = make([][]byte, 0, 10)
360 360
	var err error
361 361
	for {
362 362
		var e error
@@ -459,15 +459,14 @@
Loading
459 459
460 460
//ReadLine returns a string line as a normal Reader
461 461
func (b *BufReader) ReadLine() (ret string, err error) {
462 -
	now := time.Now()
463 -
	if !reader.InRunTime(now.Hour(), now.Minute(), b.runTime) {
462 +
	if !reader.InRunTime(0, 0, b.runTime) {
464 463
		time.Sleep(10 * time.Second)
465 464
		return "", nil
466 465
	}
467 466
468 467
	if b.multiLineRegexp == nil {
469 468
		ret, err = b.ReadString('\n')
470 -
		if os.IsNotExist(err) {
469 +
		if err != nil && os.IsNotExist(err) {
471 470
			if b.lastErrShowTime.Add(5 * time.Second).Before(time.Now()) {
472 471
				if !IsSelfRunner(b.Meta.RunnerName) {
473 472
					log.Errorf("runner[%v] ReadLine err %v", b.Meta.RunnerName, err)

@@ -656,10 +656,14 @@
Loading
656 656
func (r *LogExportRunner) rawReadLines(dataSourceTag string) (lines, froms []string) {
657 657
	var line string
658 658
	var err error
659 +
	lines = make([]string, 0, r.batchLen)
660 +
	if dataSourceTag != "" {
661 +
		froms = make([]string, 0, r.batchLen)
662 +
	}
659 663
	for !utils.BatchFullOrTimeout(r.RunnerName, &r.stopped, r.batchLen, r.batchSize, r.lastSend,
660 664
		r.MaxBatchLen, r.MaxBatchSize, r.MaxBatchInterval) {
661 665
		line, err = r.reader.ReadLine()
662 -
		if os.IsNotExist(err) {
666 +
		if err != nil && os.IsNotExist(err) {
663 667
			log.Debugf("Runner[%v] reader %s - error: %v, sleep 3 second...", r.Name(), r.reader.Name(), err)
664 668
			time.Sleep(3 * time.Second)
665 669
			break

@@ -294,8 +294,7 @@
Loading
294 294
			}
295 295
			return
296 296
		}
297 -
		now := time.Now()
298 -
		if !reader.InRunTime(now.Hour(), now.Minute(), ar.runtime) {
297 +
		if !reader.InRunTime(0, 0, ar.runtime) {
299 298
			time.Sleep(time.Minute)
300 299
			continue
301 300
		}
@@ -834,8 +833,7 @@
Loading
834 833
		ticker := time.NewTicker(r.statInterval)
835 834
		defer ticker.Stop()
836 835
		for {
837 -
			now := time.Now()
838 -
			if reader.InRunTime(now.Hour(), now.Minute(), r.runTime) {
836 +
			if reader.InRunTime(0, 0, r.runTime) {
839 837
				r.checkExpiredFiles()
840 838
				utils.CheckNotExistFile(r.meta.RunnerName, r.expireMap)
841 839
				r.statLogPath()

@@ -60,18 +60,21 @@
Loading
60 60
61 61
func (p *Parser) Parse(lines []string) ([]Data, error) {
62 62
	var (
63 -
		datas     = make([]Data, len(lines))
64 -
		se        = &StatsError{}
63 +
		datas = make([]Data, len(lines))
64 +
		se    = &StatsError{
65 +
			DatasourceSkipIndex: make([]int, 0, len(lines)),
66 +
		}
65 67
		dataIndex = 0
66 68
	)
67 69
	for idx, line := range lines {
68 -
		//raw格式的不应该trime空格,只需要判断剔除掉全空就好了
69 -
		if len(strings.TrimSpace(line)) <= 0 {
70 +
		//raw格式的不应该trime空格,只需要判断剔除掉全空就好了,rawReadLines中已剔除空格
71 +
		if len(line) <= 0 {
70 72
			se.DatasourceSkipIndex = append(se.DatasourceSkipIndex, idx)
71 73
			continue
72 74
		}
73 -
		d := Data{}
74 -
		d[p.keyRaw] = line
75 +
		d := Data{
76 +
			p.keyRaw: line,
77 +
		}
75 78
		if p.withTimeStamp {
76 79
			d[p.keyTimestamp] = time.Now().Format(time.RFC3339Nano)
77 80
		}
Files Coverage
conf 97.67%
mgr 66.17%
parser 87.13%
queue 74.13%
rateio 95.74%
reader 47.80%
router 54.13%
samples 100.00%
sender 45.15%
transforms 55.67%
utils 58.88%
audit/audit.go 73.63%
cleaner/cleaner.go 58.82%
cli/upgrade.go 47.56%
logkit.go 35.20%
self/logrunner.go 53.88%
times/times.go 91.30%
Project Totals (139 files) 56.98%
3982.1
TRAVIS_OS_NAME=linux
1.12.9=.12.9

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading