I write an exporter , and it was work fine, but when I send signal terminal to collector, my exporter's Shutdown is not work, and noting to print in console, which just blocked.
my exporter's Shutdown func :
func (l *logsExporter) Shutdown(_ context.Context) error {
l.logger.Info("start shutdown remote write exporter --logsExporter")
var run int
run = logGPool.Running()
for run != 0 {
run = logGPool.Running()
l.logger.Debug("run worker size ", zap.Int("", run))
}
if client, ok := clientURLMap[l.config.RemoteURL]; ok {
client.CloseIdleConnections()
}
l.logger.Info("remote write exporter -- logsExporter shutdown")
return nil
}
and consol output:
2024-09-20T15:27:04.342+0800 info otelcol@v0.108.1/collector.go:328 Received signal from OS {"signal": "terminated"}
2024-09-20T15:27:04.342+0800 info service@v0.108.1/service.go:326 Starting shutdown...
2024-09-20T15:27:04.551+0800 info kafkareceiver@v0.109.0/kafka_receiver.go:448 Consumer stopped {"kind": "receiver", "name": "kafka", "data_type": "logs", "error": "context canceled"}
I write an exporter , and it was work fine, but when I send signal terminal to collector, my exporter's Shutdown is not work, and noting to print in console, which just blocked.
my exporter's Shutdown func :
and consol output:
which just block here
Pipeline:
kafkareceiver -> my exporter