-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix and update telemetry properties and tests (#456)
- Loading branch information
1 parent
d86557b
commit f8dc5a2
Showing
3 changed files
with
111 additions
and
194 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 |
---|---|---|
@@ -1,17 +1,26 @@ | ||
package com.checkout; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
public class RequestMetrics { | ||
|
||
@SerializedName("prev_request_id") | ||
private String prevRequestId; | ||
|
||
@SerializedName("request_id") | ||
private String requestId; | ||
|
||
@SerializedName("prev_request_duration") | ||
private Long prevRequestDuration; | ||
private String prevRequestId; | ||
|
||
public RequestMetrics(Long prevRequestDuration, String prevRequestId) { | ||
this.prevRequestDuration = prevRequestDuration; | ||
this.prevRequestId = prevRequestId; | ||
public String toTelemetryHeader() { | ||
return String.format("{\"prev_request_id\":\"%s\",\"request_id\":\"%s\",\"prev_request_duration\":%d}", | ||
prevRequestId != null ? prevRequestId : "N/A", | ||
requestId != null ? requestId : "N/A", | ||
prevRequestDuration != null ? prevRequestDuration : 0); | ||
} | ||
} | ||
} |
Oops, something went wrong.