Skip to content

Commit

Permalink
Pull request #238: RUM-8084 Changing type of session and instance id
Browse files Browse the repository at this point in the history
Merge in OP/openkit-java from bugfix/RUM-8084-uia-e2e-test-testbizevents-failed-dt.rum.session.id-not-present-for-biz-events to main

* commit '33bc0c270eb0d52d07039405bdf70556b7304dbb':
  RUM-8084 Changing type of session and instance id

GitOrigin-RevId: d5cbd97e4ea079d72ab2ff829fa737e3b7d70f8d
  • Loading branch information
TheHighriser authored and openkitdt committed Nov 3, 2022
1 parent ff9ea24 commit 62fb422
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/dynatrace/openkit/protocol/Beacon.java
Original file line number Diff line number Diff line change
Expand Up @@ -857,8 +857,8 @@ public StatusResponse send(HTTPClientProvider provider, AdditionalQueryParameter
private void generateSendEventPayload(EventPayloadBuilder builder) {
builder.addOverridableAttribute(EventPayloadAttributes.TIMESTAMP, JSONNumberValue.fromLong(timingProvider.provideTimestampInNanoseconds()))
.addNonOverridableAttribute(EVENT_PAYLOAD_APPLICATION_ID, JSONStringValue.fromString(configuration.getOpenKitConfiguration().getPercentEncodedApplicationID()))
.addNonOverridableAttribute(EVENT_PAYLOAD_INSTANCE_ID, JSONNumberValue.fromLong(deviceID))
.addNonOverridableAttribute(EVENT_PAYLOAD_SESSION_ID, JSONNumberValue.fromLong(getSessionNumber()))
.addNonOverridableAttribute(EVENT_PAYLOAD_INSTANCE_ID, JSONStringValue.fromString(String.valueOf(deviceID)))
.addNonOverridableAttribute(EVENT_PAYLOAD_SESSION_ID, JSONStringValue.fromString(String.valueOf(getSessionNumber())))
.addNonOverridableAttribute("dt.rum.schema_version", JSONStringValue.fromString("1.0"))
.addOverridableAttribute(EventPayloadAttributes.APP_VERSION, JSONStringValue.fromString(configuration.getOpenKitConfiguration().getApplicationVersion()))
.addOverridableAttribute(EventPayloadAttributes.OS_NAME, JSONStringValue.fromString(configuration.getOpenKitConfiguration().getOperatingSystem()))
Expand Down
56 changes: 28 additions & 28 deletions src/test/java/com/dynatrace/openkit/protocol/BeaconTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1307,8 +1307,8 @@ public void sendValidBizEvent() {
actualAttributes.put(EventPayloadAttributes.EVENT_PROVIDER, JSONStringValue.fromString(APP_ID));
actualAttributes.put("event.name", JSONStringValue.fromString(eventType));
actualAttributes.put(EVENT_PAYLOAD_APPLICATION_ID, JSONStringValue.fromString(APP_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONNumberValue.fromLong(DEVICE_ID));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONNumberValue.fromLong(SESSION_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONStringValue.fromString(String.valueOf(DEVICE_ID)));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONStringValue.fromString(String.valueOf(SESSION_ID)));
actualAttributes.put(EventPayloadAttributes.APP_VERSION, JSONStringValue.fromString(appVersion));
actualAttributes.put(EventPayloadAttributes.OS_NAME, JSONStringValue.fromString(""));
actualAttributes.put(EventPayloadAttributes.DEVICE_MANUFACTURER, JSONStringValue.fromString(""));
Expand Down Expand Up @@ -1351,8 +1351,8 @@ public void sendBizEventWithNameInAttributes(){
actualAttributes.put("event.name", JSONStringValue.fromString("Test"));
actualAttributes.put(EventPayloadAttributes.EVENT_KIND, JSONStringValue.fromString("BIZ_EVENT"));
actualAttributes.put(EVENT_PAYLOAD_APPLICATION_ID, JSONStringValue.fromString(APP_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONNumberValue.fromLong(DEVICE_ID));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONNumberValue.fromLong(SESSION_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONStringValue.fromString(String.valueOf(DEVICE_ID)));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONStringValue.fromString(String.valueOf(SESSION_ID)));
actualAttributes.put(EventPayloadAttributes.APP_VERSION, JSONStringValue.fromString(appVersion));
actualAttributes.put(EventPayloadAttributes.OS_NAME, JSONStringValue.fromString(""));
actualAttributes.put(EventPayloadAttributes.DEVICE_MANUFACTURER, JSONStringValue.fromString(""));
Expand Down Expand Up @@ -1395,8 +1395,8 @@ public void sendBizEventWithEventProviderInAttributes(){
actualAttributes.put("event.name", JSONStringValue.fromString(eventType));
actualAttributes.put(EventPayloadAttributes.EVENT_KIND, JSONStringValue.fromString("BIZ_EVENT"));
actualAttributes.put(EVENT_PAYLOAD_APPLICATION_ID, JSONStringValue.fromString(APP_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONNumberValue.fromLong(DEVICE_ID));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONNumberValue.fromLong(SESSION_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONStringValue.fromString(String.valueOf(DEVICE_ID)));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONStringValue.fromString(String.valueOf(SESSION_ID)));
actualAttributes.put(EventPayloadAttributes.APP_VERSION, JSONStringValue.fromString(appVersion));
actualAttributes.put(EventPayloadAttributes.OS_NAME, JSONStringValue.fromString(""));
actualAttributes.put(EventPayloadAttributes.DEVICE_MANUFACTURER, JSONStringValue.fromString(""));
Expand Down Expand Up @@ -1440,8 +1440,8 @@ public void sendBizEventWithTypeAndDtTypeInAttributes(){
actualAttributes.put(EventPayloadAttributes.EVENT_PROVIDER, JSONStringValue.fromString(APP_ID));
actualAttributes.put("event.name", JSONStringValue.fromString(eventType));
actualAttributes.put(EVENT_PAYLOAD_APPLICATION_ID, JSONStringValue.fromString(APP_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONNumberValue.fromLong(DEVICE_ID));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONNumberValue.fromLong(SESSION_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONStringValue.fromString(String.valueOf(DEVICE_ID)));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONStringValue.fromString(String.valueOf(SESSION_ID)));
actualAttributes.put(EventPayloadAttributes.APP_VERSION, JSONStringValue.fromString(appVersion));
actualAttributes.put(EventPayloadAttributes.OS_NAME, JSONStringValue.fromString(""));
actualAttributes.put(EventPayloadAttributes.DEVICE_MANUFACTURER, JSONStringValue.fromString(""));
Expand Down Expand Up @@ -1489,8 +1489,8 @@ public void sendBizEventWithDtRumSchemaVersionInAttributes(){
actualAttributes.put(EventPayloadAttributes.EVENT_PROVIDER, JSONStringValue.fromString(APP_ID));
actualAttributes.put("event.name", JSONStringValue.fromString(eventType));
actualAttributes.put(EVENT_PAYLOAD_APPLICATION_ID, JSONStringValue.fromString(APP_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONNumberValue.fromLong(DEVICE_ID));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONNumberValue.fromLong(SESSION_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONStringValue.fromString(String.valueOf(DEVICE_ID)));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONStringValue.fromString(String.valueOf(SESSION_ID)));
actualAttributes.put(EventPayloadAttributes.APP_VERSION, JSONStringValue.fromString(appVersion));
actualAttributes.put(EventPayloadAttributes.OS_NAME, JSONStringValue.fromString(""));
actualAttributes.put(EventPayloadAttributes.DEVICE_MANUFACTURER, JSONStringValue.fromString(""));
Expand Down Expand Up @@ -1537,8 +1537,8 @@ public void sendBizEventWithDtRumCustomAttributeSizeInAttributes(){
actualAttributes.put(EventPayloadAttributes.EVENT_PROVIDER, JSONStringValue.fromString(APP_ID));
actualAttributes.put("event.name", JSONStringValue.fromString(eventType));
actualAttributes.put(EVENT_PAYLOAD_APPLICATION_ID, JSONStringValue.fromString(APP_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONNumberValue.fromLong(DEVICE_ID));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONNumberValue.fromLong(SESSION_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONStringValue.fromString(String.valueOf(DEVICE_ID)));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONStringValue.fromString(String.valueOf(SESSION_ID)));
actualAttributes.put(EventPayloadAttributes.APP_VERSION, JSONStringValue.fromString(appVersion));
actualAttributes.put(EventPayloadAttributes.OS_NAME, JSONStringValue.fromString(""));
actualAttributes.put(EventPayloadAttributes.DEVICE_MANUFACTURER, JSONStringValue.fromString(""));
Expand Down Expand Up @@ -1606,8 +1606,8 @@ public void sendBizEventWithEmptyPayload() {
actualAttributes.put(EventPayloadAttributes.EVENT_PROVIDER, JSONStringValue.fromString(APP_ID));
actualAttributes.put("event.name", JSONStringValue.fromString(eventType));
actualAttributes.put(EVENT_PAYLOAD_APPLICATION_ID, JSONStringValue.fromString(APP_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONNumberValue.fromLong(DEVICE_ID));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONNumberValue.fromLong(SESSION_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONStringValue.fromString(String.valueOf(DEVICE_ID)));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONStringValue.fromString(String.valueOf(SESSION_ID)));
actualAttributes.put(EventPayloadAttributes.APP_VERSION, JSONStringValue.fromString(appVersion));
actualAttributes.put(EventPayloadAttributes.OS_NAME, JSONStringValue.fromString(""));
actualAttributes.put(EventPayloadAttributes.DEVICE_MANUFACTURER, JSONStringValue.fromString(""));
Expand Down Expand Up @@ -1648,8 +1648,8 @@ public void sendBizEventWithNullPayload() {
actualAttributes.put(EventPayloadAttributes.EVENT_PROVIDER, JSONStringValue.fromString(APP_ID));
actualAttributes.put("event.name", JSONStringValue.fromString(eventType));
actualAttributes.put(EVENT_PAYLOAD_APPLICATION_ID, JSONStringValue.fromString(APP_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONNumberValue.fromLong(DEVICE_ID));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONNumberValue.fromLong(SESSION_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONStringValue.fromString(String.valueOf(DEVICE_ID)));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONStringValue.fromString(String.valueOf(SESSION_ID)));
actualAttributes.put(EventPayloadAttributes.APP_VERSION, JSONStringValue.fromString(appVersion));
actualAttributes.put(EventPayloadAttributes.OS_NAME, JSONStringValue.fromString(""));
actualAttributes.put(EventPayloadAttributes.DEVICE_MANUFACTURER, JSONStringValue.fromString(""));
Expand Down Expand Up @@ -1764,8 +1764,8 @@ public void sendValidEvent() {
actualAttributes.put(EventPayloadAttributes.EVENT_KIND, JSONStringValue.fromString("RUM_EVENT"));
actualAttributes.put(EventPayloadAttributes.EVENT_PROVIDER, JSONStringValue.fromString(APP_ID));
actualAttributes.put(EVENT_PAYLOAD_APPLICATION_ID, JSONStringValue.fromString(APP_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONNumberValue.fromLong(DEVICE_ID));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONNumberValue.fromLong(SESSION_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONStringValue.fromString(String.valueOf(DEVICE_ID)));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONStringValue.fromString(String.valueOf(SESSION_ID)));
actualAttributes.put(EventPayloadAttributes.APP_VERSION, JSONStringValue.fromString(appVersion));
actualAttributes.put(EventPayloadAttributes.OS_NAME, JSONStringValue.fromString(""));
actualAttributes.put(EventPayloadAttributes.DEVICE_MANUFACTURER, JSONStringValue.fromString(""));
Expand Down Expand Up @@ -1808,8 +1808,8 @@ public void sendEventWithDtType() {
actualAttributes.put(EventPayloadAttributes.EVENT_PROVIDER, JSONStringValue.fromString(APP_ID));
actualAttributes.put(EventPayloadAttributes.TIMESTAMP, JSONNumberValue.fromLong(0));
actualAttributes.put(EVENT_PAYLOAD_APPLICATION_ID, JSONStringValue.fromString(APP_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONNumberValue.fromLong(DEVICE_ID));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONNumberValue.fromLong(SESSION_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONStringValue.fromString(String.valueOf(DEVICE_ID)));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONStringValue.fromString(String.valueOf(SESSION_ID)));
actualAttributes.put(EventPayloadAttributes.APP_VERSION, JSONStringValue.fromString(appVersion));
actualAttributes.put(EventPayloadAttributes.OS_NAME, JSONStringValue.fromString(""));
actualAttributes.put(EventPayloadAttributes.DEVICE_MANUFACTURER, JSONStringValue.fromString(""));
Expand Down Expand Up @@ -1853,8 +1853,8 @@ public void sendEventWithEventProviderInAttributes() {
actualAttributes.put(EventPayloadAttributes.EVENT_PROVIDER, JSONStringValue.fromString("Anything"));
actualAttributes.put(EventPayloadAttributes.TIMESTAMP, JSONNumberValue.fromLong(0));
actualAttributes.put(EVENT_PAYLOAD_APPLICATION_ID, JSONStringValue.fromString(APP_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONNumberValue.fromLong(DEVICE_ID));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONNumberValue.fromLong(SESSION_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONStringValue.fromString(String.valueOf(DEVICE_ID)));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONStringValue.fromString(String.valueOf(SESSION_ID)));
actualAttributes.put(EventPayloadAttributes.APP_VERSION, JSONStringValue.fromString(appVersion));
actualAttributes.put(EventPayloadAttributes.OS_NAME, JSONStringValue.fromString(""));
actualAttributes.put(EventPayloadAttributes.DEVICE_MANUFACTURER, JSONStringValue.fromString(""));
Expand Down Expand Up @@ -1895,8 +1895,8 @@ public void sendEventWithDtRumSchemaInAttributes() {
actualAttributes.put(EventPayloadAttributes.EVENT_PROVIDER, JSONStringValue.fromString(APP_ID));
actualAttributes.put(EventPayloadAttributes.TIMESTAMP, JSONNumberValue.fromLong(0));
actualAttributes.put(EVENT_PAYLOAD_APPLICATION_ID, JSONStringValue.fromString(APP_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONNumberValue.fromLong(DEVICE_ID));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONNumberValue.fromLong(SESSION_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONStringValue.fromString(String.valueOf(DEVICE_ID)));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONStringValue.fromString(String.valueOf(SESSION_ID)));
actualAttributes.put(EventPayloadAttributes.APP_VERSION, JSONStringValue.fromString(appVersion));
actualAttributes.put(EventPayloadAttributes.OS_NAME, JSONStringValue.fromString(""));
actualAttributes.put(EventPayloadAttributes.DEVICE_MANUFACTURER, JSONStringValue.fromString(""));
Expand Down Expand Up @@ -1967,8 +1967,8 @@ public void sendEventWithEmptyPayload() {
actualAttributes.put(EventPayloadAttributes.EVENT_KIND, JSONStringValue.fromString("RUM_EVENT"));
actualAttributes.put(EventPayloadAttributes.EVENT_PROVIDER, JSONStringValue.fromString(APP_ID));
actualAttributes.put(EVENT_PAYLOAD_APPLICATION_ID, JSONStringValue.fromString(APP_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONNumberValue.fromLong(DEVICE_ID));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONNumberValue.fromLong(SESSION_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONStringValue.fromString(String.valueOf(DEVICE_ID)));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONStringValue.fromString(String.valueOf(SESSION_ID)));
actualAttributes.put(EventPayloadAttributes.APP_VERSION, JSONStringValue.fromString(appVersion));
actualAttributes.put(EventPayloadAttributes.OS_NAME, JSONStringValue.fromString(""));
actualAttributes.put(EventPayloadAttributes.DEVICE_MANUFACTURER, JSONStringValue.fromString(""));
Expand Down Expand Up @@ -2007,8 +2007,8 @@ public void sendEventWithNullPayload() {
actualAttributes.put(EventPayloadAttributes.EVENT_KIND, JSONStringValue.fromString("RUM_EVENT"));
actualAttributes.put(EventPayloadAttributes.EVENT_PROVIDER, JSONStringValue.fromString(APP_ID));
actualAttributes.put(EVENT_PAYLOAD_APPLICATION_ID, JSONStringValue.fromString(APP_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONNumberValue.fromLong(DEVICE_ID));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONNumberValue.fromLong(SESSION_ID));
actualAttributes.put(EVENT_PAYLOAD_INSTANCE_ID, JSONStringValue.fromString(String.valueOf(DEVICE_ID)));
actualAttributes.put(EVENT_PAYLOAD_SESSION_ID, JSONStringValue.fromString(String.valueOf(SESSION_ID)));
actualAttributes.put(EventPayloadAttributes.APP_VERSION, JSONStringValue.fromString(appVersion));
actualAttributes.put(EventPayloadAttributes.OS_NAME, JSONStringValue.fromString(""));
actualAttributes.put(EventPayloadAttributes.DEVICE_MANUFACTURER, JSONStringValue.fromString(""));
Expand Down

0 comments on commit 62fb422

Please sign in to comment.