Skip to content

[SVLS-5506] Update cloud run tags to also account for Cloud Run Functions and Namespace#30722

Merged
dd-mergequeue[bot] merged 8 commits into
mainfrom
nina.rei/SVLS-5506/cloud-run-functions-origin-tag-to-cloudrun
Nov 11, 2024
Merged

[SVLS-5506] Update cloud run tags to also account for Cloud Run Functions and Namespace#30722
dd-mergequeue[bot] merged 8 commits into
mainfrom
nina.rei/SVLS-5506/cloud-run-functions-origin-tag-to-cloudrun

Conversation

@nina9753

@nina9753 nina9753 commented Nov 4, 2024

Copy link
Copy Markdown
Contributor

What does this PR do?

Update cloud run origin tag to also account for Cloud Run Functions by setting the origin tag always to cloudrun
Updates tags to include namespace prefix gcr for Cloud Run Services and gcrfx for Cloud Run Functions

All spans will be tagged with:

  • origin
  • _dd.origin
  • _dd.datadog_sidecar_version

Duplicate tags for the overlying cloud run service for both namespaces:

  • gcrfx.revision_name
  • gcrfx.service_name
  • gcrfx.configuration_name
  • gcrfx.region
    • original region tag remains
  • gcr.container_id
    • original container_id tag remains
  • gcr.project_id
    • original project_id tag remains

Additional tags only for Cloud Run Functions:

  • gcrfx.function_target
    • Env var needed to determine if a service is cloud run or cloud run function
  • gcrfx.function_signature_type

Motivation

Based on this PR #29404
This Jira Ticket

Describe how to test/QA your changes

updated tests for cloudrun.go file in cloudrun_tests.go
and tests for gcp.go file in gcp_tests.go
PR was tested with serverless-init release candidate gcr-tag-rc1 results are shown in the image below

Possible Drawbacks / Trade-offs

we will need function_target tag to differentiate cloud run services vs cloud run functions

Additional Notes

image

@nina9753
nina9753 requested a review from a team as a code owner November 4, 2024 19:15
@github-actions github-actions Bot added the short review PR is simple enough to be reviewed quickly label Nov 4, 2024
@agent-platform-auto-pr

agent-platform-auto-pr Bot commented Nov 4, 2024

Copy link
Copy Markdown
Contributor

Test changes on VM

Use this command from test-infra-definitions to manually test this PR changes on a VM:

inv create-vm --pipeline-id=48583022 --os-family=ubuntu

Note: This applies to commit 5f140e2

@nina9753 nina9753 added the changelog/no-changelog No changelog entry needed label Nov 4, 2024
@cit-pr-commenter

cit-pr-commenter Bot commented Nov 4, 2024

Copy link
Copy Markdown

Regression Detector

Regression Detector Results

Metrics dashboard
Target profiles
Run ID: 8f341042-1844-4b87-9b41-75db838dc296

Baseline: 2e1024b
Comparison: 5f140e2
Diff

Optimization Goals: ✅ No significant changes detected

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI trials links
basic_py_check % cpu utilization +2.73 [-1.29, +6.75] 1 Logs
pycheck_lots_of_tags % cpu utilization +0.64 [-2.69, +3.97] 1 Logs
otel_to_otel_logs ingress throughput +0.44 [-0.24, +1.12] 1 Logs
file_to_blackhole_1000ms_latency egress throughput +0.36 [-0.12, +0.84] 1 Logs
file_to_blackhole_0ms_latency egress throughput +0.02 [-0.45, +0.49] 1 Logs
tcp_syslog_to_blackhole ingress throughput +0.01 [-0.04, +0.06] 1 Logs
quality_gate_idle memory utilization +0.01 [-0.04, +0.06] 1 Logs bounds checks dashboard
tcp_dd_logs_filter_exclude ingress throughput +0.00 [-0.01, +0.01] 1 Logs
uds_dogstatsd_to_api ingress throughput +0.00 [-0.07, +0.07] 1 Logs
file_to_blackhole_100ms_latency egress throughput -0.03 [-0.34, +0.29] 1 Logs
file_to_blackhole_300ms_latency egress throughput -0.04 [-0.22, +0.15] 1 Logs
file_to_blackhole_500ms_latency egress throughput -0.06 [-0.31, +0.18] 1 Logs
file_tree memory utilization -0.10 [-0.22, +0.02] 1 Logs
quality_gate_idle_all_features memory utilization -0.28 [-0.38, -0.18] 1 Logs bounds checks dashboard
uds_dogstatsd_to_api_cpu % cpu utilization -1.46 [-2.19, -0.73] 1 Logs

Bounds Checks: ❌ Failed

perf experiment bounds_check_name replicates_passed links
quality_gate_idle memory_usage 6/10 bounds checks dashboard
file_to_blackhole_0ms_latency lost_bytes 9/10
file_to_blackhole_100ms_latency lost_bytes 9/10
file_to_blackhole_0ms_latency memory_usage 10/10
file_to_blackhole_1000ms_latency memory_usage 10/10
file_to_blackhole_100ms_latency memory_usage 10/10
file_to_blackhole_300ms_latency memory_usage 10/10
file_to_blackhole_500ms_latency memory_usage 10/10
quality_gate_idle_all_features memory_usage 10/10 bounds checks dashboard

Explanation

Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%

Performance changes are noted in the perf column of each table:

  • ✅ = significantly better comparison variant performance
  • ❌ = significantly worse comparison variant performance
  • ➖ = no significant change in performance

A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".

For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.

  3. Its configuration does not mark it "erratic".

@github-actions github-actions Bot added medium review PR review might take time and removed short review PR is simple enough to be reviewed quickly labels Nov 8, 2024
@nina9753 nina9753 changed the title [SVLS-5506] Update cloud run origin tag to also account for Cloud Run Functions [SVLS-5506] Update cloud run tags to also account for Cloud Run Functions and Namespace Nov 8, 2024
nina9753 and others added 3 commits November 8, 2024 12:08
…ctions-origin-tag-to-cloudrun' into nina.rei/SVLS-5506/cloud-run-functions-origin-tag-to-cloudrun
functionTargetEnvVar = "FUNCTION_TARGET" // exists as a cloudrunfunction env var for all runtimes except Go
)

const (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: this can probably just move to the other constants. Differentiating them with a comment is sufficient.


// CloudRun has helper functions for getting Google Cloud Run data
type CloudRun struct {
spanNamespace string

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This works well also, but I’m curious if by making everything constants as I stated earlier, you could have stuck with the original cloudRunFunctionMode bool. This way you could use the gcr constants as default and switch to the gcrfx ones if cloudRunFunctionMode=true. I think this would be easier to read as well. Can you help explain why my suggestions wouldn’t work and why you chose this approach instead?

Comment on lines +26 to +27
cloudRunService = "gcr."
cloudRunFunction = "gcrfx."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This all looks great, but I feel it might have been simpler to read if you had set these as full constants, like gcrf.function_target. Can you help me understand why appending the prefix each time you set a tag is the better approach in this case?

@nina9753 nina9753 Nov 8, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can update the code with constants instead. I went with namespace prefix + tag name instead of a constant namespace tag because of the region and project_id tags. This would require a larger code refactor to check for cloudRunFunctionMode outside of cloudrun file instead of passing in the namespace prefix to the TagMap function in gcp.go. But I agree your approach is easier to read

@nina9753

Copy link
Copy Markdown
Contributor Author

/merge

@dd-devflow

dd-devflow Bot commented Nov 11, 2024

Copy link
Copy Markdown

Devflow running: /merge

View all feedbacks in Devflow UI.


2024-11-11 14:21:53 UTC ℹ️ MergeQueue: pull request added to the queue

The median merge time in main is 23m.

@dd-mergequeue
dd-mergequeue Bot merged commit 88609c3 into main Nov 11, 2024
@dd-mergequeue
dd-mergequeue Bot deleted the nina.rei/SVLS-5506/cloud-run-functions-origin-tag-to-cloudrun branch November 11, 2024 14:41
@github-actions github-actions Bot added this to the 7.61.0 milestone Nov 11, 2024
@nina9753 nina9753 added the qa/done QA done before merge and regressions are covered by tests label Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/no-changelog No changelog entry needed medium review PR review might take time qa/done QA done before merge and regressions are covered by tests team/serverless-azure-gcp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants