mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-21 07:28:44 +00:00
feat: Added custom event event type for web analytics (#10554)
* feat: Added custom event event type for web analytics * feat: renamed to * Update openmetadata-spec/src/main/resources/json/schema/analytics/webAnalyticEventType/customEvent.json Co-authored-by: Nahuel <nahuel@getcollate.io> * Update openmetadata-spec/src/main/resources/json/schema/analytics/webAnalyticEventType/customEvent.json Co-authored-by: Nahuel <nahuel@getcollate.io> * feat: move common type to basic.json * feat: ran linting --------- Co-authored-by: Nahuel <nahuel@getcollate.io>
This commit is contained in:
parent
133bdfbf64
commit
64205cf231
@ -102,7 +102,7 @@ class WebAnalyticEntityViewReportDataProcessor(DataProcessor):
|
||||
|
||||
while True:
|
||||
event = yield refined_data
|
||||
split_url = [url for url in event.eventData.url.split("/") if url] # type: ignore
|
||||
split_url = [url for url in event.eventData.url.__root__.split("/") if url] # type: ignore
|
||||
|
||||
if not split_url or split_url[0] not in ENTITIES:
|
||||
continue
|
||||
@ -118,9 +118,9 @@ class WebAnalyticEntityViewReportDataProcessor(DataProcessor):
|
||||
# if we've seen the entity previously but were not able to get
|
||||
# the URL we'll try again from the new event.
|
||||
try:
|
||||
entity_href = re.search(re_pattern, event.eventData.fullUrl).group(
|
||||
1
|
||||
)
|
||||
entity_href = re.search(
|
||||
re_pattern, event.eventData.fullUrl.__root__
|
||||
).group(1)
|
||||
refined_data[entity_obj.fqn]["entityHref"] = entity_href
|
||||
except IndexError:
|
||||
logger.debug(f"Could not find entity Href for {entity_obj.fqn}")
|
||||
@ -166,9 +166,9 @@ class WebAnalyticEntityViewReportDataProcessor(DataProcessor):
|
||||
)
|
||||
|
||||
try:
|
||||
entity_href = re.search(re_pattern, event.eventData.fullUrl).group(
|
||||
1
|
||||
)
|
||||
entity_href = re.search(
|
||||
re_pattern, event.eventData.fullUrl.__root__
|
||||
).group(1)
|
||||
except IndexError:
|
||||
entity_href = None
|
||||
|
||||
|
@ -41,7 +41,6 @@ from metadata.generated.schema.metadataIngestion.workflow import WorkflowConfig
|
||||
from metadata.generated.schema.type.basic import ComponentConfig
|
||||
from metadata.ingestion.models.encoders import show_secrets_encoder
|
||||
from metadata.ingestion.ometa.ometa_api import OpenMetadata
|
||||
from metadata.utils.constants import ES_SOURCE_TO_ES_OBJ_ARGS
|
||||
|
||||
|
||||
def data_insight_workflow(workflow_config: OpenMetadataWorkflowConfig):
|
||||
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "CustomEvent",
|
||||
"fullyQualifiedName": "CustomEvent",
|
||||
"description": "Captures web analytic custom events",
|
||||
"eventType": "CustomEvent"
|
||||
}
|
@ -9,8 +9,25 @@
|
||||
"description": "event type",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"PageView"
|
||||
"PageView",
|
||||
"CustomEvent"
|
||||
]
|
||||
},
|
||||
"fullUrl": {
|
||||
"description": "complete URL of the page",
|
||||
"type": "string"
|
||||
},
|
||||
"url": {
|
||||
"description": "url part after the domain specification",
|
||||
"type": "string"
|
||||
},
|
||||
"hostname": {
|
||||
"description": "domain name",
|
||||
"type": "string"
|
||||
},
|
||||
"sessionId": {
|
||||
"description": "Unique ID identifying a session",
|
||||
"$ref": "../type/basic.json#/definitions/uuid"
|
||||
}
|
||||
}
|
||||
}
|
@ -21,7 +21,8 @@
|
||||
"eventData": {
|
||||
"description": "Web analytic data captured",
|
||||
"oneOf": [
|
||||
{"$ref": "webAnalyticEventType/pageViewEvent.json"}
|
||||
{"$ref": "webAnalyticEventType/pageViewEvent.json"},
|
||||
{"$ref": "webAnalyticEventType/customEvent.json"}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
@ -0,0 +1,43 @@
|
||||
{
|
||||
"$id": "https://open-metadata.org/schema/analytics/customEvent.json",
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "customData",
|
||||
"type": "object",
|
||||
"javaType": "org.openmetadata.schema.analytics.CustomEvent",
|
||||
"description": "Event tracker (e.g. clicks, etc.)",
|
||||
"definitions": {
|
||||
"customEventTypes": {
|
||||
"description": "Type of events that can be performed",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"CLICK"
|
||||
]
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"fullUrl": {
|
||||
"description": "complete URL of the page",
|
||||
"$ref": "../basic.json#/definitions/fullUrl"
|
||||
},
|
||||
"url": {
|
||||
"description": "url part after the domain specification",
|
||||
"$ref": "../basic.json#/definitions/url"
|
||||
},
|
||||
"hostname": {
|
||||
"description": "domain name",
|
||||
"$ref": "../basic.json#/definitions/hostname"
|
||||
},
|
||||
"sessionId": {
|
||||
"description": "Unique ID identifying a session",
|
||||
"$ref": "../basic.json#/definitions/sessionId"
|
||||
},
|
||||
"eventType": {
|
||||
"description": "Type of event that was performed",
|
||||
"$ref": "#/definitions/customEventTypes"
|
||||
},
|
||||
"eventValue": {
|
||||
"description": "Value of the event",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
@ -8,15 +8,15 @@
|
||||
"properties": {
|
||||
"fullUrl": {
|
||||
"description": "complete URL of the page",
|
||||
"type": "string"
|
||||
"$ref": "../basic.json#/definitions/fullUrl"
|
||||
},
|
||||
"url": {
|
||||
"description": "url part after the domain specification",
|
||||
"type": "string"
|
||||
"$ref": "../basic.json#/definitions/url"
|
||||
},
|
||||
"hostname": {
|
||||
"description": "domain name",
|
||||
"type": "string"
|
||||
"$ref": "../basic.json#/definitions/hostname"
|
||||
},
|
||||
"language": {
|
||||
"description": "language set on the page",
|
||||
@ -32,7 +32,7 @@
|
||||
},
|
||||
"sessionId": {
|
||||
"description": "Unique ID identifying a session",
|
||||
"$ref": "../../type/basic.json#/definitions/uuid"
|
||||
"$ref": "../basic.json#/definitions/sessionId"
|
||||
},
|
||||
"pageLoadTime": {
|
||||
"description": "time for the page to load in seconds",
|
||||
|
Loading…
x
Reference in New Issue
Block a user