Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add trace_id to metering events #4

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions metering.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type Event struct {
UserID string `json:"user_id"`
ApiKeyID string `json:"api_key_id"`
IpAddress string `json:"ip_address"`
TraceId string `json:"trace_id"`

Meta string `json:"meta"`

Expand All @@ -35,6 +36,9 @@ func (ev Event) MarshalLogObject(enc zapcore.ObjectEncoder) error {
if ev.IpAddress != "" {
enc.AddString("ip_address", ev.IpAddress)
}
if ev.TraceId != "" {
enc.AddString("trace_id", ev.TraceId)
}

enc.AddString("endpoint", ev.Endpoint)
enc.AddTime("timestamp", ev.Timestamp)
Expand All @@ -54,6 +58,7 @@ func (ev Event) ToProto(network string) *pbmetering.Event {
pbev.UserId = ev.UserID
pbev.ApiKeyId = ev.ApiKeyID
pbev.IpAddress = ev.IpAddress
pbev.TraceId = ev.TraceId
pbev.Meta = ev.Meta

pbev.Metrics = []*pbmetering.Metric{}
Expand Down
4 changes: 2 additions & 2 deletions pb/last_generate.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
generate.sh - Fri Nov 17 10:25:51 CET 2023 - fred
streamingfast/proto revision: d679ab21d7ff7f59eff8eb89611529eab7350767
generate.sh - Tue Feb 6 15:42:20 CET 2024 - fred
streamingfast/proto revision: 56cb133250ea92a16d3edd4a0afbf1c4f8a9331e
56 changes: 33 additions & 23 deletions pb/sf/metering/v1/metering.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pb/sf/metering/v1/metering_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion proto/sf/metering/v1/metering.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ message Events {

message Event {
string user_id = 1;
string api_key_id = 2;
string api_key_id = 2;
string ip_address = 3;

// Defines the endpoint that emitted the event (sf.firehose.v1/Blocks ...)
Expand All @@ -26,6 +26,8 @@ message Event {
// Defines the blockchain (eth-mainnet, sol-mainnet ...)
string network = 5;

string trace_id = 6;

string meta = 7;

repeated Metric metrics = 20;
Expand Down