@RestResource(urlMapping='/Account/*')
global with sharing class MyRestResource {
@HttpPost
global static String doPost(String name, String phone, String website) {
// Capture the caller's trace context
W3CTraceContext ctx = W3CTraceContext.fromRequest(RestContext.request);
// Use the trace context (e.g. for logging)
System.debug(loggingLevel.INFO, 'Trace ID: ' + ctx.getTraceParent().getTraceId());
System.debug(loggingLevel.INFO, 'Parent ID: ' + ctx.getTraceParent().getParentId());
// Propagate the trace context to external dependencies
HttpRequest req = new HttpRequest();
ctx.propagate(req, true);
req.setEndpoint('http://www.yahoo.com');
req.setMethod('GET');
}
}
-
Notifications
You must be signed in to change notification settings - Fork 0
License
poveden/apex-w3c-trace-context
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published