Skip to content

Commit e72b755

Browse files
committed
fix tests
1 parent f52b495 commit e72b755

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

internal/bus/message_pipe.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ func (p *MessagePipe) Run(ctx context.Context) {
144144
case ConnectionAgentConfigUpdateTopic:
145145
p.handleConnectionAgentConfigUpdateTopic(m.ctx, m.message)
146146
default:
147-
slog.InfoContext(ctx, "Publishing message", "topic", m.message.Topic, "message----", m.message)
148147
p.bus.Publish(m.message.Topic, m.ctx, m.message)
149148
}
150149
}
@@ -193,7 +192,7 @@ func (p *MessagePipe) Reconfigure(ctx context.Context, agentConfig *mpi.AgentCon
193192

194193
// Reconfigure each plugin with the new agent config
195194
for _, plugin := range p.plugins {
196-
slog.InfoContext(ctx, "Reconfigure plugin", "plugin", plugin.Info().Name)
195+
slog.DebugContext(ctx, "Reconfigure plugin", "plugin", plugin.Info().Name)
197196
reconfigureError = plugin.Reconfigure(ctx, p.agentConfig)
198197
if reconfigureError != nil {
199198
slog.ErrorContext(ctx, "Reconfigure plugin failed", "plugin", plugin.Info().Name)
@@ -221,7 +220,7 @@ func (p *MessagePipe) Reconfigure(ctx context.Context, agentConfig *mpi.AgentCon
221220
}
222221
}
223222

224-
slog.InfoContext(ctx, "Finished reconfigure plugin", "plugins", p.plugins)
223+
slog.InfoContext(ctx, "Finished reconfiguring plugins", "plugins", p.plugins)
225224
if topic == AgentConfigUpdateTopic {
226225
response := p.createDataPlaneResponse(correlationID, mpi.CommandResponse_COMMAND_STATUS_OK,
227226
"Successfully updated agent config", "")

internal/collector/otel_collector_plugin.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,15 @@ func (oc *Collector) Reconfigure(ctx context.Context, agentConfig *config.Config
214214
oc.agentConfigMutex.Lock()
215215
defer oc.agentConfigMutex.Unlock()
216216

217-
if !reflect.DeepEqual(oc.config.Collector.Extensions.HeadersSetter.Headers,
218-
agentConfig.Collector.Extensions.HeadersSetter.Headers) {
219-
slog.DebugContext(ctx, "OTel collector headers have changed, restarting collector")
217+
if oc.config.Collector != nil && oc.config.Collector.Extensions.HeadersSetter != nil &&
218+
oc.config.Collector.Extensions.HeadersSetter.Headers != nil {
219+
if !reflect.DeepEqual(oc.config.Collector.Extensions.HeadersSetter.Headers,
220+
agentConfig.Collector.Extensions.HeadersSetter.Headers) {
221+
slog.InfoContext(ctx, "OTel collector headers have changed, restarting collector")
222+
oc.config = agentConfig
223+
oc.restartCollector(ctx)
224+
}
225+
} else {
220226
oc.config = agentConfig
221227
oc.restartCollector(ctx)
222228
}

internal/resource/resource_plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type Resource struct {
2929
messagePipe bus.MessagePipeInterface
3030
resourceService resourceServiceInterface
3131
agentConfig *config.Config
32-
agentConfigMutex *sync.Mutex
32+
agentConfigMutex sync.Mutex
3333
}
3434

3535
type errResponse struct {

0 commit comments

Comments
 (0)