Skip to content

Commit

Permalink
fixes gcp stackdriver monitoring serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonahills committed Feb 10, 2023
1 parent bed0b05 commit 2b1a1a6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
18 changes: 16 additions & 2 deletions src/sinks/gcp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,25 @@ pub struct GcpPointValue {
pub int64_value: Option<i64>,
}

#[derive(Serialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct GcpMetric {
pub r#type: String,
pub labels: HashMap<String, String>,
}

#[derive(Serialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct GcpResource {
pub r#type: String,
pub labels: HashMap<String, String>,
}

#[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],
Expand Down
4 changes: 2 additions & 2 deletions src/sinks/gcp/stackdriver_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
},
Expand Down

0 comments on commit 2b1a1a6

Please sign in to comment.