Skip to content

Commit 8b10ca3

Browse files
fiadliellalitb
andauthored
Add cloud_run_job to MonitoredResource (#101)
Co-authored-by: Lalit Kumar Bhasin <[email protected]>
1 parent e6feb3c commit 8b10ca3

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

opentelemetry-stackdriver/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## vNext
4+
5+
### Added
6+
7+
- Added support for `MonitoredResource::CloudRunJob` [#100](https://github.com/open-telemetry/opentelemetry-rust-contrib/issues/100)
8+
39
## v0.21.0
410

511
### Changed

opentelemetry-stackdriver/src/lib.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,24 @@ impl From<LogContext> for InternalLogContext {
553553
fn from(cx: LogContext) -> Self {
554554
let mut labels = HashMap::default();
555555
let resource = match cx.resource {
556+
MonitoredResource::CloudRunJob {
557+
project_id,
558+
job_name,
559+
location,
560+
} => {
561+
labels.insert("project_id".to_string(), project_id);
562+
if let Some(job_name) = job_name {
563+
labels.insert("job_name".to_string(), job_name);
564+
}
565+
if let Some(location) = location {
566+
labels.insert("location".to_string(), location);
567+
}
568+
569+
proto::api::MonitoredResource {
570+
r#type: "cloud_run_job".to_owned(),
571+
labels,
572+
}
573+
}
556574
MonitoredResource::CloudRunRevision {
557575
project_id,
558576
service_name,
@@ -665,6 +683,11 @@ pub enum MonitoredResource {
665683
job: Option<String>,
666684
task_id: Option<String>,
667685
},
686+
CloudRunJob {
687+
project_id: String,
688+
job_name: Option<String>,
689+
location: Option<String>,
690+
},
668691
CloudRunRevision {
669692
project_id: String,
670693
service_name: Option<String>,

0 commit comments

Comments
 (0)