mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #10279 from overleaf/jpa-tracing-optimizations
[misc] do not load the tracing module unless enabled GitOrigin-RevId: 8a3b9da3e9451e3060b852dd44e078c99cf43cfa
This commit is contained in:
parent
aac9e6616e
commit
50b346b4ed
5 changed files with 21 additions and 19 deletions
|
@ -1,20 +1,3 @@
|
|||
const opentelemetry = require('@opentelemetry/sdk-node')
|
||||
const {
|
||||
getNodeAutoInstrumentations,
|
||||
} = require('@opentelemetry/auto-instrumentations-node')
|
||||
const {
|
||||
diag,
|
||||
DiagConsoleLogger,
|
||||
DiagLogLevel,
|
||||
trace,
|
||||
} = require('@opentelemetry/api')
|
||||
const { JaegerExporter } = require('@opentelemetry/exporter-jaeger')
|
||||
const { Resource } = require('@opentelemetry/resources')
|
||||
const {
|
||||
SemanticResourceAttributes,
|
||||
} = require('@opentelemetry/semantic-conventions')
|
||||
const GCP = require('@google-cloud/opentelemetry-cloud-trace-exporter')
|
||||
|
||||
let tracer
|
||||
|
||||
function tracingEnabled() {
|
||||
|
@ -22,6 +5,23 @@ function tracingEnabled() {
|
|||
}
|
||||
|
||||
function initialize(appName) {
|
||||
const opentelemetry = require('@opentelemetry/sdk-node')
|
||||
const {
|
||||
getNodeAutoInstrumentations,
|
||||
} = require('@opentelemetry/auto-instrumentations-node')
|
||||
const {
|
||||
diag,
|
||||
DiagConsoleLogger,
|
||||
DiagLogLevel,
|
||||
trace,
|
||||
} = require('@opentelemetry/api')
|
||||
const { JaegerExporter } = require('@opentelemetry/exporter-jaeger')
|
||||
const { Resource } = require('@opentelemetry/resources')
|
||||
const {
|
||||
SemanticResourceAttributes,
|
||||
} = require('@opentelemetry/semantic-conventions')
|
||||
const GCP = require('@google-cloud/opentelemetry-cloud-trace-exporter')
|
||||
|
||||
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.INFO)
|
||||
|
||||
const resource = new Resource({
|
||||
|
|
|
@ -115,6 +115,8 @@ block append meta
|
|||
include ./editor/meta
|
||||
|
||||
block foot-scripts
|
||||
each file in (useOpenTelemetry ? entrypointScripts("tracing") : [])
|
||||
script(type="text/javascript", nonce=scriptNonce, src=file)
|
||||
script(type="text/javascript", nonce=scriptNonce, src=(wsUrl || '/socket.io') + '/socket.io.js')
|
||||
script(type="text/javascript", nonce=scriptNonce, src=mathJaxPath)
|
||||
each file in entrypointScripts("ide")
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
* DS207: Consider shorter variations of null checks
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
import '../tracing'
|
||||
import App from './base'
|
||||
import FileTreeManager from './ide/file-tree/FileTreeManager'
|
||||
import LoadingManager from './ide/LoadingManager'
|
||||
|
|
|
@ -7,7 +7,7 @@ import { ZoneContextManager } from '@opentelemetry/context-zone'
|
|||
import { registerInstrumentations } from '@opentelemetry/instrumentation'
|
||||
import { getWebAutoInstrumentations } from '@opentelemetry/auto-instrumentations-web'
|
||||
|
||||
import getMeta from './js/utils/meta'
|
||||
import getMeta from './utils/meta'
|
||||
|
||||
if (getMeta('ol-useOpenTelemetry')) {
|
||||
const resource = new Resource({
|
|
@ -12,6 +12,7 @@ const PackageVersions = require('./app/src/infrastructure/PackageVersions')
|
|||
|
||||
// Generate a hash of entry points, including modules
|
||||
const entryPoints = {
|
||||
tracing: './frontend/js/tracing.js',
|
||||
main: './frontend/js/main.js',
|
||||
ide: './frontend/js/ide.js',
|
||||
'ide-detached': './frontend/js/ide-detached.js',
|
||||
|
|
Loading…
Reference in a new issue