-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CT-708] Indexer track e2e latency (#1237)
* fwd through message times * use the var i made * post processing stat emission * post-forwarding timestamp * pass through event type from vulcan * event type to stat emissions * test fix function calls * WIP WIP WIP * fix tests * unused import * test that kafka messages are threaded
1 parent
a91c1ca
commit f46c966
Showing
16 changed files
with
234 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Timestamp } from './codegen/google/protobuf/timestamp'; | ||
|
||
export const MILLIS_IN_NANOS: number = 1_000_000; | ||
export const SECONDS_IN_MILLIS: number = 1_000; | ||
export function protoTimestampToDate( | ||
protoTime: Timestamp, | ||
): Date { | ||
const timeInMillis: number = Number(protoTime.seconds) * SECONDS_IN_MILLIS + | ||
Math.floor(protoTime.nanos / MILLIS_IN_NANOS); | ||
|
||
return new Date(timeInMillis); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { | ||
MILLIS_IN_NANOS, | ||
SECONDS_IN_MILLIS, | ||
Timestamp, | ||
protoTimestampToDate, | ||
} from '@dydxprotocol-indexer/v4-protos'; | ||
import { IHeaders } from 'kafkajs'; | ||
import Long from 'long'; | ||
import { DateTime } from 'luxon'; | ||
|
||
const defaultDateTime: DateTime = DateTime.utc(2022, 6, 1, 12, 1, 1, 2); | ||
export const defaultTime: Timestamp = { | ||
seconds: Long.fromValue(Math.floor(defaultDateTime.toSeconds()), true), | ||
nanos: (defaultDateTime.toMillis() % SECONDS_IN_MILLIS) * MILLIS_IN_NANOS, | ||
}; | ||
|
||
export const defaultKafkaHeaders: IHeaders = { | ||
message_received_timestamp: String(protoTimestampToDate(defaultTime)), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
indexer/services/vulcan/__tests__/helpers/websocket-helpers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters