You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: worker.go
    path of file: ./repos/juju/worker/agentconfigupdater
    
    the code of the file until where you have to start completion: // Copyright 2019 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.

package agentconfigupdater

import (
	"time"

	"github.com/juju/errors"
	"github.com/juju/pubsub/v2"
	"github.com/juju/worker/v3"
	"gopkg.in/tomb.v2"

	coreagent "github.com/juju/juju/agent"
	"github.com/juju/juju/mongo"
	controllermsg "github.com/juju/juju/pubsub/controller"
	jworker "github.com/juju/juju/worker"
)

// WorkerConfig contains the information necessary to run
// the 
    
func (w *agentConfigUpdater) onConfigChanged(topic string, data controllermsg.ConfigChangedMessage, err error) {
	if err != nil {
		w.config.Logger.Criticalf("programming error in %s message data: %v", topic, err)
		return
	}

	mongoProfile := mongo.MemoryProfile(data.Config.MongoMemoryProfile())
	mongoProfileChanged := mongoProfile != w.mongoProfile

	jujuDBSnapChannel := data.Config.JujuDBSnapChannel()
	jujuDBSnapChannelChanged := jujuDBSnapChannel != w.jujuDBSnapChannel

	queryTracingEnabled := data.Config.QueryTracingEnabled()
	queryTracingEnabledChanged := queryTracingEnabled != w.queryTracingEnabled

	queryTracingThreshold := data.Config.QueryTracingThreshold()
	queryTracingThresholdChanged := queryTracingThreshold != w.queryTracingThreshold

	changeDetected := mongoProfileChanged || jujuDBSnapChannelChanged || queryTracingEnabledChanged || queryTracingThresholdChanged
	if !changeDetected {
		// Nothing to do, all good.
		return
	}

	err = w.config.Agent.ChangeConfig(func(setter coreagent.ConfigSetter) error {
		if mongoProfileChanged {
			w.config.Logger.Debugf("setting agent config mongo memory profile: %q => %q", w.mongoProfile, mongoProfile)
			setter.SetMongoMemoryProfile(mongoProfile)
		}
		if jujuDBSnapChannelChanged {
			w.config.Logger.Debugf("setting agent config mongo snap channel: %q => %q", w.jujuDBSnapChannel, jujuDBSnapChannel)
			setter.SetJujuDBSnapChannel(jujuDBSnapChannel)
		}
		if queryTracingEnabledChanged {
			w.config.Logger.Debugf("setting agent config query tracing enabled: %v => %v", w.queryTracingEnabled, queryTracingEnabled)
			setter.SetQueryTracingEnabled(queryTracingEnabled)
		}
		if queryTracingThresholdChanged {
			w.config.Logger.Debugf("setting agent config query tracing threshold: %v => %v", w.queryTracingThreshold, queryTracingThreshold)
			setter.SetQueryTracingThreshold(queryTracingThreshold)
		}
		return nil
	})
	if err != nil {
		w.tomb.Kill(errors.Annotate(err, "failed to update agent config"))
		return
	}

	w.tomb.Kill(jworker.ErrRestartAgent)
}