Skip to content

Implement Datastream override feature + Unit tests + Integration tests#152

Merged
addb merged 10 commits intoadobe:datastreamOverridefrom
addb:datastreamOverride
Apr 29, 2024
Merged

Implement Datastream override feature + Unit tests + Integration tests#152
addb merged 10 commits intoadobe:datastreamOverridefrom
addb:datastreamOverride

Conversation

@addb
Copy link
Copy Markdown
Contributor

@addb addb commented Apr 23, 2024

Implement datastream override feature.

Expected implementation:

data = {
    "xdm" : {
        "xdmKey" : "value"
    },
    "data" : {
        "key" : "value",
     },
    "config": {
        "datastreamIdOverride" : "<DATASTREAM_ID_OVERRIDE_VALUE>"
    }
} 

''' sendEvent with datastream Id override
sendEvent(data)
data = {
    "xdm" : {
        "xdmKey" : "value"
    },
    "data" : {
        "key" : "value",
     },
    "config": {
        "datastreamConfigOverride" : {
            "com_adobe_analytics": {
                "reportSuites": [
                    "reportSuite1",
                    "reportSuite2"
                ]
            },
            "com_adobe_target": {
                "enabled": false
            },
        }
    }
} 

''' sendEvent with datastream config override
sendEvent(data)

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@addb addb linked an issue Apr 23, 2024 that may be closed by this pull request
@addb addb requested a review from emdobrin April 23, 2024 21:19

_processRequest: function(eventData as object, ecid as string, configId as string, requestId as string, path as string, edgeDomain = invalid as dynamic) as object
requestBody = m._createEdgeRequestBody(eventData, ecid)
_processRequest: function(eventData as object, ecid as string, datastreamId as string, requestId as string, path as string, meta = {} as object, edgeDomain = invalid as dynamic) as object
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with the function's usage, but I prefer appending new default parameters to the end of the parameter list. Regarding "meta" do we require a default value considering we perform error checks within the function?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently there are no other modules (media) passing meta to the edge request worker. I noticed worker.add() takes in a meta but we were not sending it. I went ahead and added it. But we can also remove passing the meta. from outside to edgeRequestWorker.

@addb addb linked an issue Apr 29, 2024 that may be closed by this pull request
@addb addb changed the title Implement Datastream override feature + Unit tests Implement Datastream override feature + Unit tests + Integration tests Apr 29, 2024
end function

worker = _adb_EdgeRequestWorker()
networkResponse = worker._processRequest({ xdm: { key: "value" }, config: { key: "value"} }, "ecid_test", "config_id", "request_id", "/ee/v1/interact", invalid, invalid)
Copy link
Copy Markdown

@praveek praveek Apr 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can you change config from

config: {
   key: "value" 
} 

to

config: {
  key1: "value1" 
}

It is confusing when xdm and config has same key and value.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add a test scenario where the data types for datastreamOverrideId and datastreamConfigOverride are not the types that are expected?

@addb addb merged commit 20d8fb4 into adobe:datastreamOverride Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Integration tests for Datastream Overrides using sendEvent API Implement Datastream override for sendEvent

3 participants