
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
@metis-data/pg-interceptor
Advanced tools
Using the Documentation of Metis.
$ npm i @metis-data/pg-interceptor --save
tracer):import opentelemetry from '@opentelemetry/api';
import { registerInstrumentations } from '@opentelemetry/instrumentation';
import { Resource } from '@opentelemetry/resources';
import {
BatchSpanProcessor,
ConsoleSpanExporter,
SimpleSpanProcessor,
} from '@opentelemetry/sdk-trace-base';
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
import { getMetisExporter, MetisHttpInstrumentation, MetisPgInstrumentation } from '@metis-data/pg-interceptor';
import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks';
let tracerProvider;
const connectionString = process.env.PG_CONNECTION_STRING;
export const startMetisInstrumentation = () => {
tracerProvider = new BasicTracerProvider({
resource: new Resource({
[SemanticResourceAttributes.SERVICE_NAME]: process.env.METIS_SERVICE_NAME,
[SemanticResourceAttributes.SERVICE_VERSION]: 'service-version',
}),
});
const metisExporter = getMetisExporter(process.env.METIS_API_KEY);
tracerProvider.addSpanProcessor(new BatchSpanProcessor(metisExporter));
if (process.env.OTEL_DEBUG) {
tracerProvider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
}
const contextManager = new AsyncHooksContextManager();
contextManager.enable();
opentelemetry.context.setGlobalContextManager(contextManager);
tracerProvider.register();
// Urls regex to exclude from instrumentation
const excludeUrls = [/favicon.ico/];
registerInstrumentations({
instrumentations: [
new MetisPgInstrumentation({ connectionString }),
new MetisHttpInstrumentation(excludeUrls)
],
});
};
Pass a valid connectionString to Metis Interceptor, can be set through <process.env.PG_CONNECTION_STRING>, This will generate pg pool to collect queries plans.
:warning: Note: If for any reason connectionString is not available during the tracer setup, there is an option to set it later as follows:
import { setPgConnection } from '@metis-data/pg-interceptor';
// When the connectionString available
setPgConnection(connectionString);
Until connection string is passed, instrumentation will work but won't collect the queries plans.
For more details about tracing setup and components, visit our docs
import { startMetisInstrumentation } from './tracer';
startMetisInstrumentation();
// imports and bootstrap
FAQs
Metis package for pg instrumentation
The npm package @metis-data/pg-interceptor receives a total of 1 weekly downloads. As such, @metis-data/pg-interceptor popularity was classified as not popular.
We found that @metis-data/pg-interceptor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.