@@ -97,11 +97,7 @@ func New(dsn string, config tags.TagConfig, opts ...Option) (Receiver, error) {
9797 return nil , err
9898 }
9999
100- base := NewBase (zapwriter .Logger (strings .Replace (u .Scheme , "+" , "_" , - 1 )), config )
101-
102- for _ , optApply := range opts {
103- optApply (& base )
104- }
100+ logger := zapwriter .Logger (strings .Replace (u .Scheme , "+" , "_" , - 1 ))
105101
106102 if u .Scheme == "tcp" {
107103 addr , err := net .ResolveTCPAddr ("tcp" , u .Host )
@@ -110,9 +106,10 @@ func New(dsn string, config tags.TagConfig, opts ...Option) (Receiver, error) {
110106 }
111107
112108 r := & TCP {
113- Base : base ,
109+ Base : NewBase ( logger , config ) ,
114110 parseChan : make (chan * Buffer ),
115111 }
112+ r .applyOptions (opts ... )
116113
117114 if err = r .Listen (addr ); err != nil {
118115 return nil , err
@@ -128,9 +125,10 @@ func New(dsn string, config tags.TagConfig, opts ...Option) (Receiver, error) {
128125 }
129126
130127 r := & Pickle {
131- Base : base ,
128+ Base : NewBase ( logger , config ) ,
132129 parseChan : make (chan []byte ),
133130 }
131+ r .applyOptions (opts ... )
134132
135133 if err = r .Listen (addr ); err != nil {
136134 return nil , err
@@ -146,9 +144,10 @@ func New(dsn string, config tags.TagConfig, opts ...Option) (Receiver, error) {
146144 }
147145
148146 r := & UDP {
149- Base : base ,
147+ Base : NewBase ( logger , config ) ,
150148 parseChan : make (chan * Buffer ),
151149 }
150+ r .applyOptions (opts ... )
152151
153152 if err = r .Listen (addr ); err != nil {
154153 return nil , err
@@ -164,8 +163,9 @@ func New(dsn string, config tags.TagConfig, opts ...Option) (Receiver, error) {
164163 }
165164
166165 r := & GRPC {
167- Base : base ,
166+ Base : NewBase ( logger , config ) ,
168167 }
168+ r .applyOptions (opts ... )
169169
170170 if err = r .Listen (addr ); err != nil {
171171 return nil , err
@@ -181,8 +181,9 @@ func New(dsn string, config tags.TagConfig, opts ...Option) (Receiver, error) {
181181 }
182182
183183 r := & PrometheusRemoteWrite {
184- Base : base ,
184+ Base : NewBase ( logger , config ) ,
185185 }
186+ r .applyOptions (opts ... )
186187
187188 if err = r .Listen (addr ); err != nil {
188189 return nil , err
@@ -198,8 +199,9 @@ func New(dsn string, config tags.TagConfig, opts ...Option) (Receiver, error) {
198199 }
199200
200201 r := & TelegrafHttpJson {
201- Base : base ,
202+ Base : NewBase ( logger , config ) ,
202203 }
204+ r .applyOptions (opts ... )
203205
204206 if err = r .Listen (addr ); err != nil {
205207 return nil , err
0 commit comments