I’m attempting to send events through an existing ...
# support
w
I’m attempting to send events through an existing integration from rudderstack -> Amplitude. With the Amplitude tracking API you can pass in a custom time event. It appears that the Rudderstack library is replacing the custom time I send in the event body with the current time. Is it possible to use a custom time on an event through Rudderstack?
What I send (uploaded via Ruby
rudder_analytics_sync
gem)
Copy code
event = { user_id: 111, event: 'event_name', time: 1672277135000, properties: {...}}
RudderAnalytics.track(event)
What I see via Rudderstack Live Events
Copy code
{
  "body": {
    "XML": {},
    "FORM": {},
    "JSON": {
      "events": [
        {
          "ip": "redacted",
          "time": 1672957502039,
          "library": "rudderstack",
          "user_id": 111,
          "insert_id": "redacted",
          "event_type": "event_name",
          "session_id": -1,
          "user_properties": {},
          "event_properties": {
            ...,
          }
        }
      ],
      "api_key": "redacted",
      "options": {
        "min_id_length": 1
      }
    },
    "JSON_ARRAY": {}
  },
  "type": "REST",
  "files": {},
  "method": "POST",
  "params": {},
  "userId": "",
  "headers": {
    "Content-Type": "application/json"
  },
  "version": "1",
  "endpoint": "https://api2.amplitude.com/2/httpapi"
}
I’ve also seen in the docs here that the rudderstack tracking call takes an optional
timestamp
param, but that hasn’t worked either
I’ve confirmed the
timestamp
on the incoming event from the source (via the source Live Events) is correct.
Copy code
{
  "context": {
    "library": {
      "name": "rudder-sdk-ruby-sync",
      "version": "1.0.7"
    },
    "traits": {}
  },
  "event": "event name",
  "integrations": {
    "All": true
  },
  "messageId": "redacted",
  "properties": {
    ...
  },
  "rudderId": "redacted",
  "sentAt": "2023-01-05T23:25:16.430Z",
  "timestamp": "2022-12-29T01:25:35.000+00:00",
  "type": "track",
  "userId": 111
}
I’ve been walking through rudderstack server code: The
timestamp
is used from the incoming event to set the
time
field on the outgoing message here. That function looks up mappings stored here. The problem I see with this mapping is that the
originalTimestamp
which is used first cannot be sent via the ruby sdk and according to docs used to calculated
timestamp
if it is not manually specified. So it seems that the order here
Copy code
"timestamp": ["originalTimestamp", "timestamp"],
should be flipped.
c
You can use RudderStack transformation feature to solve this issue: https://www.rudderstack.com/docs/features/transformations/
Transformations feature enables you to write custom JavaScript functions to implement specific use-cases on your event data
By using transformation you can convert the parameter
timestamp
to
originalTimestamp
in the payload. This would solve your issue.
👍 2
gratitude thank you 1
b
@shy-kite-21035 will this issue just be fixed by rudderstack vs having to use transformations to resolve a bug?