Add dataset "device syslog" to non-db client (POC)#83
Add dataset "device syslog" to non-db client (POC)#83d-etienne wants to merge 7 commits intosonic-net:masterfrom
Conversation
sonic_data_client/non_db_client.go
Outdated
|
|
||
| func getDeviceSyslog() ([]byte, error) { | ||
| hostName := "localhost" | ||
| portNum := "5150" |
There was a problem hiding this comment.
please make it configurable parameter and pass in when the service start.
There was a problem hiding this comment.
you can have 5150 as default value.
hui-ma
left a comment
There was a problem hiding this comment.
Given that this PR is not functional complete yet. Please mark it as POC in the title.
Please add in the description about what has been done and what are the to do items.
| } | ||
|
|
||
| func (c *NonDbClient) Set(delete []*gnmipb.Path, replace []*gnmipb.Update, update []*gnmipb.Update) error { | ||
| func (c *NonDbClient) Set(delete []*gnmipb.Path, replace []*gnmipb.Update, update []*gnmipb.Update) error { |
There was a problem hiding this comment.
what change did you make here?
| for { | ||
| elem, _ := getter() | ||
| // adds new elem to storage space | ||
| storageBuffer.PushBack(elem) |
There was a problem hiding this comment.
could you get elem as nil here and how do you handle it?
| for _, sub := range subscribe.GetSubscription() { | ||
| subMode := sub.GetMode() | ||
| if subMode != gnmipb.SubscriptionMode_SAMPLE { | ||
| if subMode == gnmipb.SubscriptionMode_ON_CHANGE { |
There was a problem hiding this comment.
you need to change the comment of the StreamRun as well: "It supports SAMPLE mode only."
| } | ||
| } | ||
|
|
||
| func streamOnChange(c *NonDbClient, stop chan struct{}, sub *gnmipb.Subscription) { |
There was a problem hiding this comment.
does each subscriber have their owner streamOnChange? If how will you handle the case two client subscribe to syslog as the same time? have you tested it?
There was a problem hiding this comment.
Do you plan to enable onchange mode for other dataset? If not you should disable them in the call flow to avoid expected issue in the server.
|
Please post test result. And also need to setup test case with constant syslog flow to test the timing in the pubsub to the storagebuffer. |
sonic-data-client/non-db client:
This PR aims to enable the streaming telemetry container to stream out the system logs from the SONiC Host. This dataset is added into non-database client since syslog messages are generated quite frequently.
device/sysloggetDeviceSyslog()Need To Do:
Add the ability to identify whether the query that is being made by the client is actually a syslog query. Currently if the on-stream function is being used then the port will be opened
Add ability to identify how many subscribers are currently subscribed to the syslog data set. Currently the functionality is that when the subscriber cancels the subscription the port will close (This enables multiple clients to subscribe to this data set)
Add ability to compare the messages in a way that does not cause a massive delay when having two large messages. Currently, the messages are not being compared but rather all messages received through the port are placed within the linked list.
Adjust the functionality of polling and sampling queries for the syslog data set. As they no longer work with the changes that have been made to support on-change streaming mode
doc:
Added design document for the SONiC telemetry syslog pipeline describing implementation
How To Test:
We can use the command ./gnmi_cli -client_types=gnmi -a <DuT_IP>:8080 -t OTHERS -logtostderr -insecure -qt s -streaming_type ON_CHANGE -q device/syslog
Unit Tests will be added in a future iteration.
Signed-off-by: Daijah Etienne t-detienne@microsoft.com