-
Notifications
You must be signed in to change notification settings - Fork 2k
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
AER: include encodedTraces
only once to prevent duplicates
#2040
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5f9f86b
AER: Remove encodedTraces to prevent duplicates
evans 2188b50
Add changelog
evans a71f7ad
Merge branch 'master' into evans/fix-duplicate-aer
evans 0f956b5
Merge branch 'master' into evans/fix-duplicate-aer
evans 844563a
Move incremental Trace encoding to a-e-r-protobuf
evans a027334
Reexport protobuf import after modification
evans f756174
Update comment on Trace.encode to point at a-e-r-p
evans 36c46bc
Remove typescript build step
evans b533e45
Add description of dev process in README
evans f45c549
Merge branch 'master' into evans/fix-duplicate-aer
evans 04ba11a
Update CHANGELOG.md
abernix 2f590d1
Update README.md
abernix 05a2e4b
Update README.md
abernix 307c4f1
Merge branch 'master' into evans/fix-duplicate-aer
abernix 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 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 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 |
---|---|---|
@@ -1,7 +1,29 @@ | ||
# apollo-engine-reporting-protobuf | ||
# `apollo-engine-reporting-protobuf` | ||
|
||
This contains generated Javascript/TypeScript code for the protobuf definitions | ||
for the Engine reporting API. | ||
> **Note:** The Apollo Engine reporting API is subject to change. We strongly | ||
> encourage developers to contact Apollo Engine support to discuss their use | ||
> case prior to building their own reporting agent using this module. | ||
|
||
The Engine reporting API is currently subject to change at any time; do not rely | ||
on this to build your own client. | ||
This module provides JavaScript/TypeScript | ||
[Protocol buffer](https://developers.google.com/protocol-buffers/) definitions | ||
for the Apollo Engine reporting API. These definitions are generated for | ||
consumption from the `reports.proto` file which is defined internally within | ||
Apollo. | ||
|
||
## Development | ||
|
||
> **Note:** Due to a dependency on Unix tools (e.g. `bash`, `grep`, etc.), the | ||
> development of this module requires a Unix system. There is no reason why | ||
> this can't be avoided, the time just hasn't been taken to make those changes. | ||
> We'd happily accept a PR which makes the appropriate changes! | ||
|
||
Currently, this package generates a majority of its code with | ||
[`protobufjs`](https://www.npmjs.com/package/protobufjs) based on the | ||
`reports.proto` file. The output is generated with the `prepare` npm script. | ||
|
||
The root of the repository provides the `devDependencies` necessary to build | ||
these definitions (e.g. `pbjs`, `pbts`, `protobuf`, etc.) and the the `prepare` | ||
npm script is invoked programmatically via the monorepo tooling (e.g. Lerna) | ||
thanks to _this_ module's `postinstall` script. Therefore, when making | ||
changes to this module, `npx lerna run prepare` should be run from the **root** | ||
of this monorepo in order to update the definitions in _this_ module. |
This file contains 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 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,2 @@ | ||
import * as protobuf from './protobuf'; | ||
export = protobuf; |
This file contains 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,24 @@ | ||
const protobuf = require('./protobuf'); | ||
|
||
// Override the generated protobuf Traces.encode function so that it will look | ||
// for Traces that are already encoded to Buffer as well as unencoded | ||
// Traces. This amortizes the protobuf encoding time over each generated Trace | ||
// instead of bunching it all up at once at sendReport time. In load tests, this | ||
// change improved p99 end-to-end HTTP response times by a factor of 11 without | ||
// a casually noticeable effect on p50 times. This also makes it easier for us | ||
// to implement maxUncompressedReportSize as we know the encoded size of traces | ||
// as we go. | ||
const originalTracesEncode = protobuf.Traces.encode; | ||
protobuf.Traces.encode = function(message, originalWriter) { | ||
const writer = originalTracesEncode(message, originalWriter); | ||
const encodedTraces = message.encodedTraces; | ||
if (encodedTraces != null && encodedTraces.length) { | ||
for (let i = 0; i < encodedTraces.length; ++i) { | ||
writer.uint32(/* id 1, wireType 2 =*/ 10); | ||
writer.bytes(encodedTraces[i]); | ||
} | ||
} | ||
return writer; | ||
}; | ||
|
||
module.exports = protobuf; |
File renamed without changes.
This file contains 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
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.
Note that there is a reference to this comment later where encodedTraces is written which should be updated to point to the other file.