diff --git a/src/sinks/gcp/mod.rs b/src/sinks/gcp/mod.rs index 5abd7299516ae..ef2e8652f4e70 100644 --- a/src/sinks/gcp/mod.rs +++ b/src/sinks/gcp/mod.rs @@ -87,11 +87,25 @@ pub struct GcpPointValue { pub int64_value: Option, } +#[derive(Serialize, Debug, Clone)] +#[serde(rename_all = "camelCase")] +pub struct GcpMetric { + pub r#type: String, + pub labels: HashMap, +} + +#[derive(Serialize, Debug, Clone)] +#[serde(rename_all = "camelCase")] +pub struct GcpResource { + pub r#type: String, + pub labels: HashMap, +} + #[derive(Serialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct GcpSerie<'a> { - pub metric: GcpTypedResource, - pub resource: GcpTypedResource, + pub metric: GcpMetric, + pub resource: GcpResource, pub metric_kind: GcpMetricKind, pub value_type: GcpValueType, pub points: &'a [GcpPoint], diff --git a/src/sinks/gcp/stackdriver_metrics.rs b/src/sinks/gcp/stackdriver_metrics.rs index a6b14bb7b489c..7f3ebbb397a05 100644 --- a/src/sinks/gcp/stackdriver_metrics.rs +++ b/src/sinks/gcp/stackdriver_metrics.rs @@ -215,11 +215,11 @@ impl HttpSink for HttpEventSink { let series = gcp::GcpSeries { time_series: &[gcp::GcpSerie { - metric: gcp::GcpTypedResource { + metric: gcp::GcpMetric { r#type: metric_type, labels: metric_labels, }, - resource: gcp::GcpTypedResource { + resource: gcp::GcpResource { r#type: self.config.resource.r#type.clone(), labels: self.config.resource.labels.clone(), },