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

feat: payload capture - move timing into copied plugin #902

Merged
merged 14 commits into from
Nov 21, 2023

Conversation

pauldambra
Copy link
Member

@pauldambra pauldambra commented Nov 18, 2023

As discussed https://posthog.slack.com/archives/C03PB072FMJ/p1700077249746539

first draft (while looking after poorly #4) of removing our own timings plugin in favour of (a copy of) the rrweb plugin

TODO

  • tests for new URL method in utils
  • respect existing deprecated config
  • config to allow mode where we wrap fetch/xhr but only capture status and method - this could be implemented as a masking function 🤔
  • don't record local host by default

Copy link

github-actions bot commented Nov 18, 2023

Size Change: +697 B (0%)

Total Size: 740 kB

Filename Size Change
dist/array.full.js 175 kB +106 B (0%)
dist/array.js 117 kB +102 B (0%)
dist/es.js 117 kB +102 B (0%)
dist/exception-autocapture.js 12 kB -29 B (0%)
dist/module.js 117 kB +102 B (0%)
dist/recorder-v2.js 104 kB +314 B (0%)
ℹ️ View Unchanged
Filename Size
dist/recorder.js 58.4 kB
dist/surveys.js 39.9 kB

compressed-size-action

src/types.ts Outdated Show resolved Hide resolved
@@ -16,12 +16,8 @@ export const _isUint8Array = function (x: unknown): x is Uint8Array {
// fails on only one very rare and deliberate custom object:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fun fact: the URL in this comment might have said something about JS in the past but it doesn't anymore 🤷

@pauldambra pauldambra added the bump patch Bump patch version when this PR gets merged label Nov 18, 2023
@pauldambra pauldambra requested a review from a team November 20, 2023 12:52
@pauldambra pauldambra marked this pull request as ready for review November 20, 2023 12:52
// readonly name: string;
// readonly startTime: DOMHighResTimeStamp;
// properties below here are ALPHA, don't rely on them, they may change without notice
export type CapturedNetworkRequest = Omit<PerformanceEntry, 'toJSON'> & {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not important because it covered all important stuff, but in case you are looking for ideas of what to track: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#common-attributes
Eg HTTP version, etc.

Copy link
Collaborator

@benjackwhite benjackwhite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tentatively this all looks good!

src/types.ts Outdated
Comment on lines 162 to 163
/** Modify the network request before it is captured. Returning null stops it being captured */
// TODO this has to work for both capture mechanisms? 😱
// deprecated - use maskCapturedNetworkRequestFn instead
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead remove the original jsdoc and make it

    /** @deprecated - use maskCapturedNetworkRequestFn instead  */

@pauldambra pauldambra merged commit 5b9e04b into master Nov 21, 2023
13 checks passed
@pauldambra pauldambra deleted the feat/payload-capture-draft-2 branch November 21, 2023 17:33
pauldambra added a commit to PostHog/posthog that referenced this pull request Nov 21, 2023
requires: PostHog/posthog-js#902

We don't want to support running posthog/network and rrweb/network plugin at the same time. These changes support that change
improve timeline display
allow raw json view for debugging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump patch Bump patch version when this PR gets merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants