Skip to content

Commit

Permalink
Send available and enabled streams in Segment call (#12149)
Browse files Browse the repository at this point in the history
* add available and enabled streams to existing segment call

* Update airbyte-webapp/src/hooks/services/useConnectionHook.tsx

Co-authored-by: Tim Roes <tim@airbyte.io>

Co-authored-by: Tim Roes <tim@airbyte.io>
  • Loading branch information
teallarson and timroes authored Apr 20, 2022
1 parent 13e9230 commit a90be03
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion airbyte-webapp/src/hooks/services/useConnectionHook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,19 +134,21 @@ const useGetConnection = (connectionId: string, options?: { refetchInterval: num
const useCreateConnection = () => {
const service = useWebConnectionService();
const queryClient = useQueryClient();

const analyticsService = useAnalyticsService();

return useMutation(
async (conn: CreateConnectionProps) => {
const { values, source, destination, sourceDefinition, destinationDefinition } = conn;

const response = await service.create({
sourceId: source?.sourceId,
destinationId: destination?.destinationId,
...values,
status: "active",
});

const enabledStreams = values.syncCatalog.streams.filter((stream) => stream.config.selected).length;

const frequencyData = FrequencyConfig.find((item) => equal(item.config, values.schedule));

analyticsService.track("New Connection - Action", {
Expand All @@ -156,6 +158,8 @@ const useCreateConnection = () => {
connector_source_definition_id: sourceDefinition?.sourceDefinitionId,
connector_destination_definition: destination?.destinationName,
connector_destination_definition_id: destinationDefinition?.destinationDefinitionId,
available_streams: values.syncCatalog.streams.length,
enabled_streams: enabledStreams,
});

return response;
Expand Down

0 comments on commit a90be03

Please sign in to comment.