(ctx context.Context, data map[string]int)
| 1314 | var wshActivityRe = regexp.MustCompile(`^[a-z:#]+$`) |
| 1315 | |
| 1316 | func (ws *WshServer) WshActivityCommand(ctx context.Context, data map[string]int) error { |
| 1317 | if len(data) == 0 { |
| 1318 | return nil |
| 1319 | } |
| 1320 | props := telemetrydata.TEventProps{} |
| 1321 | for key, value := range data { |
| 1322 | if len(key) > 20 { |
| 1323 | delete(data, key) |
| 1324 | } |
| 1325 | if !wshActivityRe.MatchString(key) { |
| 1326 | delete(data, key) |
| 1327 | } |
| 1328 | if value != 1 { |
| 1329 | delete(data, key) |
| 1330 | } |
| 1331 | if strings.HasSuffix(key, "#error") { |
| 1332 | props.WshCmd = strings.TrimSuffix(key, "#error") |
| 1333 | props.WshErrorCount = 1 |
| 1334 | } else { |
| 1335 | props.WshCmd = key |
| 1336 | } |
| 1337 | } |
| 1338 | activityUpdate := wshrpc.ActivityUpdate{ |
| 1339 | WshCmds: data, |
| 1340 | } |
| 1341 | telemetry.GoUpdateActivityWrap(activityUpdate, "wsh-activity") |
| 1342 | telemetry.GoRecordTEventWrap(&telemetrydata.TEvent{ |
| 1343 | Event: telemetry.WshRunEventName, |
| 1344 | Props: props, |
| 1345 | }) |
| 1346 | return nil |
| 1347 | } |
| 1348 | |
| 1349 | func (ws *WshServer) ActivityCommand(ctx context.Context, activity wshrpc.ActivityUpdate) error { |
| 1350 | telemetry.GoUpdateActivityWrap(activity, "wshrpc-activity") |
nothing calls this directly
no test coverage detected