@genkit-ai/google-cloud
Version:
Genkit AI framework plugin for Google Cloud Platform including Firestore trace/state store and deployment helpers for Cloud Functions for Firebase.
1 lines • 3.45 kB
Source Map (JSON)
{"version":3,"sources":["../../src/telemetry/defaults.ts"],"sourcesContent":["/**\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AlwaysOnSampler } from '@opentelemetry/sdk-trace-base';\nimport { isDevEnv } from 'genkit';\nimport type {\n GcpTelemetryConfig,\n GcpTelemetryConfigOptions,\n} from '../types.js';\n\n/** Consolidated defaults for telemetry configuration. */\n\nexport const TelemetryConfigs = {\n defaults: (overrides: GcpTelemetryConfigOptions = {}): GcpTelemetryConfig => {\n return isDevEnv()\n ? TelemetryConfigs.developmentDefaults(overrides)\n : TelemetryConfigs.productionDefaults(overrides);\n },\n\n developmentDefaults: (\n overrides: GcpTelemetryConfigOptions = {}\n ): GcpTelemetryConfig => {\n const defaults = {\n sampler: new AlwaysOnSampler(),\n autoInstrumentation: true,\n autoInstrumentationConfig: {\n '@opentelemetry/instrumentation-dns': { enabled: false },\n },\n instrumentations: [],\n metricExportIntervalMillis: 5_000,\n metricExportTimeoutMillis: 5_000,\n disableMetrics: false,\n disableTraces: false,\n exportInputAndOutput: !overrides.disableLoggingInputAndOutput,\n export: !!overrides.forceDevExport, // false\n };\n return { ...defaults, ...overrides };\n },\n\n productionDefaults: (\n overrides: GcpTelemetryConfigOptions = {}\n ): GcpTelemetryConfig => {\n const defaults = {\n sampler: new AlwaysOnSampler(),\n autoInstrumentation: true,\n autoInstrumentationConfig: {\n '@opentelemetry/instrumentation-dns': { enabled: false },\n },\n instrumentations: [],\n metricExportIntervalMillis: 300_000,\n metricExportTimeoutMillis: 300_000,\n disableMetrics: false,\n disableTraces: false,\n exportInputAndOutput: !overrides.disableLoggingInputAndOutput,\n export: true,\n };\n return { ...defaults, ...overrides };\n },\n};\n"],"mappings":"AAgBA,SAAS,uBAAuB;AAChC,SAAS,gBAAgB;AAQlB,MAAM,mBAAmB;AAAA,EAC9B,UAAU,CAAC,YAAuC,CAAC,MAA0B;AAC3E,WAAO,SAAS,IACZ,iBAAiB,oBAAoB,SAAS,IAC9C,iBAAiB,mBAAmB,SAAS;AAAA,EACnD;AAAA,EAEA,qBAAqB,CACnB,YAAuC,CAAC,MACjB;AACvB,UAAM,WAAW;AAAA,MACf,SAAS,IAAI,gBAAgB;AAAA,MAC7B,qBAAqB;AAAA,MACrB,2BAA2B;AAAA,QACzB,sCAAsC,EAAE,SAAS,MAAM;AAAA,MACzD;AAAA,MACA,kBAAkB,CAAC;AAAA,MACnB,4BAA4B;AAAA,MAC5B,2BAA2B;AAAA,MAC3B,gBAAgB;AAAA,MAChB,eAAe;AAAA,MACf,sBAAsB,CAAC,UAAU;AAAA,MACjC,QAAQ,CAAC,CAAC,UAAU;AAAA;AAAA,IACtB;AACA,WAAO,EAAE,GAAG,UAAU,GAAG,UAAU;AAAA,EACrC;AAAA,EAEA,oBAAoB,CAClB,YAAuC,CAAC,MACjB;AACvB,UAAM,WAAW;AAAA,MACf,SAAS,IAAI,gBAAgB;AAAA,MAC7B,qBAAqB;AAAA,MACrB,2BAA2B;AAAA,QACzB,sCAAsC,EAAE,SAAS,MAAM;AAAA,MACzD;AAAA,MACA,kBAAkB,CAAC;AAAA,MACnB,4BAA4B;AAAA,MAC5B,2BAA2B;AAAA,MAC3B,gBAAgB;AAAA,MAChB,eAAe;AAAA,MACf,sBAAsB,CAAC,UAAU;AAAA,MACjC,QAAQ;AAAA,IACV;AACA,WAAO,EAAE,GAAG,UAAU,GAAG,UAAU;AAAA,EACrC;AACF;","names":[]}