查询示例 query-examples
本节列出了在数据湖中查询历程步骤事件的几个常用示例。
确保在查询中使用的字段在相应架构中具有关联值。
跟踪数据集用例 tracking-datasets
以下是跟踪数据集和相关用例的列表:
电子邮件跟踪体验事件数据集 (cjm_email_tracking_experience_event_dataset)
用于从Journey Optimizer中摄取电子邮件跟踪体验事件的系统数据集。
相关架构是CJM电子邮件跟踪体验事件架构。
报告用例
select
_experience.customerJourneyManagement.messageInteraction.interactionType AS interactionType,
count(1) eventCount
from cjm_email_tracking_experience_event_dataset
where
_experience.customerJourneyManagement.messageExecution.messageExecutionID IN ('UMA-30647505')
group by
_experience.customerJourneyManagement.messageInteraction.interactionType
select
_experience.customerJourneyManagement.messageExecution.messageExecutionID AS messageExecutionID,
_experience.customerJourneyManagement.messageInteraction.interactionType AS interactionType,
count(1) eventCount
from cjm_email_tracking_experience_event_dataset
where
_experience.customerJourneyManagement.messageExecution.journeyVersionID IN ('0e86ac62-c315-48cc-ab4f-3f8b741ae667')
group by
_experience.customerJourneyManagement.messageExecution.messageExecutionID,
_experience.customerJourneyManagement.messageInteraction.interactionType
order by
_experience.customerJourneyManagement.messageExecution.messageExecutionID,
_experience.customerJourneyManagement.messageInteraction.interactionType
limit 100;
消息反馈事件数据集 (cjm_message_feedback_event_dataset)
用于从Journey Optimizer中摄取电子邮件和推送应用程序反馈事件的数据集。
相关架构是CJM消息反馈事件架构。
报告用例
select
_experience.customerJourneyManagement.messageDeliveryfeedback.feedbackStatus AS feedbackStatus,
count(1) eventCount
from cjm_message_feedback_event_dataset
where
_experience.customerJourneyManagement.messageExecution.messageExecutionID IN ('UMA-30647505')
group by
_experience.customerJourneyManagement.messageDeliveryfeedback.feedbackStatus;
select
_experience.customerJourneyManagement.messageExecution.messageExecutionID AS messageExecutionID,
_experience.customerJourneyManagement.messageDeliveryfeedback.feedbackStatus AS feedbackStatus,
count(1) eventCount
from cjm_message_feedback_event_dataset
where
_experience.customerJourneyManagement.messageExecution.journeyVersionID IN ('0e86ac62-c315-48cc-ab4f-3f8b741ae667')
group by
_experience.customerJourneyManagement.messageExecution.messageExecutionID,
_experience.customerJourneyManagement.messageDeliveryfeedback.feedbackStatus
order by
_experience.customerJourneyManagement.messageExecution.messageExecutionID,
_experience.customerJourneyManagement.messageDeliveryfeedback.feedbackStatus
limit 100;
推送跟踪体验事件数据集 (cjm_push_tracking_experience_event_dataset)
用于从Journey Optimizer中提取推送和应用程序内渠道的移动跟踪体验事件的数据集。
相关架构是CJM推送跟踪体验事件架构。
报告用例
select _experience.customerJourneyManagement.pushChannelContext.platform, sum(pushNotificationTracking.customAction.value) from cjm_push_tracking_experience_event_dataset
group by _experience.customerJourneyManagement.pushChannelContext.platform
select _experience.customerJourneyManagement.pushChannelContext.platform, SUM (_experience.customerJourneyManagement.messageInteraction.offers.offerCount) from cjm_email_tracking_experience_event_dataset
group by _experience.customerJourneyManagement.pushChannelContext.platform
历程步骤事件 (journey_step_events)
用于在历程中为用户摄取步骤事件的数据集。
相关架构是用于Journey Orchestration的历程步骤事件架构。
报告用例
select
_experience.journeyOrchestration.stepEvents.actionName AS actionLabel,
count(1) actionSuccessCount
from journey_step_events
where
_experience.journeyOrchestration.stepEvents.journeyVersionID IN ('0e86ac62-c315-48cc-ab4f-3f8b741ae667')
AND _experience.journeyOrchestration.stepEvents.actionID IS NOT NULL
AND _experience.journeyOrchestration.stepEvents.actionType IS NOT NULL
AND _experience.journeyOrchestration.stepEvents.actionExecutionErrorCode IS NULL
group by
_experience.journeyOrchestration.stepEvents.actionName;
select
_experience.journeyOrchestration.stepEvents.nodeID AS nodeID,
_experience.journeyOrchestration.stepEvents.nodeName AS nodeLabel,
count(1) stepEnteredCount
from journey_step_events
where
_experience.journeyOrchestration.stepEvents.journeyVersionID IN ('0e86ac62-c315-48cc-ab4f-3f8b741ae667')
AND _experience.journeyOrchestration.stepEvents.journeyNodeProcessed = TRUE
AND _experience.journeyOrchestration.stepEvents.eventID IS DISTINCT FROM 'createInstance'
group by
_experience.journeyOrchestration.stepEvents.nodeID,
_experience.journeyOrchestration.stepEvents.nodeName;
消息/操作错误 message-action-errors
历程中遇到的每个错误的列表
此查询允许您列出执行消息/操作时在历程中遇到的每个错误。
数据湖查询
SELECT _experience.journeyOrchestration.stepEvents.actionExecutionError, count(distinct _id) FROM journey_step_events
WHERE _experience.journeyOrchestration.stepEvents.nodeName=<'message-name'>
AND _experience.journeyOrchestration.stepEvents.actionExecutionError IS NOT NULL
AND _experience.journeyOrchestration.stepEvents.journeyVersionID = '<journey-version-id>'
GROUP BY _experience.journeyOrchestration.stepEvents.actionExecutionError
示例
SELECT _experience.journeyOrchestration.stepEvents.actionExecutionError, count(distinct _id) FROM journey_step_events
WHERE _experience.journeyOrchestration.stepEvents.nodeName='Message - 100KB Email with Gateway and Kafkav2'
AND _experience.journeyOrchestration.stepEvents.actionExecutionError IS NOT NULL
AND _experience.journeyOrchestration.stepEvents.journeyVersionID = '67b14482-143e-4f83-9cf5-cfec0fca3d26'
GROUP BY _experience.journeyOrchestration.stepEvents.actionExecutionError
此查询返回在历程中执行操作时发生的所有不同错误以及发生次数。
基于用户档案的查询 profile-based-queries
查找配置文件是否输入了特定历程
数据湖查询
SELECT count(distinct _id) FROM journey_step_events
where
_experience.journeyOrchestration.stepEvents.journeyVersionID = '<journey-version-id>' AND
_experience.journeyOrchestration.stepEvents.profileID = '<profileID corresponding to the namespace used>'
示例
SELECT count(distinct _id) FROM journey_step_events
where
_experience.journeyOrchestration.stepEvents.journeyVersionID = 'ec9efdd0-8a7c-4d7a-a765-b2cad659fa4e' AND
_experience.journeyOrchestration.stepEvents.profileID = 'saurgarg@adobe.com'
结果应大于0。 此查询返回用户档案进入历程的确切次数。
查找配置文件是否发送了特定消息
方法1:如果消息的名称在历程中不是唯一的(会在多个位置使用)。
数据湖查询
SELECT count(distinct _id) FROM journey_step_events WHERE
_experience.journeyOrchestration.stepEvents.nodeID='<NodeId in the UI corresponding to the message>' AND
_experience.journeyOrchestration.stepEvents.actionExecutionError IS NULL AND
_experience.journeyOrchestration.stepEvents.journeyVersionID = '<journey-version-id>' AND
_experience.journeyOrchestration.stepEvents.profileID = '<profileID corresponding to the namespace used>'
示例
SELECT count(distinct _id) FROM journey_step_events WHERE
_experience.journeyOrchestration.stepEvents.nodeID='17ae65a1-02dd-439d-b54e-b56a78520eba' AND
_experience.journeyOrchestration.stepEvents.actionExecutionError IS NULL AND
_experience.journeyOrchestration.stepEvents.journeyVersionID = '67b14482-143e-4f83-9cf5-cfec0fca3d26' AND
_experience.journeyOrchestration.stepEvents.profileID = 'saurgarg@adobe.com'
结果应大于0。 此查询仅告诉我们是否已在历程端成功执行消息操作。
方法2:如果消息的名称在历程中是唯一的。
数据湖查询
SELECT count(distinct _id) FROM journey_step_events WHERE
_experience.journeyOrchestration.stepEvents.nodeName='<NodeName in the UI corresponding to the message>' AND
_experience.journeyOrchestration.stepEvents.actionExecutionError IS NULL AND
_experience.journeyOrchestration.stepEvents.journeyVersionID = '<journey-version-id>' AND
_experience.journeyOrchestration.stepEvents.profileID = '<profileID corresponding to the namespace used>'
示例
SELECT count(distinct _id) FROM journey_step_events WHERE
_experience.journeyOrchestration.stepEvents.nodeID='Message- 100KB Email' AND
_experience.journeyOrchestration.stepEvents.actionExecutionError IS NULL AND
_experience.journeyOrchestration.stepEvents.journeyVersionID = '67b14482-143e-4f83-9cf5-cfec0fca3d26' AND
_experience.journeyOrchestration.stepEvents.profileID = 'saurgarg@adobe.com'
查询会返回所有消息的列表,以及为所选用户档案调用的消息计数。
查找用户档案在过去30天内收到的所有邮件
数据湖查询
SELECT _experience.journeyOrchestration.stepEvents.nodeName, count(distinct _id) FROM journey_step_events
WHERE _experience.journeyOrchestration.stepEvents.actionExecutionError IS NULL AND
_experience.journeyOrchestration.stepEvents.nodeType = 'action' AND
_experience.journeyOrchestration.stepEvents.profileID = '<profileID corresponding to the namespace used>' AND
timestamp > (now() - interval '30' day)
GROUP BY _experience.journeyOrchestration.stepEvents.nodeName
示例
SELECT _experience.journeyOrchestration.stepEvents.nodeName, count(distinct _id) FROM journey_step_events
WHERE _experience.journeyOrchestration.stepEvents.actionExecutionError IS NULL AND
_experience.journeyOrchestration.stepEvents.nodeType = 'action' AND
_experience.journeyOrchestration.stepEvents.profileID = 'saurgarg@adobe.com' AND
timestamp > (now() - interval '30' day)
GROUP BY _experience.journeyOrchestration.stepEvents.nodeName
查询会返回所有消息的列表,以及为所选用户档案调用的消息计数。
查找用户档案在过去30天内输入的所有历程
数据湖查询
SELECT _experience.journeyOrchestration.stepEvents.journeyVersionName, count(distinct _id) FROM journey_step_events
WHERE _experience.journeyOrchestration.stepEvents.nodeType = 'start' AND
_experience.journeyOrchestration.stepEvents.profileID = '<profileID corresponding to the namespace used>' AND
timestamp > (now() - interval '30' day)
GROUP BY _experience.journeyOrchestration.stepEvents.journeyVersionName
示例
SELECT _experience.journeyOrchestration.stepEvents.journeyVersionName, count(distinct _id) FROM journey_step_events
WHERE _experience.journeyOrchestration.stepEvents.nodeType = 'start' AND
_experience.journeyOrchestration.stepEvents.profileID = 'saurgarg@adobe.com' AND
timestamp > (now() - interval '30' day)
GROUP BY _experience.journeyOrchestration.stepEvents.journeyVersionName
查询会返回所有历程名称的列表,以及被查询的用户档案进入历程的次数。
每天符合历程条件的用户档案数
数据湖查询
SELECT DATE(timestamp), count(distinct _experience.journeyOrchestration.stepEvents.profileID) FROM journey_step_events
WHERE DATE(timestamp) > (now() - interval '<last x days>' day)
AND _experience.journeyOrchestration.stepEvents.journeyVersionID = '<journey-version-id>'
GROUP BY DATE(timestamp)
ORDER BY DATE(timestamp) desc
示例
SELECT DATE(timestamp), count(distinct _experience.journeyOrchestration.stepEvents.profileID) FROM journey_step_events
WHERE DATE(timestamp) > (now() - interval '100' day)
AND _experience.journeyOrchestration.stepEvents.journeyVersionID = '180ad071-d42d-42bb-8724-2a6ff0a109f1'
GROUP BY DATE(timestamp)
ORDER BY DATE(timestamp) desc
在定义的期间内,查询将返回每天进入历程的用户档案数。 如果通过多个身份输入用户档案,则将被计算两次。 如果启用了重新进入,并且用户档案计数可能在不同日期重复(如果在不同的日期重新进入历程)。
与读取区段相关的查询 read-segment-queries
完成区段导出作业所用的时间
数据湖查询
select DATEDIFF (minute,
(select timestamp
where
_experience.journeyOrchestration.journey.versionID = '<journey-version-id>' AND
_experience.journeyOrchestration.serviceEvents.segmentExportJob.status = 'queued') ,
(select timestamp
where
_experience.journeyOrchestration.journey.versionID = '<journey-version-id>' AND
_experience.journeyOrchestration.serviceEvents.segmentExportJob.status = 'finished')) AS export_job_runtime;
示例
select DATEDIFF (minute,
(select timestamp
where
_experience.journeyOrchestration.journey.versionID = '180ad071-d42d-42bb-8724-2a6ff0a109f1' AND
_experience.journeyOrchestration.serviceEvents.segmentExportJob.status = 'queued') ,
(select timestamp
where
_experience.journeyOrchestration.journey.versionID = '180ad071-d42d-42bb-8724-2a6ff0a109f1' AND
_experience.journeyOrchestration.serviceEvents.segmentExportJob.status = 'finished')) AS export_job_runtime;
查询将返回区段导出作业排队时间和最终结束时间之间的时间差(以分钟为单位)。
历程丢弃的重复用户档案数
数据湖查询
SELECT count(distinct _experience.journeyOrchestration.profile.ID) FROM journey_step_events
where
_experience.journeyOrchestration.journey.versionID = '<journey-version-id>' AND
_experience.journeyOrchestration.serviceEvents.segmentExportJob.eventCode = 'ERROR_INSTANCE_DUPLICATION'
示例
SELECT count(distinct _experience.journeyOrchestration.profile.ID) FROM journey_step_events
where
_experience.journeyOrchestration.journey.versionID = '180ad071-d42d-42bb-8724-2a6ff0a109f1' AND
_experience.journeyOrchestration.serviceEvents.segmentExportJob.eventCode = 'ERROR_INSTANCE_DUPLICATION'
查询返回历程丢弃的所有用户档案ID,因为这些用户档案ID是重复的。
由于命名空间无效而被历程丢弃的用户档案数
数据湖查询
SELECT count(*) FROM journey_step_events
where
_experience.journeyOrchestration.journey.versionID = '<journey-version-id>' AND
_experience.journeyOrchestration.serviceEvents.segmentExportJob.eventCode = 'ERROR_INSTANCE_BAD_NAMESPACE'
示例
SELECT count(*) FROM journey_step_events
where
_experience.journeyOrchestration.journey.versionID = '180ad071-d42d-42bb-8724-2a6ff0a109f1' AND
_experience.journeyOrchestration.serviceEvents.segmentExportJob.eventCode = 'ERROR_INSTANCE_BAD_NAMESPACE'
该查询返回历程丢弃的所有用户档案ID,原因是它们具有无效的命名空间或没有该命名空间的身份。
由于没有标识映射而被历程丢弃的配置文件数
数据湖查询
SELECT count(*) FROM journey_step_events
where
_experience.journeyOrchestration.journey.versionID = '<journey-version-id>' AND
_experience.journeyOrchestration.serviceEvents.segmentExportJob.eventCode = 'ERROR_INSTANCE_NO_IDENTITY_MAP'
示例
SELECT count(*) FROM journey_step_events
where
_experience.journeyOrchestration.journey.versionID = '180ad071-d42d-42bb-8724-2a6ff0a109f1' AND
_experience.journeyOrchestration.serviceEvents.segmentExportJob.eventCode = 'ERROR_INSTANCE_NO_IDENTITY_MAP'
查询返回历程丢弃的所有用户档案ID,因为缺少身份映射。
由于历程在测试节点中并且配置文件不是测试配置文件,因此历程丢弃的配置文件数
数据湖查询
SELECT count(distinct _experience.journeyOrchestration.profile.ID) FROM journey_step_events
where
_experience.journeyOrchestration.journey.versionID = '<journey-version-id>' AND
_experience.journeyOrchestration.serviceEvents.segmentExportJob.eventCode = 'ERROR_INSTANCE_NOT_A_TEST_PROFILE'
示例
SELECT count(distinct _experience.journeyOrchestration.profile.ID) FROM journey_step_events
where
_experience.journeyOrchestration.journey.versionID = '180ad071-d42d-42bb-8724-2a6ff0a109f1' AND
_experience.journeyOrchestration.serviceEvents.segmentExportJob.eventCode = 'ERROR_INSTANCE_NOT_A_TEST_PROFILE'
查询返回旅程丢弃的所有配置文件ID,因为导出作业在测试模式下运行,但配置文件的testProfile属性未设置为true。
由于内部错误而被历程丢弃的用户档案数
数据湖查询
SELECT count(distinct _experience.journeyOrchestration.profile.ID) FROM journey_step_events
where
_experience.journeyOrchestration.journey.versionID = '<journey-version-id>' AND
_experience.journeyOrchestration.serviceEvents.segmentExportJob.eventCode = 'ERROR_INSTANCE_INTERNAL'
示例
SELECT count(distinct _experience.journeyOrchestration.profile.ID) FROM journey_step_events
where
_experience.journeyOrchestration.journey.versionID = '180ad071-d42d-42bb-8724-2a6ff0a109f1' AND
_experience.journeyOrchestration.serviceEvents.segmentExportJob.eventCode = 'ERROR_INSTANCE_INTERNAL'
查询返回由于某些内部错误而被历程丢弃的所有用户档案ID。
给定历程版本 的读取区段概述
数据湖查询
SELECT
_experience.journeyOrchestration.serviceEvents.segmentExportJob.eventCode AS EVENT_CODE,
_experience.journeyOrchestration.serviceEvents.segmentExportJob.exportSegmentID AS SEGMENT_ID,
_experience.journeyOrchestration.serviceEvents.segmentExportJob.ID AS EXPORTJOB_ID,
_experience.journeyOrchestration.serviceEvents.segmentExportJob.status AS EXPORTJOB_STATUS,
_experience.journeyOrchestration.serviceEvents.segmentExportJob.exportCountTotal AS TOTAL_EXPORTED_PROFILES_COUNT,
_experience.journeyOrchestration.serviceEvents.segmentExportJob.exportCountRealized AS SUCCESS_EXPORTED_PROFILES_COUNT,
_experience.journeyOrchestration.serviceEvents.segmentExportJob.exportCountFailed AS FAILED_EXPORTED_PROFILES_COUNT
FROM
journey_step_events
WHERE
_experience.journeyOrchestration.journey.versionID = '<journey-version-id>' AND
_experience.journeyOrchestration.serviceEvents.segmentExportJob.eventType = 'segmenttrigger-orchestrator'
它将返回与给定历程版本相关的所有服务事件。 我们可以遵循操作链:
- 主题创建
- 导出作业创建
- 导出作业终止(使用导出用户档案上的量度)
- 工作人员处理终止
我们还可以检测以下问题:
- 创建主题或导出作业时出错(包括区段导出API调用超时)
- 导出作业可能卡住(对于给定的历程版本,我们没有任何有关导出作业终止的事件)
- 工作人员问题,如果我们收到了导出作业终止事件,但没有工作人员处理终止事件
重要信息:如果此查询未返回任何事件,则可能是由于以下原因之一造成的:
- 历程版本尚未达到计划
- 如果历程版本应该通过调用orchestrator触发导出作业,则上行流出现问题:历程部署问题、业务事件或调度程序问题。
获取给定历程版本 的读取区段错误
数据湖查询
SELECT
_experience.journeyOrchestration.serviceEvents.segmentExportJob.eventCode AS EVENT_CODE,
_experience.journeyOrchestration.serviceEvents.segmentExportJob.exportSegmentID AS SEGMENT_ID,
_experience.journeyOrchestration.serviceEvents.segmentExportJob.ID AS EXPORTJOB_ID,
_experience.journeyOrchestration.serviceEvents.segmentExportJob.status AS EXPORTJOB_STATUS,
_experience.journeyOrchestration.serviceEvents.segmentExportJob.exportCountTotal AS TOTAL_EXPORTED_PROFILES_COUNT,
_experience.journeyOrchestration.serviceEvents.segmentExportJob.exportCountRealized AS SUCCESS_EXPORTED_PROFILES_COUNT,
_experience.journeyOrchestration.serviceEvents.segmentExportJob.exportCountFailed AS FAILED_EXPORTED_PROFILES_COUNT
FROM
journey_step_events
WHERE
_experience.journeyOrchestration.journey.versionID = '<journey-version-id>' AND
_experience.journeyOrchestration.serviceEvents.segmentExportJob.eventType = 'segmenttrigger-orchestrator' AND
_experience.journeyOrchestration.serviceEvents.segmentExportJob.eventCode IN (
'ERROR_TOPIC_CREATION',
'ERROR_EXPORTJOB_APICALL',
'ERROR_EXPORTJOB_APICALL_TIMEOUT',
'ERROR_EXPORTJOB_FAILED'
)
获取导出作业处理状态
数据湖查询
SELECT
_experience.journeyOrchestration.serviceEvents.segmentExportJob.eventCode AS EVENT_CODE,
_experience.journeyOrchestration.serviceEvents.segmentExportJob.exportSegmentID AS SEGMENT_ID,
_experience.journeyOrchestration.serviceEvents.segmentExportJob.ID AS EXPORTJOB_ID,
_experience.journeyOrchestration.serviceEvents.segmentExportJob.status AS EXPORTJOB_STATUS,
_experience.journeyOrchestration.serviceEvents.segmentExportJob.exportCountTotal AS TOTAL_EXPORTED_PROFILES_COUNT,
_experience.journeyOrchestration.serviceEvents.segmentExportJob.exportCountRealized AS SUCCESS_EXPORTED_PROFILES_COUNT,
_experience.journeyOrchestration.serviceEvents.segmentExportJob.exportCountFailed AS FAILED_EXPORTED_PROFILES_COUNT
FROM
journey_step_events
WHERE
_experience.journeyOrchestration.journey.versionID = '<journey-version-id>' AND
_experience.journeyOrchestration.serviceEvents.segmentExportJob.eventType = 'segmenttrigger-orchestrator' AND
_experience.journeyOrchestration.serviceEvents.segmentExportJob.eventCode IN (
'INFO_EXPORTJOB_SUCCEEDED',
'ERROR_EXPORTJOB_FAILED'
)
如果未返回任何记录,则意味着:
- 创建主题或导出作业期间出错
- 导出作业仍在运行
获取导出配置文件的量度,包括每个导出作业的放弃和导出作业量度
数据湖查询
WITH
DISCARDED_EXPORTED_PROFILES AS (
SELECT
_experience.journeyOrchestration.serviceEvents.segmentExportJob.ID AS EXPORTJOB_ID,
count(distinct _experience.journeyOrchestration.profile.ID) AS DISCARDED_PROFILES_COUNT
FROM
journey_step_events
WHERE
_experience.journeyOrchestration.journey.versionID = '<journey-version-id>' AND
_experience.journeyOrchestration.serviceEvents.segmentExportJob.eventCode IN (
'ERROR_INSTANCE_DUPLICATION',
'ERROR_INSTANCE_BAD_NAMESPACE',
'ERROR_INSTANCE_NO_IDENTITY_MAP',
'ERROR_INSTANCE_NOT_A_TEST_PROFILE',
'ERROR_INSTANCE_INTERNAL'
)
GROUP BY
_experience.journeyOrchestration.serviceEvents.segmentExportJob.ID
),
SEGMENT_EXPORT_METRICS AS (
SELECT
_experience.journeyOrchestration.serviceEvents.segmentExportJob.ID AS EXPORTJOB_ID,
sum(_experience.journeyOrchestration.serviceEvents.segmentExportJob.exportCountTotal) AS TOTAL_EXPORTED_PROFILES_COUNT,
sum(_experience.journeyOrchestration.serviceEvents.segmentExportJob.exportCountRealized) AS SUCCESS_EXPORTED_PROFILES_COUNT,
sum(_experience.journeyOrchestration.serviceEvents.segmentExportJob.exportCountFailed) AS FAILED_EXPORTED_PROFILES_COUNT
FROM
journey_step_events
WHERE
_experience.journeyOrchestration.journey.versionID = '<journey-version-id>' AND
_experience.journeyOrchestration.serviceEvents.segmentExportJob.eventType = 'segmenttrigger-orchestrator' AND
_experience.journeyOrchestration.serviceEvents.segmentExportJob.eventCode IN (
'INFO_EXPORTJOB_SUCCEEDED',
'ERROR_EXPORTJOB_FAILED'
)
GROUP BY
_experience.journeyOrchestration.serviceEvents.segmentExportJob.ID
)
SELECT
sum(T2.TOTAL_EXPORTED_PROFILES_COUNT),
sum(T2.SUCCESS_EXPORTED_PROFILES_COUNT),
sum(T2.FAILED_EXPORTED_PROFILES_COUNT),
sum(T1.DISCARDED_PROFILES_COUNT)
FROM
DISCARDED_EXPORTED_PROFILES AS T1,
SEGMENT_EXPORT_METRICS AS T2
WHERE T1.EXPORTJOB_ID = T2.EXPORTJOB_ID
获取所有导出作业的汇总量度(区段导出作业和放弃)
数据湖查询
WITH
DISCARDED_EXPORTED_PROFILES AS (
SELECT
_experience.journeyOrchestration.journey.versionID AS JOURNEYVERSION_ID,
count(distinct _experience.journeyOrchestration.profile.ID) AS DISCARDED_PROFILES_COUNT
FROM
journey_step_events
WHERE
_experience.journeyOrchestration.journey.versionID = '<journey-version-id>' AND
_experience.journeyOrchestration.serviceEvents.segmentExportJob.eventCode IN (
'ERROR_INSTANCE_DUPLICATION',
'ERROR_INSTANCE_BAD_NAMESPACE',
'ERROR_INSTANCE_NO_IDENTITY_MAP',
'ERROR_INSTANCE_NOT_A_TEST_PROFILE',
'ERROR_INSTANCE_INTERNAL'
)
GROUP BY
_experience.journeyOrchestration.journey.versionID
),
SEGMENT_EXPORT_METRICS AS (
SELECT
_experience.journeyOrchestration.journey.versionID AS JOURNEYVERSION_ID,
sum(_experience.journeyOrchestration.serviceEvents.segmentExportJob.exportCountTotal) AS TOTAL_EXPORTED_PROFILES_COUNT,
sum(_experience.journeyOrchestration.serviceEvents.segmentExportJob.exportCountRealized) AS SUCCESS_EXPORTED_PROFILES_COUNT,
sum(_experience.journeyOrchestration.serviceEvents.segmentExportJob.exportCountFailed) AS FAILED_EXPORTED_PROFILES_COUNT
FROM
journey_step_events
WHERE
_experience.journeyOrchestration.journey.versionID = '<journey-version-id>' AND
_experience.journeyOrchestration.serviceEvents.segmentExportJob.eventType = 'segmenttrigger-orchestrator' AND
_experience.journeyOrchestration.serviceEvents.segmentExportJob.eventCode IN (
'INFO_EXPORTJOB_SUCCEEDED',
'ERROR_EXPORTJOB_FAILED'
)
GROUP BY
_experience.journeyOrchestration.journey.versionID
)
SELECT
sum(T2.TOTAL_EXPORTED_PROFILES_COUNT),
sum(T2.SUCCESS_EXPORTED_PROFILES_COUNT),
sum(T2.FAILED_EXPORTED_PROFILES_COUNT),
sum(T1.DISCARDED_PROFILES_COUNT)
FROM
DISCARDED_EXPORTED_PROFILES AS T1,
SEGMENT_EXPORT_METRICS AS T2
WHERE T1.JOURNEYVERSION_ID = T2.JOURNEYVERSION_ID
此查询与上一个查询不同。
它会返回给定历程版本的整体量度,而不考虑可以为其运行的作业(在重复历程的情况下,业务事件会触发利用主题重用的事件)。
与区段资格相关的查询 segment-qualification-queries
由于区段实现与配置的区段实现不同,已放弃配置文件
数据湖查询
SELECT DATE(timestamp), _experience.journeyOrchestration.profile.ID
FROM journey_step_events
where
_experience.journeyOrchestration.journey.versionID = '<journey-version id>' AND
_experience.journeyOrchestration.serviceEvents.dispatcher.eventType = 'ERROR_SEGMENT_REALISATION_CONDITION_MISMATCH'
示例
SELECT DATE(timestamp), _experience.journeyOrchestration.profile.ID
FROM journey_step_events
where
_experience.journeyOrchestration.journey.versionID = 'a868f3c9-4888-46ac-a274-94cdf1c4159d' AND
_experience.journeyOrchestration.serviceEvents.dispatcher.eventType = 'ERROR_SEGMENT_REALISATION_CONDITION_MISMATCH'
此查询返回由于区段实现错误而被历程版本丢弃的所有用户档案ID。
由于特定配置文件的任何其他原因而放弃的区段资格事件
数据湖查询
SELECT DATE(timestamp), _experience.journeyOrchestration.profile.ID, _experience.journeyOrchestration.serviceEvents.dispatcher.projectionID
FROM journey_step_events
where
_experience.journeyOrchestration.profile.ID = '<profile-id>' AND
_experience.journeyOrchestration.serviceEvents.dispatcher.eventCode = 'discard' AND
_experience.journeyOrchestration.serviceEvents.dispatcher.eventType = 'ERROR_SERVICE_INTERNAL';
示例
SELECT DATE(timestamp), _experience.journeyOrchestration.profile.ID, _experience.journeyOrchestration.serviceEvents.dispatcher.projectionID
FROM journey_step_events
where
_experience.journeyOrchestration.profile.ID = 'mandee@adobe.com' AND
_experience.journeyOrchestration.serviceEvents.dispatcher.eventCode = 'discard' AND
_experience.journeyOrchestration.serviceEvents.dispatcher.eventType = 'ERROR_SERVICE_INTERNAL';
此查询返回由于用户档案的任何其他原因而被放弃的所有事件(外部事件/区段资格事件)。
基于事件的查询 event-based-queries
检查是否收到历程的业务事件
数据湖查询
SELECT DATE(timestamp), count(distinct _id)
FROM journey_step_events
where
_experience.journeyOrchestration.stepEvents.journeyVersionID = '<journey-version-id>' AND
_experience.journeyOrchestration.stepEvents.nodeName = '<node-name-corresponding-to-business-event>' AND
_experience.journeyOrchestration.stepEvents.nodeType = 'start' AND
WHERE DATE(timestamp) > (now() - interval '<last x hours>' hour)
示例
SELECT DATE(timestamp), count(distinct _id)
FROM journey_step_events
where
_experience.journeyOrchestration.stepEvents.journeyVersionID = 'b1093bd4-11f3-44cc-961e-33925cc58e18' AND
_experience.journeyOrchestration.stepEvents.nodeName = 'TEST_MLTrainingSession' AND
_experience.journeyOrchestration.stepEvents.nodeType = 'start' AND
WHERE DATE(timestamp) > (now() - interval '6' hour)
检查是否因为未找到相关历程而丢弃了配置文件的外部事件
数据湖查询
SELECT _experience.journeyOrchestration.profile.ID, DATE(timestamp) FROM journey_step_events
where
_experience.journeyOrchestration.serviceEvents.dispatcher.eventID = '<eventId>' AND
_experience.journeyOrchestration.profile.ID = '<profileId>' AND
_experience.journeyOrchestration.serviceEvents.dispatcher.eventCode = 'discard' AND
_experience.journeyOrchestration.serviceEvents.dispatcher.eventType = 'EVENT_WITH_NO_JOURNEY'
示例
SELECT _experience.journeyOrchestration.profile.ID, DATE(timestamp) FROM journey_step_events
where
_experience.journeyOrchestration.serviceEvents.dispatcher.eventID = '515bff852185e434ca5c83bcfc4f24626b1545ca615659fc4cfff91626ce61a6' AND
_experience.journeyOrchestration.profile.ID = 'mandee@adobe.com' AND
_experience.journeyOrchestration.serviceEvents.dispatcher.eventCode = 'discard' AND
_experience.journeyOrchestration.serviceEvents.dispatcher.eventType = 'EVENT_WITH_NO_JOURNEY'
检查配置文件的外部事件是否因任何其他原因而被丢弃
数据湖查询
SELECT _experience.journeyOrchestration.profile.ID, DATE(timestamp), _experience.journeyOrchestration.serviceEvents.dispatcher.eventID, _experience.journeyOrchestration.serviceEvents.dispatcher.eventCode
FROM journey_step_events
where
_experience.journeyOrchestration.profile.ID='<profileID>' AND
_experience.journeyOrchestration.serviceEvents.dispatcher.eventID='<eventID>' AND
_experience.journeyOrchestration.serviceEvents.dispatcher.eventCode = 'discard' AND
_experience.journeyOrchestration.serviceEvents.dispatcher.eventType = 'ERROR_SERVICE_INTERNAL';
示例
SELECT _experience.journeyOrchestration.profile.ID, DATE(timestamp), _experience.journeyOrchestration.serviceEvents.dispatcher.eventID, _experience.journeyOrchestration.serviceEvents.dispatcher.eventCode
FROM journey_step_events
where
_experience.journeyOrchestration.profile.ID='mandee@adobe.com' AND
_experience.journeyOrchestration.serviceEvents.dispatcher.eventID='81c51be978d8bdf9ef497076b3e12b14533615522ecea9f5080a81c736491656' AND
_experience.journeyOrchestration.serviceEvents.dispatcher.eventCode = 'discard' AND
_experience.journeyOrchestration.serviceEvents.dispatcher.eventType = 'ERROR_SERVICE_INTERNAL';
检查stateMachine按errorCode丢弃的所有事件的计数
数据湖查询
SELECT _experience.journeyOrchestration.serviceEvents.stateMachine.eventCode, COUNT() FROM journey_step_events
where
_experience.journeyOrchestration.serviceEvents.stateMachine.eventType = 'discard' GROUP BY _experience.journeyOrchestration.serviceEvents.stateMachine.eventCode
示例
SELECT _experience.journeyOrchestration.serviceEvents.stateMachine.eventCode, COUNT() FROM journey_step_events
where
_experience.journeyOrchestration.serviceEvents.stateMachine.eventType = 'discard' GROUP BY _experience.journeyOrchestration.serviceEvents.stateMachine.eventCode
检查所有丢弃的事件,因为不允许重新进入
数据湖查询
SELECT DATE(timestamp), _experience.journeyOrchestration.profile.ID,
_experience.journeyOrchestration.journey.versionID,
_experience.journeyOrchestration.serviceEvents.stateMachine.eventCode
FROM journey_step_events
where
_experience.journeyOrchestration.serviceEvents.stateMachine.eventType = 'discard' AND _experience.journeyOrchestration.serviceEvents.stateMachine.eventCode='reentranceNotAllowed'
示例
SELECT DATE(timestamp), _experience.journeyOrchestration.profile.ID,
_experience.journeyOrchestration.journey.versionID,
_experience.journeyOrchestration.serviceEvents.stateMachine.eventCode
FROM journey_step_events
where
_experience.journeyOrchestration.serviceEvents.stateMachine.eventType = 'discard' AND _experience.journeyOrchestration.serviceEvents.stateMachine.eventCode='reentranceNotAllowed'
常见的基于历程的查询 journey-based-queries
每日活动历程数
数据湖查询
SELECT DATE(timestamp), count(distinct _experience.journeyOrchestration.stepEvents.journeyVersionID) FROM journey_step_events
WHERE DATE(timestamp) > (now() - interval '<last x days>' day)
GROUP BY DATE(timestamp)
ORDER BY DATE(timestamp) desc
示例
SELECT DATE(timestamp), count(distinct _experience.journeyOrchestration.stepEvents.journeyVersionID) FROM journey_step_events
WHERE DATE(timestamp) > (now() - interval '100' day)
GROUP BY DATE(timestamp)
ORDER BY DATE(timestamp) desc
查询会返回在定义的期间内,每天触发的唯一历程计数。 每天将计算一次触发多天的单个历程。
历程实例查询 journey-instances-queries
特定时间内处于特定状态的配置文件数
数据湖查询
WITH
INSTANCES_PASSED_IN_ALL_NODES_WITH_DETAILS AS (
SELECT
STEP_EVENTS.timestamp AS TS,
STEP_EVENTS._experience.journeyOrchestration.stepEvents.nodeName AS NODE_NAME,
STEP_EVENTS._experience.journeyOrchestration.stepEvents.instanceID AS ID
FROM
journey_step_events AS STEP_EVENTS
WHERE
STEP_EVENTS._experience.journeyOrchestration.stepEvents.journeyVersionName = '<journey version name>'
),
INSTANCES_PASSED_IN_NODE_WITH_DETAILS AS (
SELECT
T1.TS AS TS,
T1.ID AS ID
FROM
INSTANCES_PASSED_IN_ALL_NODES_WITH_DETAILS AS T1
WHERE
T1.NODE_NAME = '<specific node name>' AND
<filter on time for profile in specific node>
),
INSTANCES_PASSED_IN_NEXT_NODES AS (
SELECT
T1.TS AS TS,
T1.ID AS ID
FROM
INSTANCES_PASSED_IN_ALL_NODES_WITH_DETAILS AS T1
WHERE
T1.NODE_NAME in (<list of next node names from the specific node>)
),
INSTANCES_PASSED_IN_NODE_NOT_PASSED_IN_NODES AS (
SELECT
distinct T1.ID AS ID
FROM
INSTANCES_PASSED_IN_NODE_WITH_DETAILS AS T1
EXCEPT
SELECT
distinct T1.ID AS ID
FROM
INSTANCES_PASSED_IN_NEXT_NODES AS T1
)
SELECT
DATE_FORMAT(T1.TS,'<date pattern>') AS DATETIME,
count(T1.ID) AS INSTANCES_COUNT
FROM
INSTANCES_PASSED_IN_NODE_WITH_DETAILS AS T1,
INSTANCES_PASSED_IN_NODE_NOT_PASSED_IN_NODES AS T2
WHERE
T1.ID = T2.ID
GROUP BY
DATETIME
ORDER BY
DATETIME DESC
示例
WITH
INSTANCES_PASSED_IN_ALL_NODES_WITH_DETAILS AS (
SELECT
STEP_EVENTS.timestamp AS TS,
STEP_EVENTS._experience.journeyOrchestration.stepEvents.nodeName AS NODE_NAME,
STEP_EVENTS._experience.journeyOrchestration.stepEvents.instanceID AS ID
FROM
journey_step_events AS STEP_EVENTS
WHERE
STEP_EVENTS._experience.journeyOrchestration.stepEvents.journeyVersionName = 'Journey20009'
),
INSTANCES_PASSED_IN_NODE_WITH_DETAILS AS (
SELECT
T1.TS AS TS,
T1.ID AS ID
FROM
INSTANCES_PASSED_IN_ALL_NODES_WITH_DETAILS AS T1
WHERE
T1.NODE_NAME = 'slack_bso_tests - test1' AND
T1.TS > (now() - interval '18 hour')
),
INSTANCES_PASSED_IN_NEXT_NODES AS (
SELECT
T1.TS AS TS,
T1.ID AS ID
FROM
INSTANCES_PASSED_IN_ALL_NODES_WITH_DETAILS AS T1
WHERE
T1.NODE_NAME in ('slack_bso_tests - test2')
),
INSTANCES_PASSED_IN_NODE_NOT_PASSED_IN_NODES AS (
SELECT
distinct T1.ID AS ID
FROM
INSTANCES_PASSED_IN_NODE_WITH_DETAILS AS T1
EXCEPT
SELECT
distinct T1.ID AS ID
FROM
INSTANCES_PASSED_IN_NEXT_NODES AS T1
)
SELECT
DATE_FORMAT(T1.TS,'yyyy/MM/dd HH:mm') AS DATETIME,
count(T1.ID) AS INSTANCES_COUNT
FROM
INSTANCES_PASSED_IN_NODE_WITH_DETAILS AS T1,
INSTANCES_PASSED_IN_NODE_NOT_PASSED_IN_NODES AS T2
WHERE
T1.ID = T2.ID
GROUP BY
DATETIME
ORDER BY
DATETIME DESC
在特定时间段内退出历程的用户档案数
数据湖查询
SELECT
DATE_FORMAT(STEP_EVENTS.timestamp,'yyyy/MM/dd HH:mm') AS DATETIME,
count(STEP_EVENTS._experience.journeyOrchestration.stepEvents.instanceID) AS EXITED_INSTANCES_COUNT
FROM
journey_step_events AS STEP_EVENTS
WHERE
STEP_EVENTS._experience.journeyOrchestration.stepEvents.journeyVersionName = '<journey version name>' AND
STEP_EVENTS._experience.journeyOrchestration.stepEvents.stepStatus in ('endStep', 'error', 'timedOut', 'cappingError') AND
<timestamp filter>
GROUP BY
DATETIME
ORDER BY
DATETIME DESC
示例
SELECT
DATE_FORMAT(STEP_EVENTS.timestamp,'yyyy/MM/dd HH:mm') AS DATETIME,
count(STEP_EVENTS._experience.journeyOrchestration.stepEvents.instanceID) AS EXITED_INSTANCES_COUNT
FROM
journey_step_events AS STEP_EVENTS
WHERE
STEP_EVENTS._experience.journeyOrchestration.stepEvents.journeyVersionName = 'Journey20009' AND
STEP_EVENTS._experience.journeyOrchestration.stepEvents.stepStatus in ('endStep', 'error', 'timedOut', 'cappingError') AND
STEP_EVENTS.timestamp > (now() - interval '22 hour')
GROUP BY
DATETIME
ORDER BY
DATETIME DESC
在节点/状态的特定时间段内,有多少用户档案退出历程
数据湖查询
SELECT
DATE_FORMAT(STEP_EVENTS.timestamp,'yyyy/MM/dd HH:mm') AS DATETIME,
STEP_EVENTS._experience.journeyOrchestration.stepEvents.nodeName AS NODE_NAME,
STEP_EVENTS._experience.journeyOrchestration.stepEvents.stepStatus AS EXIT_STATUS,
count(STEP_EVENTS._experience.journeyOrchestration.stepEvents.instanceID) AS EXITED_INSTANCES_COUNT
FROM
journey_step_events AS STEP_EVENTS
WHERE
STEP_EVENTS._experience.journeyOrchestration.stepEvents.journeyVersionName = '<journey version name>' AND
STEP_EVENTS._experience.journeyOrchestration.stepEvents.stepStatus in ('endStep', 'error', 'timedOut', 'cappingError') AND
<timestamp filter>
GROUP BY
DATETIME, NODE_NAME, EXIT_STATUS
ORDER BY
DATETIME DESC
示例
SELECT
DATE_FORMAT(STEP_EVENTS.timestamp,'yyyy/MM/dd HH:mm') AS DATETIME,
STEP_EVENTS._experience.journeyOrchestration.stepEvents.nodeName AS NODE_NAME,
STEP_EVENTS._experience.journeyOrchestration.stepEvents.stepStatus AS EXIT_STATUS,
count(STEP_EVENTS._experience.journeyOrchestration.stepEvents.instanceID) AS EXITED_INSTANCES_COUNT
FROM
journey_step_events AS STEP_EVENTS
WHERE
STEP_EVENTS._experience.journeyOrchestration.stepEvents.journeyVersionName = 'Journey20009' AND
STEP_EVENTS._experience.journeyOrchestration.stepEvents.stepStatus in ('endStep', 'error', 'timedOut', 'cappingError') AND
STEP_EVENTS.timestamp > (now() - interval '22 hour')
GROUP BY
DATETIME, NODE_NAME, EXIT_STATUS
ORDER BY
DATETIME DESC