-
Notifications
You must be signed in to change notification settings - Fork 71
RUM-11196: Support apollo graphql #2845
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
Open
jonathanmos
wants to merge
8
commits into
develop
Choose a base branch
from
jmoskovich/rum-11196/apollo-integration
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
27ef08c
RUM-11196: Support apollo graphql
jonathanmos a0d3b18
RUM-11196: Align headers with cross platform
jonathanmos c51e507
RUM-11196: Rename to sendGraphQLPayloads
jonathanmos cf37e37
RUM-11196: Change the way we override variablesExtractor in tests
jonathanmos e19f43a
RUM-11196: Payload flag to datadogApolloInterceptor
jonathanmos 50e1e36
RUM-11196: Move headers to internal
jonathanmos 134623f
RUM-11196: Remove atleastonce from datadogApolloInterceptorTest
jonathanmos 9463462
RUM-11196: refactor VariableExtractor injection
jonathanmos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
dd-sdk-android-internal/src/main/java/com/datadog/android/internal/network/GraphQLHeaders.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. | ||
* This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
* Copyright 2016-Present Datadog, Inc. | ||
*/ | ||
|
||
package com.datadog.android.internal.network | ||
|
||
/** | ||
* Headers used internally for intercepting GraphQL requests. | ||
* @param headerValue name of the header. | ||
*/ | ||
enum class GraphQLHeaders(val headerValue: String) { | ||
DD_GRAPHQL_NAME_HEADER("_dd-custom-header-graph-ql-operation-name"), | ||
DD_GRAPHQL_VARIABLES_HEADER("_dd-custom-header-graph-ql-variables"), | ||
DD_GRAPHQL_TYPE_HEADER("_dd-custom-header-graph-ql-operation_type"), | ||
DD_GRAPHQL_PAYLOAD_HEADER("_dd-custom-header-graph-ql-payload") | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a simpler and more efficient way to do this (in the end, manipulating something over 30Kb in the memory may have performance impact):
val payloadBytes = payload.toByteArray(Charsets.UTF_8)
allocation by checkingpayload.length
first: since strings are stored as UTF-16 in runtime and UTF-16 is two 16-bit code units max for code point, ifpayload.length == codepoint number
it means that ifpayload.length
is less than 7500, it is definitely below 30Kb limit (7500*4). If it is more, than we need to have a more precise look by getting exact bytes.10
https://en.wikipedia.org/wiki/UTF-8#Description, so we just need to slice(MAX_BYTES - something)
where something is 0 ifpayloadBytes[MAX_BYTES]
starts from 0 or some number which can be found by going from the tail till the closest byte starting from11
.Not sure about the performance impact, but it seems it will at least have less allocations.