New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(CRWA): convert to ESM #8159
Changes from all commits
2cdba03
b2034b4
815faba
9338b02
098e523
dc68e6b
aec1bfd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
import path from 'node:path' | ||
import { fileURLToPath } from 'node:url' | ||
|
||
import { diag, DiagConsoleLogger, DiagLogLevel } from '@opentelemetry/api' | ||
import opentelemetry, { SpanStatusCode } from '@opentelemetry/api' | ||
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http' | ||
|
@@ -9,10 +12,15 @@ import { | |
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions' | ||
import ci from 'ci-info' | ||
import envinfo from 'envinfo' | ||
import fs from 'fs-extra' | ||
import system from 'systeminformation' | ||
import { v4 as uuidv4 } from 'uuid' | ||
|
||
import { name as packageName, version as packageVersion } from '../package' | ||
// JSON modules aren't stable yet, but if they were we could use them instead. | ||
// See https://nodejs.org/dist/latest-v18.x/docs/api/esm.html#json-modules. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was interesting to me, so I did some digging. It looks like it'll change syntax slightly before it fully ships ( TIL 🙂 |
||
const { name: packageName, version: packageVersion } = fs.readJSONSync( | ||
path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../package.json') | ||
) | ||
|
||
/** | ||
* @type NodeTracerProvider | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To use
require
now, we'd have to create it usingcreateRequire
.