-
Notifications
You must be signed in to change notification settings - Fork 129
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
Trace support for Apollo client SDK on iOS. #1797
Comments
Hey @dineshiOSDev 👋.
Not sure what do you exactly mean by "doesn't work" 🙂, so I'll do some assumptions about your setup:
To enable distributed tracing, you must propagate span context in
The above snippet explains how to inject trace headers into given Let us know if this was helpful or provide more context on what doesn't work. |
@ncreated Thank you so much for getting back so quickly. Since we completely rely on Apollo client SDK
The flame graph just shows only the front end trace and it couldn't map/co-related to lambda level. Is there any docs or links that you can help us for datadog support for apollo sdk please. |
@dineshiOSDev Thanks for more context. The way you use Datadog APIs looks fine 👌, but I think that your problem might be in the way you're using Apollo interceptor. Could you confirm that requests which are sent from your app do not include I had a glance look at Apollo's example of UserManagementInterceptor and I believe that after adding headers you should process the request.addHeader(name: "Authorization", value: "Bearer \(token.value)")
chain.proceedAsync(
request: request,
response: response,
interceptor: self,
completion: completion
) Without calling the |
Hi @ncreated I tried two way one suggested here But both has the same result.
below are the values that are added
Also i see all the traceid sent from ios has a constant id( |
The format of the trace id follows https://github.com/DataDog/dd-sdk-ios/blob/develop/DatadogInternal/Sources/NetworkInstrumentation/TraceID.swift#L219 I did a quick test and it seems to work as expected with Datadog.initialize(
with: Datadog.Configuration(
clientToken: "<your id>",
env: "tests",
service: "apollo",
uploadFrequency: .frequent
),
trackingConsent: .granted
)
Trace.enable(with: .init(urlSessionTracking: Trace.Configuration.URLSessionTracking(
firstPartyHostsTracing: .traceWithHeaders(hostsWithHeaders: ["http://127.0.0.1:3000": [.datadog]], sampleRate: 100)
)))
URLSessionInstrumentation.enable(with: .init(delegateClass: URLSessionClient.self)) let apolloClient = ApolloClient(url: URL(string: "http://127.0.0.1:3000/graphql")!)
apolloClient.fetch(query: Graphing.GetAllMessagesQuery()) { result in
switch result {
case .success(let data):
print(data)
case .failure(let error):
print(error)
}
} I'm curious if you can share?
|
@ganeshnj
Also the above setup logs all the traces without the help of individual span. we can create a support ticket just in case if you need see through the logs. |
Yes, please open a support ticket. |
GH-1797 fix: use trace and span id as decimal
Great. Closing it now. |
Question
Unable to trace network calls with distributed trace from our iOS mobile application since we rely on Apollo client SDK for networking.
Currently we are using individual span on network manager but that doesn't works for distributed traces across the lambda level.
The text was updated successfully, but these errors were encountered: