-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update client package docs #107
Update client package docs #107
Conversation
Codecov Report
@@ Coverage Diff @@
## main #107 +/- ##
==========================================
+ Coverage 75.77% 76.24% +0.46%
==========================================
Files 22 22
Lines 1577 1633 +56
==========================================
+ Hits 1195 1245 +50
- Misses 288 292 +4
- Partials 94 96 +2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great comments, thanks a lot. I have just one minor suggestion.
client/httpclient.go
Outdated
@@ -33,6 +34,7 @@ func NewHTTP(logger types.Logger) *httpClient { | |||
return w | |||
} | |||
|
|||
// Start starts the client and runs until Stop is called. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Start()
is explained in more detail in the OpAMPClient
interface description. We can either copy the comment from there or reference from here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I wasn't really sure about this. What do you think about remaining ones SetAgentDescription
, SetHealth
etc..? Should we copy for all of them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you can add a reference in a way that it becomes a link in godoc here that would be best, so that we don't have to duplicate the content and risk diverging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there is no way to achieve this. I looked up how the packages in stdlib cross reference the functions from other modules. It just uses plain text like os.Exit
or json.Marshal
for the same reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, let's just put plain text to reference OpAMPClient.Start
.
client/types/callbacks.go
Outdated
@@ -39,6 +39,8 @@ type MessageData struct { | |||
} | |||
|
|||
type Callbacks interface { | |||
// OnConnect is called when the connection is successfully established to the Server. | |||
// May be called after Start() is called and every time connected to the Server. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// May be called after Start() is called and every time connected to the Server. | |
// May be called after Start() is called and every time a connection is established to the Server. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add more description here for websocket and http?
For example:
WebSocket clients will call OnConnect when a new WebSocket connection is established.
HTTP clients will call OnConnect after any request that results in a 200 response.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion. I will update the description.
Co-authored-by: Andy Keller <andykellr@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @srikanthccv
Partially addresses #100. Also added to some internal funcs which I thought would be helpful to get a quick summary.