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

chore(gatsby): jaeger-local to TypeScript #23656

Merged
merged 4 commits into from
May 5, 2020

Conversation

chooban
Copy link
Contributor

@chooban chooban commented Apr 30, 2020

Description

Migrates the Jaeger config file which is referenced in the performance tracing docs.

Since it's an example, the Jaeger client package itself is not in the dependencies.

Documentation

The file should be transpiled to JS so won't need any docs updating.

Related Issues

ref #21995

@chooban chooban requested a review from a team as a code owner April 30, 2020 19:21
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Apr 30, 2020
@pieh pieh added status: needs core review Currently awaiting review from Core team member type: TypeScript migration and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Apr 30, 2020
@mgienow mgienow assigned mgienow and unassigned mgienow Apr 30, 2020
@pieh pieh self-assigned this May 2, 2020
@@ -0,0 +1,37 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

Why there is // @ts-ignore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apologies for the lack of comment. This is because we don't have a dependency on jaeger-client as this is an example to be used in other projects. No dependency means we get the Cannot find module error.

Thinking about how the file is to be used, it might be a candidate for a @ts-nocheck, but if we do migrate it, and types are added, at least we'll get warnings if a jaeger change breaks it. I am now arguing myself in circles!

Copy link
Contributor

Choose a reason for hiding this comment

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

We could try making jaeger-client optional peer dependency ( https://medium.com/@noamgjacobsonknzi/what-is-peerdependenciesmeta-acea887c32dd )

This is supported by yarn@^1.13.0 and npm@^6.11.0 - worry here is that npm@^6.11.0 started shipping with Node.js in Node.js 12.11.0, so there would be quite a bit of not resolver peer deps warnings if user didn't upgrade npm if they are on earlier node versions

But also - I removed this @ts-ignore locally for testing and didn't see complaints when trying eslint and typecheck - what am I missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you have jaeger-client installed at all? If I do yarn why jaeger-client I get the We couldn't find a match that's expected, then yarn typecheck throws an error when I run it. I also get the warning in VS Code, but it's probably safer to just check the official scripts.

Copy link
Contributor

Choose a reason for hiding this comment

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

I also don't have it installed:
Screenshot 2020-05-04 at 15 22 25

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am now in the same position as you! I noticed the last push failed typecheck on CI, which surprised me as there'd been no issues locally, so I did yarn bootstrap; yarn typecheck just to make sure I wasn't missing anything, and the CI error appeared. Fixed it, removed the ts-ignore in question, and now everything is perfectly happy.

I wish I had a longer history set in my terminal so that I could screenshot it!

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's see what CI says after last commit you pushed. There just be more to it (or maybe it wasn't typecheck that failed?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The last CI failure was typecheck, but was to do with the extended interface I added. Because initTracer returns a JaegerTracer object, it was complaining that it didn't match my new interface. Obvious, really, but for some reason I didn't get the failure in VS Code. The lint-staged task doesn't trigger on changes to TypeScript files so it wasn't caught by husky.

@pieh
Copy link
Contributor

pieh commented May 4, 2020

I tested it out locally and jeager still works nicely, but I feel like we should address @ts-ignore part before merging this in

@chooban chooban marked this pull request as draft May 4, 2020 13:01
@chooban chooban force-pushed the ts-migration/jaeger-local branch from 44010e9 to 47adc64 Compare May 5, 2020 08:02
@chooban chooban marked this pull request as ready for review May 5, 2020 08:27
@chooban
Copy link
Contributor Author

chooban commented May 5, 2020

I've updated the version of the types package, and merged up to date. @pieh, it involved a force push to my repo, so if you want to check it out locally you'll need to take that into account.

@pieh pieh marked this pull request as ready for review May 5, 2020 08:42
@pieh
Copy link
Contributor

pieh commented May 5, 2020

Will do quick local test and merge this one if there are no problems (there shouldn't be as only thing that changed was removing few @ts-ignore directives)

Copy link
Contributor

@pieh pieh left a comment

Choose a reason for hiding this comment

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

Awesome work @chooban - both conversion and communicating and collaborating on PR (including tracking upstream)! Thanks so much!

@pieh pieh merged commit e62499a into gatsbyjs:master May 5, 2020
@chooban
Copy link
Contributor Author

chooban commented May 5, 2020

You're welcome! I've been working on another that's beyond my understanding, so I might put up a "help wanted" PR on the "help wanted" migration issue!

@chooban chooban deleted the ts-migration/jaeger-local branch May 5, 2020 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs core review Currently awaiting review from Core team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants