The IT team in my company deploys activepieces to our users who are usually non-tech folks and there is always a chance for critical pieces to be used wrongly. At the moment, I’ve set up a regular SQL script that reads activepieces’ DB and find the usage stats of a piece. This is an example for checking projects / flows that is using the firecrawl piece:
WITH flow_pieces AS (
SELECT
f.id as flow_id,
f."projectId" as project_id,
f.status as flow_status,
fv.trigger as flow_version_trigger,
fv."displayName" as flow_name
FROM flow f
INNER JOIN flow_version fv ON fv."flowId" = f.id
)
SELECT DISTINCT ON (f.flow_id)
p.id as project_id,
p."displayName" as project_name,
f.flow_id,
f.flow_status,
f.flow_name
FROM flow_pieces f
INNER JOIN project p ON f.project_id = p.id
WHERE
(f.flow_version_trigger::jsonb #>> '{settings,pieceName}') = '@activepieces/piece-firecrawl'
OR EXISTS (
WITH RECURSIVE steps AS (
-- Start with the first action
SELECT f.flow_version_trigger::jsonb #> '{nextAction}' as step
UNION ALL
-- Recursively get next actions
SELECT step #> '{nextAction}'
FROM steps
WHERE step #> '{nextAction}' IS NOT NULL
)
SELECT 1
FROM steps
WHERE (step #>> '{settings,pieceName}') = '@activepieces/piece-firecrawl'
)
ORDER BY f.flow_id, f.flow_name;I prefer to have a dashboard to do some of this monitoring without writing SQL.
Please authenticate to join the conversation.
In Review

Flow Builder
11 months ago

Shawn Lim
Get notified by email when there are changes.
In Review

Flow Builder
11 months ago

Shawn Lim
Get notified by email when there are changes.