github.com/alibaba/ilogtail/pkg@v0.0.0-20250526110833-c53b480d046c/pipeline/collector.go (about)

     1  // Copyright 2021 iLogtail Authors
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package pipeline
    16  
    17  import (
    18  	"time"
    19  
    20  	"github.com/alibaba/ilogtail/pkg/protocol"
    21  )
    22  
    23  type LogWithContext struct {
    24  	Log     *protocol.Log
    25  	Context map[string]interface{}
    26  }
    27  
    28  type LogGroupWithContext struct {
    29  	LogGroup *protocol.LogGroup
    30  	Context  map[string]interface{}
    31  }
    32  
    33  // Collector ...
    34  type Collector interface {
    35  	AddData(tags map[string]string,
    36  		fields map[string]string,
    37  		t ...time.Time)
    38  
    39  	AddDataArray(tags map[string]string,
    40  		columns []string,
    41  		values []string,
    42  		t ...time.Time)
    43  
    44  	AddRawLog(log *protocol.Log)
    45  
    46  	AddDataWithContext(tags map[string]string,
    47  		fields map[string]string,
    48  		ctx map[string]interface{},
    49  		t ...time.Time)
    50  
    51  	AddDataArrayWithContext(tags map[string]string,
    52  		columns []string,
    53  		values []string,
    54  		ctx map[string]interface{},
    55  		t ...time.Time)
    56  
    57  	AddRawLogWithContext(log *protocol.Log, ctx map[string]interface{})
    58  }