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] Run in Azure Spring Apps #547

Merged
merged 12 commits into from
Jul 31, 2024

Conversation

duncanpharvey
Copy link
Contributor

What does this PR do?

Updates Serverless Mini Agent to run in Azure Spring Apps.

Motivation

Additional Notes

  • Use ASCSVCRT_SPRING__APPLICATION__NAME environment variable to determine if mini agent is running in an Azure Spring Apps environment
  • Update info endpoint so Datadog Java Tracer knows where to send trace metrics when DD_TRACE_TRACER_METRICS_ENABLED is true
    • Add config.statsd_port
  • Update /v0.4/traces endpoint to work with Datadog Java Tracer
    • Change response status code from 202 - Accepted to 200 - OK
    • Change response body from message to {"rate_by_service":{"service:,env:":1}. This is just a placeholder to satisfy the response requirement by the Datadog Java Tracer but will need to be updated in a future PR to properly set the trace sampling priority

Error from Datadog Java Tracer when Mini Agent trace endpoint returns 200 - OK status code

[dd.trace 2024-07-19 18:36:30:140 +0000] [dd-trace-processor] DEBUG datadog.trace.agent.common.writer.ddagent.DDAgentApi - {"message":"Successfully buffered traces to be flushed."} while sending 1 (size=1KB) traces. Total: 1, Received: 1, Sent: 0, Failed: 1. Status: 202, Response: Accepted, Body: {"message":"Successfully buffered traces to be flushed."}
[dd.trace 2024-07-19 18:36:30:140 +0000] [dd-trace-processor] DEBUG datadog.trace.agent.common.writer.PayloadDispatcherImpl - Failed to send 1 traces of size 1276 bytes to the API

Error from Datadog Java Tracer when Mini Agent trace endpoint returns json with message instead of json with rate_by_service

[dd.trace 2024-07-19 19:56:40:234 +0000] [dd-trace-processor] ERROR datadog.trace.agent.common.writer.TraceProcessingWorker$DaemonTraceSerializingHandler - Uncaught exception com.squareup.moshi.JsonDataException: Expected BEGIN_OBJECT but was STRING at path $.message in dd-trace-processor
com.squareup.moshi.JsonDataException: Expected BEGIN_OBJECT but was STRING at path $.message

How to test the change?

  • 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

@codecov-commenter
Copy link

codecov-commenter commented Jul 24, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 6 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@f148c87). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #547   +/-   ##
=======================================
  Coverage        ?   70.44%           
=======================================
  Files           ?      213           
  Lines           ?    28455           
  Branches        ?        0           
=======================================
  Hits            ?    20044           
  Misses          ?     8411           
  Partials        ?        0           
Components Coverage Δ
crashtracker 25.21% <ø> (?)
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% <ø> (?)
sidecar 35.42% <ø> (?)
sidecar-ffi 0.00% <ø> (?)
spawn-worker 54.98% <ø> (?)
trace-mini-agent 70.88% <71.42%> (?)
trace-normalization 98.24% <ø> (?)
trace-obfuscation 95.73% <ø> (?)
trace-protobuf 77.16% <ø> (?)
trace-utils 90.90% <50.00%> (?)

@pr-commenter
Copy link

pr-commenter bot commented Jul 24, 2024

Benchmarks

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

@duncanpharvey duncanpharvey marked this pull request as ready for review July 24, 2024 14:33
@duncanpharvey duncanpharvey requested review from a team as code owners July 24, 2024 14:33
Copy link

@jcstorms1 jcstorms1 left a comment

Choose a reason for hiding this comment

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

This looks good!

@duncanpharvey duncanpharvey merged commit 6eaa738 into main Jul 31, 2024
31 of 32 checks passed
@duncanpharvey duncanpharvey deleted the duncan-harvey/azure-spring branch July 31, 2024 12:24
danielsn pushed a commit that referenced this pull request Jul 31, 2024
* add azure spring app environment type for serverless mini agent

* add config.statsd_port to mini agent info endpoint

* update mini agent trace endpoint status code and response body to work with java tracer

* use different environment variable to identify azure spring apps

* only update http response for success responses to traces endpoint

* address lint errors

* updates comment and formatting

* update trace-mini-agent description to include Azure Spring Apps

* fix 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.

3 participants