fix(processors.aws_ec2): Remove leading slash and cancel worker only if it exists (#15965)
This commit is contained in:
parent
40d7961e31
commit
ba413e36f8
|
|
@ -163,7 +163,10 @@ func (r *AwsEc2Processor) Stop() {
|
||||||
if r.parallel != nil {
|
if r.parallel != nil {
|
||||||
r.parallel.Stop()
|
r.parallel.Stop()
|
||||||
}
|
}
|
||||||
r.cancelCleanupWorker()
|
if r.cancelCleanupWorker != nil {
|
||||||
|
r.cancelCleanupWorker()
|
||||||
|
r.cancelCleanupWorker = nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *AwsEc2Processor) logCacheStatistics(ctx context.Context) {
|
func (r *AwsEc2Processor) logCacheStatistics(ctx context.Context) {
|
||||||
|
|
@ -268,7 +271,7 @@ func (r *AwsEc2Processor) lookupMetadata(metric telegraf.Metric) telegraf.Metric
|
||||||
key = strings.ReplaceAll(key, "/", "_")
|
key = strings.ReplaceAll(key, "/", "_")
|
||||||
} else {
|
} else {
|
||||||
if idx := strings.LastIndex(key, "/"); idx > 0 {
|
if idx := strings.LastIndex(key, "/"); idx > 0 {
|
||||||
key = key[idx:]
|
key = key[idx+1:]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue