Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
@envelop/prometheus
Advanced tools
This plugin tracks the complete execution flow, and reports metrics using Prometheus tracing (based on `prom-client`).
@envelop/prometheus
This plugin tracks the complete execution flow, and reports metrics using Prometheus tracing (based on prom-client
).
You can opt-in to collect tracing from the following phases:
phase
)parse
execution timevalidate
execution timecontextBuilding
execution timeexecute
execution timeYou can also customize each phase reporter, and add custom metadata and labels to the metrics.
yarn add @envelop/prometheus
import { envelop } from '@envelop/core';
import { usePrometheus } from '@envelop/prometheus';
const getEnveloped = envelop({
plugins: [
// ... other plugins ...
usePrometheus({
// all optional, and by default, all set to false, please opt-in to the metrics you wish to get
parse: true,
validate: true,
contextBuilding: true,
execute: true,
errors: true,
resolvers: true, // requires "execute" to be `true` as well
resolversWhitelist: ['Mutation.*', 'Query.user'], // reports metrics als for these resolvers, leave `undefined` to report all fields
deprecatedFields: true, // requires "execute" and "resolvers" to be `true` as well
registry: myRegistry, // If you are using a custom prom-client registry, please set it here
}),
],
});
You can customize the prom-client
Registry
object if you are using a custom one, by passing it along with the configuration object:
import { Registry } from 'prom-client';
const myRegistry = new Registry();
const getEnveloped = envelop({
plugins: [
// ... other plugins ...
usePrometheus({
// ... config ...
registry: myRegistry,
}),
],
});
Note: if you are using custom
prom-client
instances, you need to make sure to pass your registry there as well.
prom-client
instancesEach tracing field supports custom prom-client
objects, and custom labels
a metadata, you can create a custom extraction function for every Histogram
/ Summary
/ Counter
:
import { Histogram } from 'prom-client';
import { envelop } from '@envelop/core';
import { createHistogram, usePrometheus } from '@envelop/prometheus';
const getEnveloped = envelop({
plugins: [
// ... other plugins ...
usePrometheus({
// all optional, and by default, all set to false, please opt-in to the metrics you wish to get
parse: createHistogram({
histogram: new Histogram({
name: 'my_custom_name',
help: 'HELP ME',
labelNames: ['opText'] as const,
registers: [registry], // make sure to add your custom registry, if you are not using the default one
}),
fillLabelsFn: params => {
// if you wish to fill your `lables` with metadata, you can use the params in order to get access to things like DocumentNode, operationName, operationType, `error` (for error metrics) and `info` (for resolvers metrics)
return {
opText: print(params.document),
};
},
}),
}),
],
});
FAQs
This plugin tracks the complete execution flow, and reports metrics using Prometheus tracing (based on `prom-client`).
The npm package @envelop/prometheus receives a total of 12,911 weekly downloads. As such, @envelop/prometheus popularity was classified as popular.
We found that @envelop/prometheus demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.