Skip to main content
Glama

Prisma MCP Server

Official
by prisma
Apache 2.0
4
44,192
  • Linux
  • Apple
PrismaInstrumentation.ts1.97 kB
import { trace, TracerProvider } from '@opentelemetry/api' import { InstrumentationBase, InstrumentationConfig, InstrumentationNodeModuleDefinition, } from '@opentelemetry/instrumentation' import { PrismaInstrumentationGlobalValue } from '@prisma/internals' import { ActiveTracingHelper } from './ActiveTracingHelper' import { GLOBAL_INSTRUMENTATION_ACCESSOR_KEY, GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY, MODULE_NAME, NAME, VERSION, } from './constants' export interface PrismaInstrumentationConfig { ignoreSpanTypes?: (string | RegExp)[] } type Config = PrismaInstrumentationConfig & InstrumentationConfig export class PrismaInstrumentation extends InstrumentationBase { private tracerProvider: TracerProvider | undefined constructor(config: Config = {}) { super(NAME, VERSION, config) } setTracerProvider(tracerProvider: TracerProvider): void { this.tracerProvider = tracerProvider } init() { const module = new InstrumentationNodeModuleDefinition(MODULE_NAME, [VERSION]) return [module] } enable() { const config = this._config as Config const globalValue: PrismaInstrumentationGlobalValue = { helper: new ActiveTracingHelper({ tracerProvider: this.tracerProvider ?? trace.getTracerProvider(), ignoreSpanTypes: config.ignoreSpanTypes ?? [], }), } // TODO(v7): Future major versions should only write to the GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY, to prevent version incompatibilities with instrumentation libraries to cause errors when the `TracingHelper` interface is changed. global[GLOBAL_INSTRUMENTATION_ACCESSOR_KEY] = globalValue global[GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY] = globalValue } disable() { delete global[GLOBAL_INSTRUMENTATION_ACCESSOR_KEY] delete global[GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY] } isEnabled() { return Boolean(global[GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY]) } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/prisma/prisma'

If you have feedback or need assistance with the MCP directory API, please join our Discord server