Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ members = [
]

[workspace.dependencies]
vrl = { version = "0.7.0", default-features = false, features = ["cli", "test", "test_framework", "arbitrary", "compiler", "value", "diagnostic", "path", "parser", "stdlib", "datadog", "core"] }
vrl = { version = "0.7.0", features = ["cli"] }

pin-project = { version = "1.1.3", default-features = false }

Expand Down
17 changes: 13 additions & 4 deletions src/enrichment_tables/geoip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
//! [geolite]: https://dev.maxmind.com/geoip/geoip2/geolite2/#Download_Access
use std::{collections::BTreeMap, fs, net::IpAddr, sync::Arc, time::SystemTime};

use enrichment::{Case, Condition, IndexHandle, Table};
use maxminddb::{
geoip2::{City, ConnectionType, Isp},
MaxMindDBError, Reader,
};
use vector_config::configurable_component;
use ordered_float::NotNan;
use vrl::value::Value;

use enrichment::{Case, Condition, IndexHandle, Table};
use vector_config::configurable_component;

use crate::config::{EnrichmentTableConfig, GenerateConfig};

// MaxMind GeoIP database files have a type field we can use to recognize specific
Expand Down Expand Up @@ -180,10 +182,17 @@ impl Geoip {

let location = data.location.as_ref();
add_field!("timezone", location.and_then(|location| location.time_zone));
add_field!("latitude", location.and_then(|location| location.latitude));
add_field!(
"latitude",
location
.and_then(|location| location.latitude)
.map(|latitude| Value::Float(NotNan::new(latitude).unwrap()))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Removing the test feature reveals a 'hidden' unwrap call. See here.

);
add_field!(
"longitude",
location.and_then(|location| location.longitude)
location
.and_then(|location| location.longitude)
.map(|longitude| NotNan::new(longitude).unwrap())
);
add_field!(
"metro_code",
Expand Down
15 changes: 11 additions & 4 deletions src/sources/datadog_agent/traces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ use futures::future;
use http::StatusCode;
use ordered_float::NotNan;
use prost::Message;
use vector_common::internal_event::{CountByteSize, InternalEventHandle as _};
use vector_core::EstimatedJsonEncodedSizeOf;
use vrl::event_path;
use warp::{filters::BoxedFilter, path, path::FullPath, reply::Response, Filter, Rejection, Reply};

use vector_common::internal_event::{CountByteSize, InternalEventHandle as _};
use vector_core::EstimatedJsonEncodedSizeOf;

use crate::{
event::{Event, TraceEvent, Value},
sources::{
Expand Down Expand Up @@ -150,8 +151,14 @@ fn handle_dd_trace_payload_v1(
trace_event.insert(&source.log_schema_host_key, hostname.clone());
trace_event.insert(event_path!("env"), env.clone());
trace_event.insert(event_path!("agent_version"), agent_version.clone());
trace_event.insert(event_path!("target_tps"), target_tps);
trace_event.insert(event_path!("error_tps"), error_tps);
trace_event.insert(
event_path!("target_tps"),
Value::Float(NotNan::new(target_tps).unwrap()),
);
trace_event.insert(
event_path!("error_tps"),
Value::Float(NotNan::new(error_tps).unwrap()),
);
if let Some(Value::Object(span_tags)) = trace_event.get_mut(event_path!("tags")) {
span_tags.extend(tags.clone());
} else {
Expand Down