Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gql-profiler

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gql-profiler - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

4

package.json
{
"name": "gql-profiler",
"version": "0.1.1",
"version": "0.1.2",
"description": "A standalone performance profiler for GraphQL resolvers",

@@ -27,5 +27,5 @@ "main": "lib/index.js",

"dependencies": {
"lodash": "4.17.5",
"lodash": "4.17.11",
"uuid": "3.2.1"
}
}

@@ -7,2 +7,15 @@ [![npm version](https://badge.fury.io/js/gql-profiler.svg)](https://badge.fury.io/js/gql-profiler)

## About The Apollo Suite
Before considering to use GraphQL Profiler, you might consider [Apollo Engine](https://www.apollographql.com/engine/) (or just [apollo-tracing-js](https://github.com/apollographql/apollo-tracing-js)).
These tools are more complete, more powerful and they are maintained by the awesome Apollo team.
But GraphQL Profiler has some advantages compared to the Apollo Suite:
- It's smaller, simpler and easier to hack
- It fits even non-standard use cases of GraphQL (like SSR, or server-to-server GraphQL communication)
- It's only about your resolvers, nothing else
- It's heavily customisable, you can [write your own reporter in 10 lines](#write-your-own-reporter)
- It allows to plug your own storage, no need to pay Apollo to host your data
## Getting Started

@@ -12,10 +25,12 @@

Add the profiler to your project dependencies.
Add the profiler to your project dependencies:
```js
```sh
# If you like npm
npm install --save gql-profiler
# or if you like yarn
yarn add gql-profiler
```
Choose a reporter, wrap your resolvers with the profiler and use the reporter whenever you want:
Choose a reporter, wrap your resolvers with the profiler, and use the reporter whenever you want:

@@ -35,2 +50,3 @@ ```js

typeDefs,
// wrap your resolvers with the profiler
resolvers: profileResolvers(resolvers, { reporter }),

@@ -41,2 +57,3 @@ });

// add a route to display profiles
app.get('/profiler', (req, res) => {

@@ -67,12 +84,6 @@ res.send(reporter.getHtml());

### Available Reporters
## Reporters
**nullReporter**
Available reporters:
```js
import { nullReporter } from 'gql-reporter';
const reporter = nullReporter();
```
Does literaly nothing and doesn't have useful API.
**memoryReporter**

@@ -99,2 +110,11 @@

**nullReporter**
```js
import { nullReporter } from 'gql-reporter';
const reporter = nullReporter();
```
Does literaly nothing, and doesn't have useful API. Used in tests.
**More soon?**

@@ -107,5 +127,6 @@

### Write your own reporter
Write a reporter is very simple, here is an example for of a consoleReporter:
## Writing your own reporter
Writing a reporter is very simple, here is an example of a `consoleReporter`:
```js

@@ -137,2 +158,2 @@ import uuid from 'uuid';

Comfygure is licensed under the [MIT License](https://github.com/marmelab/comfygure/blob/master/LICENSE), sponsored and supported by [marmelab](http://marmelab.com).
GraphQL Profiler is licensed under the [MIT License](https://github.com/marmelab/comfygure/blob/master/LICENSE), courtesy of [marmelab](http://marmelab.com) and [ARTE](https://www.arte.tv).

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc