feat(bottlecap): create Inferred Spans baseline + infer API Gateway HTTP spans#405
Conversation
added `Datadog` and `Tracecontext` implementations
…to jordan.gonzalez/bottlecap/add-trace-propagator
| } | ||
|
|
||
| #[allow(clippy::module_name_repetitions)] | ||
| #[derive(Debug, Clone)] |
There was a problem hiding this comment.
Do we need to add clone trait here?
I thought the configs were immutable and passed as ref/Arc everywhere
|
|
||
| pub trait Trigger: Sized { | ||
| fn new(payload: Value) -> Option<Self>; | ||
| fn is_match(payload: &Value) -> bool; |
There was a problem hiding this comment.
Would it be more convenient to have a general matching function returning a type instead of is_match for every subclass? To avoid doing is_match till something matches and maybe hiding bugs when a match hides running other match logic
There was a problem hiding this comment.
I thought so, but I wanted to not have to separate payload-specific logic into its own trait, I'm still exploring the idea, but I think this might change depending on how it would look like when we add more cases.
How would you change this code? My main constraints are: not deserialize on every match, just deserialize once into serde_json::Value and then try to find the actual type of the trigger, wdyt?
|
|
||
| fn generate_span_id() -> u64 { | ||
| // todo: secure random id with OsRng for SnapStart | ||
| let mut rng = rand::thread_rng(); |
There was a problem hiding this comment.
we should do this before merge, I can take a look if you want
There was a problem hiding this comment.
Ok, should be a simple fix, will look into it tomorrow – what do you mean by tags like cold start?
There was a problem hiding this comment.
You've got a comment in the code about adding tags for cold starts/proactive inits on the span
astuyve
left a comment
There was a problem hiding this comment.
looks good to me except rng and tags like cold start.
…TTP spans (#405) * add `Trigger` trait for inferred spans * add `ApiGatewayHttpEvent` trigger * add `SpanInferrer` * make `invocation::processor` to use `SpanInferrer` * send `aws_config` to `invocation::processor` * use incoming payload for `invocation::processor` for span inferring * add `api_gateway_http_event.json` for testing * add `api_gateway_proxy_event.json` for testing * fix: Convert tag hashmap to sorted vector of tags * fix: fmt --------- Co-authored-by: AJ Stuyvenberg <astuyve@gmail.com>
…TTP spans (#405) * add `Trigger` trait for inferred spans * add `ApiGatewayHttpEvent` trigger * add `SpanInferrer` * make `invocation::processor` to use `SpanInferrer` * send `aws_config` to `invocation::processor` * use incoming payload for `invocation::processor` for span inferring * add `api_gateway_http_event.json` for testing * add `api_gateway_proxy_event.json` for testing * fix: Convert tag hashmap to sorted vector of tags * fix: fmt --------- Co-authored-by: AJ Stuyvenberg <astuyve@gmail.com>
…TTP spans (#405) * add `Trigger` trait for inferred spans * add `ApiGatewayHttpEvent` trigger * add `SpanInferrer` * make `invocation::processor` to use `SpanInferrer` * send `aws_config` to `invocation::processor` * use incoming payload for `invocation::processor` for span inferring * add `api_gateway_http_event.json` for testing * add `api_gateway_proxy_event.json` for testing * fix: Convert tag hashmap to sorted vector of tags * fix: fmt --------- Co-authored-by: AJ Stuyvenberg <astuyve@gmail.com>
…TTP spans (#405) * add `Trigger` trait for inferred spans * add `ApiGatewayHttpEvent` trigger * add `SpanInferrer` * make `invocation::processor` to use `SpanInferrer` * send `aws_config` to `invocation::processor` * use incoming payload for `invocation::processor` for span inferring * add `api_gateway_http_event.json` for testing * add `api_gateway_proxy_event.json` for testing * fix: Convert tag hashmap to sorted vector of tags * fix: fmt --------- Co-authored-by: AJ Stuyvenberg <astuyve@gmail.com>
What?
Motivation
Notes