Skip to content

feat(bottlecap): add EventBridge inferred spans#436

Merged
alexgallotta merged 16 commits intojordan.gonzalez/bottlecap/universal-instrumentationfrom
alexgallotta/event-bridge
Nov 11, 2024
Merged

feat(bottlecap): add EventBridge inferred spans#436
alexgallotta merged 16 commits intojordan.gonzalez/bottlecap/universal-instrumentationfrom
alexgallotta/event-bridge

Conversation

@alexgallotta
Copy link
Copy Markdown
Contributor

@alexgallotta alexgallotta commented Nov 6, 2024

Notes

Not doing EB-SQS or EB-SNS yet

@alexgallotta alexgallotta changed the base branch from main to jordan.gonzalez/bottlecap/universal-instrumentation November 6, 2024 19:06
@alexgallotta alexgallotta force-pushed the alexgallotta/event-bridge branch from 7b4d887 to 099b690 Compare November 6, 2024 19:25
Comment thread bottlecap/tests/payloads/event_bridge_span.json
Comment thread bottlecap/tests/payloads/event_bridge.json Outdated
Comment thread bottlecap/src/lifecycle/invocation/span_inferrer.rs Outdated
@alexgallotta alexgallotta marked this pull request as ready for review November 7, 2024 18:45
@alexgallotta alexgallotta requested a review from a team as a code owner November 7, 2024 18:45
@alexgallotta alexgallotta force-pushed the alexgallotta/event-bridge branch from 30cefa3 to bffce63 Compare November 7, 2024 19:30
@duncanista duncanista changed the title Alexgallotta/event bridge feat(bottlecap): add EventBridge inferred spans Nov 8, 2024
@alexgallotta alexgallotta force-pushed the alexgallotta/event-bridge branch from bffce63 to 5e6992b Compare November 8, 2024 18:05
Comment on lines +42 to +45
&& payload
.get("source")
.and_then(Value::as_str)
.map_or(false, |s| s != "aws.events")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this missed check

pub id: String,
pub version: String,
pub account: String,
pub time: DateTime<Utc>,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converted this into DateTime<Utc>

Comment on lines +82 to +86
if let Ok(detail) = serde_json::from_value::<HashMap<String, Value>>(self.detail.clone()) {
if let Some(carrier) = detail.get(DATADOG_CARRIER_KEY) {
return serde_json::from_value::<HashMap<String, String>>(carrier.clone())
.unwrap_or_default();
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the carrier code here, I really liked how we expect the detail to be a Value, might be really important to do this in every other field which could be a carrier

@duncanista
Copy link
Copy Markdown
Contributor

Actually, before merging, we might want to use the work @nhulston did to get an accurate time for EventBridge

Comment on lines +60 to +67
let resource_name = carrier
.get(DATADOG_RESOURCE_NAME_KEY)
.unwrap_or(&self.source)
.clone();
let start_time = carrier
.get(DATADOG_START_TIME_KEY)
.and_then(|s| s.parse::<f64>().ok())
.map_or(start_time_seconds, |s| (s * MS_TO_NS) as i64);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added resource name and start time accurate resolution when available

@alexgallotta alexgallotta merged commit 8728297 into jordan.gonzalez/bottlecap/universal-instrumentation Nov 11, 2024
@alexgallotta alexgallotta deleted the alexgallotta/event-bridge branch November 11, 2024 16:20
duncanista added a commit that referenced this pull request Nov 15, 2024
* add eventbridge event

* fix test path

* add comments with code ref and fix metadata api-gateway

* fix error message

* clean import

* make build faster using host network

* fix conflicts and tests

* fix test conflicts

* resolve merge conflicts

* minor changes

* add missing unit test

* update events for testing

* account for millisecond resolution and resource name

* fix unit tests

* remove `network` tag for runners

---------

Co-authored-by: jordan gonzález <30836115+duncanista@users.noreply.github.com>
duncanista added a commit that referenced this pull request Nov 19, 2024
* add eventbridge event

* fix test path

* add comments with code ref and fix metadata api-gateway

* fix error message

* clean import

* make build faster using host network

* fix conflicts and tests

* fix test conflicts

* resolve merge conflicts

* minor changes

* add missing unit test

* update events for testing

* account for millisecond resolution and resource name

* fix unit tests

* remove `network` tag for runners

---------

Co-authored-by: jordan gonzález <30836115+duncanista@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants