Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Serverless Mini Agent] Add _dd.mini_agent_version tag to all spans for Azure Functions, Google Cloud Functions, and Azure Spring Apps #548

Merged
merged 3 commits into from
Jul 31, 2024

Conversation

duncanpharvey
Copy link
Contributor

@duncanpharvey duncanpharvey commented Jul 25, 2024

What does this PR do?

Adds _dd.mini_agent_version span tag to all spans from Azure Functions, Google Cloud Functions, and Azure Spring Apps.

Motivation

https://datadoghq.atlassian.net/browse/SVLS-5167

Additional Notes

Previously there was an aas.environment.mini_agent_version span tag added for Azure Functions. This tag is being replaced for a span tag that will be applied in all relevant environments: Azure Functions, Google Cloud Functions, and Azure Spring Apps.

Set DD_MINI_AGENT_VERSION environment variable to the package version of datadog-serverless-trace-mini-agent. Then reference this environment variable in the packages that are run from datadog-serverless-trace-mini-agent.

Set the version of datadog-trace-mini-agent to match the version of libdatadog so the Serverless Mini Agent version is only managed in a single package moving forward.

How to test the change?

Azure Spring Apps

  • Build mini agent locally
  • Build an Azure Spring App with persistent storage
  • ssh into the Azure Spring App instance and upload the Datadog Java Tracer and Serverless Mini Agent
  • Add -javaagent:/persistent/dd-java-agent.jar to the JVM options
  • Set DD_TRACE_TRACER_METRICS_ENABLED to true
  • Start the Serverless Mini Agent

Azure Functions / Google Cloud Functions

  • Build mini agent locally
  • Deploy Azure Function or Google Cloud Function with mini agent binary in root path
  • Set DD_MINI_AGENT_PATH
    • Azure: /home/site/wwwroot/datadog-serverless-trace-mini-agent
    • Google: /workspace/datadog-serverless-trace-mini-agent

@duncanpharvey duncanpharvey requested review from a team as code owners July 25, 2024 15:58
@duncanpharvey duncanpharvey changed the title [Serverless Mini Agent] Add _dd.mini_agent_version to all spans [Serverless Mini Agent] Add _dd.mini_agent_version tag to all spans Jul 25, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jul 25, 2024

Codecov Report

Attention: Patch coverage is 65.00000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 70.44%. Comparing base (eb62a6d) to head (fcffe36).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #548      +/-   ##
==========================================
- Coverage   70.49%   70.44%   -0.05%     
==========================================
  Files         213      213              
  Lines       28412    28439      +27     
==========================================
+ Hits        20030    20035       +5     
- Misses       8382     8404      +22     
Components Coverage Δ
crashtracker 25.21% <ø> (+0.07%) ⬆️
datadog-alloc 98.73% <ø> (ø)
data-pipeline 50.00% <ø> (ø)
data-pipeline-ffi 0.00% <ø> (ø)
ddcommon 86.23% <ø> (ø)
ddcommon-ffi 74.58% <ø> (ø)
ddtelemetry 58.95% <ø> (ø)
ipc 84.18% <ø> (ø)
profiling 78.09% <ø> (ø)
profiling-ffi 56.76% <ø> (ø)
serverless 0.00% <0.00%> (ø)
sidecar 35.42% <ø> (ø)
sidecar-ffi 0.00% <ø> (ø)
spawn-worker 54.98% <ø> (ø)
trace-mini-agent 71.01% <100.00%> (-0.13%) ⬇️
trace-normalization 98.24% <ø> (ø)
trace-obfuscation 95.73% <ø> (ø)
trace-protobuf 77.16% <ø> (ø)
trace-utils 90.96% <71.42%> (-0.67%) ⬇️

@@ -471,9 +483,15 @@ pub fn enrich_span_with_mini_agent_metadata(
span.meta
.insert("location".to_string(), gcp_region.to_string());
}
if let Some(mini_agent_version) = &mini_agent_metadata.version {
span.meta.insert(
"_dd.mini_agent_version".to_string(),
Copy link

@duncanista duncanista Jul 25, 2024

Choose a reason for hiding this comment

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

Has this tag been approved? I'm not sure if we should continue using the name mini_agent when this is trace agent.

I mention it because this will now be added to all spans, meaning that anything using this library, like Bottlecap, will result with this tracing agent tag included.

Choose a reason for hiding this comment

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

Ah, I jus read Azure Functions, Google Cloud Functions, and Azure Spring Apps.

But still, maybe we should switch to a better naming 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any ideas for a better name? The packages are all named some variation of "mini agent" so at least it's consistent for now. And the tag will only be set when the environment variable DD_MINI_AGENT_VERSION is set, which should not be the case for Bottlecap.

Choose a reason for hiding this comment

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

I think we need to sort this out at a later point.

@duncanpharvey duncanpharvey changed the title [Serverless Mini Agent] Add _dd.mini_agent_version tag to all spans [Serverless Mini Agent] Add _dd.mini_agent_version tag to all spans for Azure Functions, Google Cloud Functions, and Azure Spring Apps Jul 25, 2024
@pr-commenter
Copy link

pr-commenter bot commented Jul 31, 2024

Benchmarks

This comment was omitted because it was over 65536 characters.Please check the Gitlab Job logs to see its output.

@duncanpharvey duncanpharvey merged commit f148c87 into main Jul 31, 2024
32 checks passed
@duncanpharvey duncanpharvey deleted the duncan-harvey/mini-agent-version branch July 31, 2024 11:43
danielsn pushed a commit that referenced this pull request Jul 31, 2024
…or Azure Functions, Google Cloud Functions, and Azure Spring Apps (#548)

* add _dd.mini_agent_version to spans in all environments

* apply formatting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants