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

Forward trace context to AWS Batch job #214

Open
Kralizek opened this issue Sep 30, 2021 · 3 comments
Open

Forward trace context to AWS Batch job #214

Kralizek opened this issue Sep 30, 2021 · 3 comments

Comments

@Kralizek
Copy link

Hi,

In my application I have a step where an API call eventually submits a job to Batch. The application performing the task will then call other services and consume other AWS services.

What's the best course of action for the calling application to forward the trace context to the application being used by Batch to perform the job?

I guess I can pass the trace-id as a parameter to the application, but is there a way to explicitly set up the recorder to append segments to that trace?

@lupengamzn
Copy link
Contributor

Hi @Kralizek,

Does the API call an Asp.Net(Core) application? If so, you can follow the implementations as usual and X-Ray's Asp.Net handler will automatically fetch and parse the upstream trace id for you. If not, you may have to manually parse the trace id and pass it to the segment that you create for this application.

@Kralizek
Copy link
Author

Kralizek commented Oct 7, 2021

Hi @lupengamzn

The receiving application is a console application that will be executed by Batch for each item so I'm left to parse the trace id and pass it as an environment variable in the container overrides part of the submit job request.

Is there a convenient way to access the current trace id? I was hoping for something in the TraceContext like AWSXRayRecorder.Instance.TraceContext.TraceId but couldn't find anything.

@srprash
Copy link
Collaborator

srprash commented Oct 11, 2021

Hi @Kralizek

Is there a convenient way to access the current trace id?

You can use AWSXRayRecorder.Instance.GetEntity().TraceId for that.
Ref Doc: https://docs.aws.amazon.com/xray-sdk-for-dotnetcore/latest/reference/html/P_Amazon_XRay_Recorder_Core_Internal_Entities_Entity_TraceId.htm

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

No branches or pull requests

3 participants