Git Product home page Git Product logo

Comments (4)

tigrannajaryan avatar tigrannajaryan commented on June 18, 2024

the client implementation does it only for RemoteConfigStatus and PackageStatuses not for the EffectiveConfig, AgentHealth and AgentDescription. I was wondering if there was reason behind this?

The client implementation compresses all these messages. See NextMessage.PopPending implementation. Once the message is popped and sent these fields are unset and will be only set in the next message if they are modified via NextMessage.Update.

from opamp-go.

srikanthccv avatar srikanthccv commented on June 18, 2024

Thanks, that was helpful. I think my original question should have been more clear. Should the client push update to NextMessage even if there was no change and schedule send.

I am looking at this implementation b/w SetAgentDescription and SetRemoteConfigStatus.

// SetAgentDescription sends a status update to the Server with the new AgentDescription
// and remembers the AgentDescription in the client state so that it can be sent
// to the Server when the Server asks for it.
func (c *ClientCommon) SetAgentDescription(descr *protobufs.AgentDescription) error {
// store the Agent description to send on reconnect
if err := c.ClientSyncedState.SetAgentDescription(descr); err != nil {
return err
}
c.sender.NextMessage().Update(
func(msg *protobufs.AgentToServer) {
msg.AgentDescription = c.ClientSyncedState.AgentDescription()
},
)
c.sender.ScheduleSend()
return nil
}

func (c *ClientCommon) SetRemoteConfigStatus(status *protobufs.RemoteConfigStatus) error {
if status.LastRemoteConfigHash == nil {
return errLastRemoteConfigHashNil
}
statusChanged := !proto.Equal(c.ClientSyncedState.RemoteConfigStatus(), status)
// Remember the new status.
if err := c.ClientSyncedState.SetRemoteConfigStatus(status); err != nil {
return err
}
if statusChanged {
// Let the Server know about the new status.
c.sender.NextMessage().Update(
func(msg *protobufs.AgentToServer) {
msg.RemoteConfigStatus = c.ClientSyncedState.RemoteConfigStatus()
},
)
// TODO: if this call is coming from OnMessage callback don't schedule the send
// immediately, wait until the end of OnMessage to send one message only.
c.sender.ScheduleSend()
}
return nil
}

from opamp-go.

tigrannajaryan avatar tigrannajaryan commented on June 18, 2024

Should the client push update to NextMessage even if there was no change and schedule send.

Do you mean the situation when for example SetRemoteConfigStatus is called with a descr parameter that is equal to the current c.ClientSyncedState.AgentDescription()? You are right that in this case a message will be sent to the Server when with AgentDescription field set when actually the field could have been omitted. We can make a deep comparison and avoid sending it, but the Server should be ready for this to happen anyway, so this should not result in any erroneous situation, it will be just unnecessary data sent.

from opamp-go.

srikanthccv avatar srikanthccv commented on June 18, 2024

Thanks for the clarification.

from opamp-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.