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

Added web sender and wired up to example/apollo-client #43

Merged
merged 3 commits into from
Sep 17, 2023
Merged

Conversation

kgpax
Copy link
Member

@kgpax kgpax commented Sep 15, 2023

What does this PR do?

  • Adds packages/web which you can use to connect your client web application to Envy, ideally before mounting the app (so that initial requests are captured).
// index.tsx

import { enableTracing } from '@envy/web';
import { createRoot } from 'react-dom/client';
import { App } from './App';

const container = document.getElementById('app');
const root = createRoot(container);

// connect to Envy via `@envy/web` and mount the app
enableTracing({ serviceName: 'my-web-app', port: 9999 }).then(() => {
  root.render(<App />);
});
  • Adds support for web senders in the collector
  • Removes the on('close') listener in the collector, since refreshing the browser would disconnect the @envy/browser viewer
  • Displays the service name of the application which sent the trace data in the detail view

Screenshots

image

image

image

How to test

  • You know the drill by now...
  • yarn workspace @envy/browser start in one terminal, then open http://localhost:9998
  • yarn example:apollo in another, then open http://localhost:4001
  • You should see four GQL traces in the browser UI (coming from examples/apollo-client) as well as five other traces (coming from examples/apollo)
  • Click the orange refresh buttons in the example app and you'll see both the GQL request (coming from apollo-client) and the upstream requests (coming from apollo)

@kgpax kgpax marked this pull request as ready for review September 17, 2023 14:53
@carbonrobot carbonrobot self-requested a review September 17, 2023 17:30
@kgpax kgpax merged commit 4faccb0 into main Sep 17, 2023
3 checks passed
@kgpax kgpax deleted the web-sender branch September 17, 2023 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants