Skip to content
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

fix(tracing): cleanup otel setup #5446

Merged
merged 7 commits into from
Jan 8, 2024
Merged

fix(tracing): cleanup otel setup #5446

merged 7 commits into from
Jan 8, 2024

Conversation

JGAntunes
Copy link
Member

πŸŽ‰ Thanks for submitting a pull request! πŸŽ‰

Summary

Follow up to COM-110 - https://linear.app/netlify/issue/COM-110/make-opentelemetry-an-optional-dependency-in-build - this effectively cleans up all the code duplication we've been doing by moving code to separate libraries.


For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code πŸ§‘β€πŸ’». This ensures
    we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or
    something that`s on fire πŸ”₯ (e.g. incident related), you can skip this step.
  • Read the contribution guidelines πŸ“–. This ensures
    your code follows our style guide and passes our tests.
  • Update or add tests (if any source code was changed or added) πŸ§ͺ
  • Update or add documentation (if features were changed or added) πŸ“
  • Make sure the status checks below are successful βœ…

A picture of a cute animal (not mandatory, but encouraged)

@JGAntunes JGAntunes self-assigned this Dec 11, 2023
@JGAntunes JGAntunes requested review from a team as code owners December 11, 2023 19:12
Copy link
Contributor

This pull request adds or modifies JavaScript (.js, .cjs, .mjs) files.
Consider converting them to TypeScript.

Comment on lines -198 to -256
tracing: {
describe: 'Tracing related options',
hidden: true,
},
'tracing.enabled': {
boolean: true,
describe: 'Enable distributed tracing for build',
hidden: true,
},
'tracing.preloadingEnabled': {
boolean: true,
describe: 'Enable distributed tracing for build via module preloading, to be removed once fully rolled out',
hidden: true,
},
'tracing.apiKey': {
string: true,
describe: 'API Key for the tracing backend provider',
hidden: true,
},
'tracing.httpProtocol': {
string: true,
describe: 'Traces backend protocol. HTTP or HTTPS.',
hidden: true,
},
'tracing.host': {
string: true,
describe: 'Traces backend host',
hidden: true,
},
'tracing.port': {
number: true,
describe: 'Traces backend port',
hidden: true,
},
'tracing.traceId': {
string: true,
describe: 'Trace ID used to stitch the emited traces to',
hidden: true,
},
'tracing.parentSpanId': {
string: true,
describe: 'Parent Span ID used to stitch the root parent span to',
hidden: true,
},
'tracing.sampleRate': {
number: true,
describe: 'Trace sample rate for the given trace ID',
hidden: true,
},
'tracing.traceFlags': {
number: true,
describe: 'Trace flags containing the trace settings for the given trace ID',
hidden: true,
},
'tracing.baggageFilePath': {
string: true,
describe: '',
hidden: true,
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer used since we moved the setup to opentelemetry-sdk-setup


import { HoneycombSDK } from '@honeycombio/opentelemetry-node'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this module all of the code has been moved to opentelemetry-sdk-setup

@kitop
Copy link
Contributor

kitop commented Dec 12, 2023

Looks good, but CI is complaining

@@ -672,4 +672,3 @@ test('(Proxy) agent is not passed as request option if not set', async (t) => {

const TEST_RATE_LIMIT_DELAY = 5e3
const SECS_TO_MSECS = 1e3
/* eslint-enable max-lines */
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to introduce this to make eslint happy. I think has part of the lockfile updates we may have bumped the underlying eslint version and this ended up being picked up 🀷

Comment on lines +4 to +12
const benchmarkOptions: BenchmarkUserOptions = {}
// Tinybench dropped support for Node 14 recently so we need to skip benchmark tests for it
// https://github.com/tinylibs/tinybench/pull/40 and
// https://github.com/tinylibs/tinybench/pull/43
// This is just a quick workaround to not run the bench tests in node 14 while we still support it
if (process.version.startsWith('v14')) {
benchmarkOptions.exclude = ['tests/**/*.bench.ts']
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the lockfile update I've brought an update from tinybench from 2.5.0 to 2.5.1 which dropped support for node 14. We'll still run the benchmarks for the other CI test suites, but this skips it for node 14.

Comment on lines +4 to +12
const benchmarkOptions: BenchmarkUserOptions = {}
// Tinybench dropped support for Node 14 recently so we need to skip benchmark tests for it
// https://github.com/tinylibs/tinybench/pull/40 and
// https://github.com/tinylibs/tinybench/pull/43
// This is just a quick workaround to not run the bench tests in node 14 while we still support it
if (process.version.startsWith('v14')) {
benchmarkOptions.exclude = ['tests/**/*.bench.ts']
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the lockfile update I've brought an update from tinybench from 2.5.0 to 2.5.1 which dropped support for node 14. We'll still run the benchmarks for the other CI test suites, but this skips it for node 14.

@@ -15,7 +15,7 @@
"test": "vitest run",
"test:bench": "vitest bench",
"test:dev": "vitest",
"test:ci": "vitest run --reporter=default && vitest bench --run"
"test:ci": "vitest run --reporter=default && vitest bench --run --passWithNoTests"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In node 14 we won't run any bench tests and if tests=0 the default vitest behaviour is to exit with exit code 1

@@ -15,7 +15,7 @@
"test": "vitest run",
"test:bench": "vitest bench",
"test:dev": "vitest",
"test:ci": "vitest run --reporter=default && vitest bench --run"
"test:ci": "vitest run --reporter=default && vitest bench --run --passWithNoTests"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In node 14 we won't run any bench tests and if tests=0 the default vitest behaviour is to exit with exit code 1

@JGAntunes
Copy link
Member Author

Should be fixed @kitop, had to deal with a couple of CI issues πŸ˜“. Despite the low risk nature of the Otel changes, because this touches so many files (also I think build isn't a releasable state currently - https://netlify.slack.com/archives/C023PC3D08J/p1703679363161299?thread_ts=1703106655.819339&cid=C023PC3D08J) I'll look into shipping this next week.

@JGAntunes JGAntunes merged commit 2d10996 into main Jan 8, 2024
36 checks passed
@JGAntunes JGAntunes deleted the chore/cleanup-otel-setup branch January 8, 2024 10:52
This was referenced May 23, 2024
This was referenced Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants