Skip to content

Commit

Permalink
Ensure we pass the open telemetry through bootstrap
Browse files Browse the repository at this point in the history
If we don't pass the values through bootstrap, then we end up bouncing
the agent multiple times to get the right value.
  • Loading branch information
SimonRichardson committed Aug 18, 2023
1 parent 21933ec commit fbd001c
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 11 deletions.
4 changes: 4 additions & 0 deletions cloudconfig/instancecfg/instancecfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,10 @@ func (cfg *InstanceConfig) AgentConfig(
configParams.AgentLogfileMaxSizeMB = cfg.ControllerConfig.AgentLogfileMaxSizeMB()
configParams.QueryTracingEnabled = cfg.ControllerConfig.QueryTracingEnabled()
configParams.QueryTracingThreshold = cfg.ControllerConfig.QueryTracingThreshold()
configParams.OpenTelemetryEnabled = cfg.ControllerConfig.OpenTelemetryEnabled()
configParams.OpenTelemetryEndpoint = cfg.ControllerConfig.OpenTelemetryEndpoint()
configParams.OpenTelemetryInsecure = cfg.ControllerConfig.OpenTelemetryInsecure()
configParams.OpenTelemetryStackTraces = cfg.ControllerConfig.OpenTelemetryStackTraces()
}
if cfg.Bootstrap == nil {
return agent.NewAgentConfig(configParams)
Expand Down
26 changes: 15 additions & 11 deletions cloudconfig/podcfg/podcfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,21 @@ func (cfg *ControllerPodConfig) AgentConfig(tag names.Tag) (agent.ConfigSetterWr
LogDir: cfg.LogDir,
MetricsSpoolDir: cfg.MetricsSpoolDir,
},
Tag: tag,
UpgradedToVersion: cfg.JujuVersion,
Password: cfg.APIInfo.Password,
APIAddresses: cfg.APIHostAddrs(),
CACert: cfg.APIInfo.CACert,
Values: cfg.AgentEnvironment,
Controller: cfg.ControllerTag,
Model: cfg.APIInfo.ModelTag,
MongoMemoryProfile: mongo.MemoryProfile(cfg.Controller.MongoMemoryProfile()),
QueryTracingEnabled: cfg.Controller.QueryTracingEnabled(),
QueryTracingThreshold: cfg.Controller.QueryTracingThreshold(),
Tag: tag,
UpgradedToVersion: cfg.JujuVersion,
Password: cfg.APIInfo.Password,
APIAddresses: cfg.APIHostAddrs(),
CACert: cfg.APIInfo.CACert,
Values: cfg.AgentEnvironment,
Controller: cfg.ControllerTag,
Model: cfg.APIInfo.ModelTag,
MongoMemoryProfile: mongo.MemoryProfile(cfg.Controller.MongoMemoryProfile()),
QueryTracingEnabled: cfg.Controller.QueryTracingEnabled(),
QueryTracingThreshold: cfg.Controller.QueryTracingThreshold(),
OpenTelemetryEnabled: cfg.Controller.OpenTelemetryEnabled(),
OpenTelemetryEndpoint: cfg.Controller.OpenTelemetryEndpoint(),
OpenTelemetryInsecure: cfg.Controller.OpenTelemetryInsecure(),
OpenTelemetryStackTraces: cfg.Controller.OpenTelemetryStackTraces(),
}
return agent.NewStateMachineConfig(configParams, cfg.Bootstrap.StateServingInfo)
}
Expand Down
10 changes: 10 additions & 0 deletions cmd/jujud/agent/agenttest/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ func (s *AgentSuite) PrimeAgentVersion(c *gc.C, tag names.Tag, password string,

QueryTracingEnabled: controller.DefaultQueryTracingEnabled,
QueryTracingThreshold: controller.DefaultQueryTracingThreshold,

OpenTelemetryEnabled: controller.DefaultOpenTelemetryEnabled,
OpenTelemetryEndpoint: "",
OpenTelemetryInsecure: controller.DefaultOpenTelemetryInsecure,
OpenTelemetryStackTraces: controller.DefaultOpenTelemetryStackTraces,
},
)
c.Assert(err, jc.ErrorIsNil)
Expand Down Expand Up @@ -266,6 +271,11 @@ func (s *AgentSuite) WriteStateAgentConfig(
MongoMemoryProfile: controller.DefaultMongoMemoryProfile,
QueryTracingEnabled: controller.DefaultQueryTracingEnabled,
QueryTracingThreshold: controller.DefaultQueryTracingThreshold,

OpenTelemetryEnabled: controller.DefaultOpenTelemetryEnabled,
OpenTelemetryEndpoint: "",
OpenTelemetryInsecure: controller.DefaultOpenTelemetryInsecure,
OpenTelemetryStackTraces: controller.DefaultOpenTelemetryStackTraces,
},
controller.StateServingInfo{
Cert: coretesting.ServerCert,
Expand Down
4 changes: 4 additions & 0 deletions cmd/jujud/agent/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,10 @@ func (c *BootstrapCommand) Run(ctx *cmd.Context) error {
agentConfig.SetJujuDBSnapChannel(args.ControllerConfig.JujuDBSnapChannel())
agentConfig.SetQueryTracingEnabled(args.ControllerConfig.QueryTracingEnabled())
agentConfig.SetQueryTracingThreshold(args.ControllerConfig.QueryTracingThreshold())
agentConfig.SetOpenTelemetryEnabled(args.ControllerConfig.OpenTelemetryEnabled())
agentConfig.SetOpenTelemetryEndpoint(args.ControllerConfig.OpenTelemetryEndpoint())
agentConfig.SetOpenTelemetryInsecure(args.ControllerConfig.OpenTelemetryInsecure())
agentConfig.SetOpenTelemetryStackTraces(args.ControllerConfig.OpenTelemetryStackTraces())
return nil
}); err != nil {
return fmt.Errorf("cannot write agent config: %v", err)
Expand Down
4 changes: 4 additions & 0 deletions state/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ func (s *ControllerSuite) TestControllerAndModelConfigInitialisation(c *gc.C) {
controller.ApplicationResourceDownloadLimit,
controller.QueryTracingEnabled,
controller.QueryTracingThreshold,
controller.OpenTelemetryEnabled,
controller.OpenTelemetryEndpoint,
controller.OpenTelemetryInsecure,
controller.OpenTelemetryStackTraces,
)
for _, controllerAttr := range controller.ControllerOnlyConfigAttributes {
v, ok := controllerSettings.Get(controllerAttr)
Expand Down
56 changes: 56 additions & 0 deletions worker/stateconverter/mocks/agent_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fbd001c

Please sign in to comment.