MCPcopy Index your code
hub / github.com/cloudquery/cloudquery / getSyncCommonProps

Function getSyncCommonProps

cli/internal/analytics/client.go:124–154  ·  view source on GitHub ↗
(invocationUUID uuid.UUID, event SyncStartedEvent, details *eventDetails)

Source from the content-addressed store, hash-verified

122}
123
124func getSyncCommonProps(invocationUUID uuid.UUID, event SyncStartedEvent, details *eventDetails) rudderstack.Properties {
125 destinationPaths := make([]string, len(event.Destinations))
126 for i, d := range event.Destinations {
127 destinationPaths[i] = d.Path
128 }
129
130 userID, userEmail := getUserIDEmail(details.user, details.currentTeam)
131
132 props := rudderstack.NewProperties().
133 // we are using the same invocation_uuid for sync_run_id
134 // invocation_uuid to be consistent with the rest of the events
135 // sync_run_id to match with cloud events
136 Set("invocation_uuid", invocationUUID).
137 Set("sync_run_id", invocationUUID).
138 Set("team", details.currentTeam).
139 Set("$groups", rudderstack.NewProperties().
140 Set("team", details.currentTeam)).
141 Set("environment", details.environment).
142 Set("sync_name", event.Source.Name).
143 Set("source_path", event.Source.Path).
144 Set("destination_paths", destinationPaths).
145 Set("user_id", userID).
146 Set("user_email", userEmail)
147
148 if event.ShardNum > 0 && event.ShardTotal > 0 {
149 props = props.Set("shard_num", event.ShardNum).
150 Set("shard_total", event.ShardTotal)
151 }
152
153 return props
154}
155
156func TrackSyncStarted(ctx context.Context, invocationUUID uuid.UUID, event SyncStartedEvent) {
157 if client == nil {

Callers 2

TrackSyncStartedFunction · 0.85
TrackSyncCompletedFunction · 0.85

Calls 2

getUserIDEmailFunction · 0.85
SetMethod · 0.45

Tested by

no test coverage detected