Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ED-2877 : new druid ingestion spec added #1627

Open
wants to merge 1 commit into
base: release-5.2.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ansible/roles/druid-ingestion/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ rollup_ml_project_taskcount: 1
rollup_ml_observation_status_taskcount: 1
rollup_ml_project_status_taskcount: 1
rollup_ml_survey_status_taskcount: 1
ml_user_program_task_count: 1

187 changes: 187 additions & 0 deletions ansible/roles/druid-ingestion/templates/rollup_ml_user_program
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
{
"type": "kafka",
"dataSchema": {
"dataSource": "ml-user-program",
"parser": {
"type": "string",
"parseSpec": {
"format": "json",
"flattenSpec": {
"useFieldDiscovery": true,
"fields": [
{
"type": "jq",
"name": "user_id",
"expr": ".userId"
},
{
"type": "jq",
"name": "program_id",
"expr": ".programId"
},
{
"type": "jq",
"name": "program_externalId",
"expr": ".programExternalId"
},
{
"type": "jq",
"name": "program_name",
"expr": ".programName"
},
{
"type": "jq",
"name": "state_externalId",
"expr": "if [.userProfile ? |.userLocations [] ? | select(.type | contains(\"state\"))] | length > 0 then .userProfile ? |.userLocations [] ? | select(.type | contains(\"state\")) | .id else null end"
},
{
"type": "jq",
"name": "state_name",
"expr": "if [.userProfile ? |.userLocations [] ? | select(.type | contains(\"state\"))] | length > 0 then .userProfile ? |.userLocations [] ? | select(.type | contains(\"state\")) | .name else null end"
},
{
"type": "jq",
"name": "district_externalId",
"expr": "if [.userProfile ? |.userLocations [] ? | select(.type | contains(\"district\"))] | length > 0 then .userProfile ? |.userLocations [] ? | select(.type | contains(\"district\")) | .id else null end"
},
{
"type": "jq",
"name": "district_name",
"expr": "if [.userProfile ? |.userLocations [] ? | select(.type | contains(\"district\"))] | length > 0 then .userProfile ? |.userLocations [] ? | select(.type | contains(\"district\")) | .name else null end"
},
{
"type": "jq",
"name": "block_externalId",
"expr": "if [.userProfile ? |.userLocations [] ? | select(.type | contains(\"block\"))] | length > 0 then .userProfile ? |.userLocations [] ? | select(.type | contains(\"block\")) | .id else null end"
},
{
"type": "jq",
"name": "block_name",
"expr": "if [.userProfile ? |.userLocations [] ? | select(.type | contains(\"block\"))] | length > 0 then .userProfile ? |.userLocations [] ? | select(.type | contains(\"block\")) | .name else null end"
},
{
"type": "jq",
"name": "cluster_externalId",
"expr": "if [.userProfile ? |.userLocations [] ? | select(.type | contains(\"cluster\"))] | length > 0 then .userProfile ? |.userLocations [] ? | select(.type | contains(\"cluster\")) | .id else null end"
},
{
"type": "jq",
"name": "cluster_name",
"expr": "if [.userProfile ? |.userLocations [] ? | select(.type | contains(\"cluster\"))] | length > 0 then .userProfile ? |.userLocations [] ? | select(.type | contains(\"cluster\")) | .name else null end"
},
{
"type": "jq",
"name": "organisation_id",
"expr": "if [.userProfile? | .organisations[]? | select (.isSchool == false)] | length > 0 then .userProfile? | .organisations[]? | select(.isSchool == false) | .organisationId else null end"
},
{
"type": "jq",
"name": "organisation_name",
"expr": "if [.userProfile? | .organisations[]? | select (.isSchool == false)] | length > 0 then .userProfile? | .organisations[]? | select(.isSchool == false) | .orgName else null end"
}
]
},
"dimensionsSpec": {
"dimensions": [
{
"type": "string",
"name": "program_id"
},
{
"type": "string",
"name": "program_externalId"
},
{
"type": "string",
"name": "program_name"
},
{
"type": "string",
"name": "state_externalId"
},
{
"type": "string",
"name": "state_name"
},
{
"type": "string",
"name": "district_externalId"
},
{
"type": "string",
"name": "district_name"
},
{
"type": "string",
"name": "block_externalId"
},
{
"type": "string",
"name": "block_name"
},
{
"type": "string",
"name": "cluster_externalId"
},
{
"type": "string",
"name": "cluster_name"
},
{
"type": "string",
"name": "organisation_id"
},
{
"type": "string",
"name": "organisation_name"
}
],
"dimensionsExclusions": []
},
"timestampSpec": {
"column": "createdAt",
"format": "iso"
}
}
},
"metricsSpec": [
{
"type": "longSum",
"name": "sum_user",
"fieldName": "user_id"
},
{
"type": "HLLSketchBuild",
"name": "unique_users",
"fieldName": "user_id"
},
{
"type": "count",
"name": "count_user"
}
],
"granularitySpec": {
"type": "uniform",
"segmentGranularity": "day",
"queryGranularity": "day",
"rollup": false
}
},
"ioConfig": {
"topic": "{{Env}}.programuser.info",
"consumerProperties": {
"bootstrap.servers": "{{kafka_brokers}}"
},
"taskCount": "{{ml_user_program_task_count}}",
"replicas": 1,
"taskDuration": "PT14400S",
"useEarliestOffset": false,
"completionTimeout": "PT1800S"
},
"tuningConfig": {
"type": "kafka",
"reportParseExceptions": false,
"maxRowsPerSegment": 5000000
}
}

Loading