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 issues in TypeScript getting started example code #1374

Merged
merged 3 commits into from
Aug 5, 2020

Conversation

mickdekkers
Copy link
Contributor

Which problem is this PR solving?

Problems in the TypeScript getting started example:

  • The use of a non-generic type as generic
  • Gaps in the TypeScript type coverage

Short description of the changes

  • Change the use of Metric<BoundCounter> to Counter (Metric is no longer generic, so this didn't compile)
  • Add @types/node so TypeScript can compile app.ts which uses process.env
  • Add @types/express so the express API is no longer any
  • Define the the result type of the countAllRequests function as an Express RequestHandler so that req, res, and next are no longer any

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Aug 2, 2020

CLA Check
The committers are authorized under a signed CLA.

@codecov
Copy link

codecov bot commented Aug 2, 2020

Codecov Report

Merging #1374 into master will decrease coverage by 0.15%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #1374      +/-   ##
==========================================
- Coverage   93.77%   93.61%   -0.16%     
==========================================
  Files         149      149              
  Lines        4322     4261      -61     
  Branches      880      870      -10     
==========================================
- Hits         4053     3989      -64     
- Misses        269      272       +3     
Impacted Files Coverage Δ
...lemetry-exporter-collector/src/transformMetrics.ts 80.68% <0.00%> (-3.19%) ⬇️
...metry-core/src/context/propagation/B3Propagator.ts 97.67% <0.00%> (-2.33%) ⬇️
packages/opentelemetry-metrics/src/export/types.ts 100.00% <0.00%> (ø)
...pentelemetry-metrics/src/export/aggregators/Sum.ts 100.00% <0.00%> (ø)
...emetry-metrics/src/export/aggregators/Histogram.ts 100.00% <0.00%> (ø)
...trics/src/export/aggregators/MinMaxLastSumCount.ts 100.00% <0.00%> (ø)

@mickdekkers
Copy link
Contributor Author

I noticed 2 more things while I was following the guide:

  • typescript is not a (dev)dependency, so the npm scripts don't work (well, they might inside the opentelemetry-js repo due to phantom dependency).
  • the README.md of the guide explains step by step how to arrive at the state in the folder and includes code samples and npm install commands. We'll want to update the readme to keep it in sync.

I'll try to update this PR soon, probably tomorrow.

import { PrometheusExporter } from '@opentelemetry/exporter-prometheus';
import { RequestHandler } from "express";
Copy link
Member

Choose a reason for hiding this comment

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

interesting is that this line didn't cause the build to fail on linting, as there should be single quotes.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think the getting started guide is linted

Copy link
Member

Choose a reason for hiding this comment

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

@mickdekkers can you please change this line to use single quotes ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure thing, I'll change it to single quotes 👍

FYI, this isn't consistent in the getting started guide: tracing.ts uses both single and double quotes and app.ts uses double quotes

Copy link
Member

Choose a reason for hiding this comment

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

Like I said, the guide isn't linted. Since the guide rarely changes, I think it isn't necessarily a problem. Let's make these small quote changes and merge this. Eventually, the guide will need to be rewritten for the sdk package, and maybe we should start linting it then.

@dyladan
Copy link
Member

dyladan commented Aug 5, 2020

I am going to merge this, with a follow up to lint the getting started guide

@dyladan dyladan merged commit 88cd842 into open-telemetry:master Aug 5, 2020
jonahrosenblum pushed a commit to jonahrosenblum/opentelemetry-js that referenced this pull request Aug 8, 2020
…#1374)

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
obecny added a commit that referenced this pull request Aug 17, 2020
* feat: graceful shutdown for tracing and metrics

* fix: wording in test case

* fix: typo

* fix meterprovider config to use bracket notation

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>

* fix meterprovider config to use bracket notation

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>

* fix: add callbacks to shutdown methods

* fix: merge conflict

* simplify meter shutdown code

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>

* fix: fix one-liner

* private function name style fix

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>

* fix: naming of private member variables

* fix: graceful shutdown now works in browser

* fix: window event listener will trigger once

* fix: modify global shutdown helper functions

* fix: remove callback from remove listener args

* fix: change global shutdown function names and simplify functionality

* fix: add rest of function refactoring and simplification

* fix: remove unintended code snippet

* fix: refactor naming of listener cleanup function and fix sandbox issue

* fix: make global shutdown cleanup local

* fix: change interval of MeterProvider collection to ensure it does not trigger through clock

* chore: removing _cleanupGlobalShutdownListeners

* fix: remove unnecesary trace provider member function

* Removing default span attributes (#1342)

* refactor(opentelemetry-tracing): removing default span attributes

Signed-off-by: Aravin Sivakumar <aravinarjunn@gmail.com>

* refactor(opentelemetry-tracing): removing default span attributed from tracer object

Signed-off-by: Aravin Sivakumar <aravinarjunn@gmail.com>

* refactor(opentelemetry-tracing): removing accidental add to package.json

Signed-off-by: Aravin Sivakumar <aravinarjunn@gmail.com>

* refactor(opentelemetry-tracing): removing redundant test and fixing suggestions by Shawn and Daniel

Signed-off-by: Aravin Sivakumar <aravinarjunn@gmail.com>

* feat: add baggage support to the opentracing shim (#918)

Co-authored-by: Mayur Kale <mayurkale@google.com>

* Add nodejs sdk package (#1187)

Co-authored-by: Naseem <naseemkullah@gmail.com>
Co-authored-by: legendecas <legendecas@gmail.com>
Co-authored-by: Mark Wolff <mrw00010@gmail.com>
Co-authored-by: Matthew Wear <matthew.wear@gmail.com>

* feat: add OTEL_LOG_LEVEL env var (#974)

* Proto update to latest to support arrays and maps (#1339)

* chore: 0.10.0 release proposal (#1345)

* fix: add missing grpc-js index (#1358)

* chore: 0.10.1 release proposal (#1359)

* feat(api/context-base): change compile target to es5 (#1368)

* Feat: Make ID generator configurable (#1331)

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>

* fix: require grpc-js instead of grpc in grpc-js example (#1364)

Co-authored-by: Bartlomiej Obecny <bobecny@gmail.com>

* chore(deps): update all non-major dependencies (#1371)

* chore: bump metapackage dependencies (#1383)

* chore: 0.10.2 proposal (#1382)

* fix: remove unnecesary trace provider member function

* refactor(metrics): distinguish different aggregator types (#1325)

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>

* Propagate b3 parentspanid and debug flag (#1346)

* feat: Export MinMaxLastSumCountAggregator metrics to the collector as Summary (#1320)

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>

* feat: Collector Metric Exporter for the Web (#1308)

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>

* Fix issues in TypeScript getting started example code (#1374)

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>

* chore: deploy canary releases (#1384)

* fix: protos pull

* fix: address marius' feedback

* chore: deleting removeAllListeners from prometheus, fixing tests, cleanu of events when using shutdown notifier

* fix: add documentation and cleanup code

* fix: remove async label from shutdown and cleanup test case

* fix: update controller collect to return promise

* fix: make downsides of disabling graceful shutdown more apparent

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
Co-authored-by: Bartlomiej Obecny <bobecny@gmail.com>
Co-authored-by: Aravin <34178459+aravinsiva@users.noreply.github.com>
Co-authored-by: Ruben Vargas Palma <ruben.vp8510@gmail.com>
Co-authored-by: Mayur Kale <mayurkale@google.com>
Co-authored-by: Naseem <naseemkullah@gmail.com>
Co-authored-by: legendecas <legendecas@gmail.com>
Co-authored-by: Mark Wolff <mrw00010@gmail.com>
Co-authored-by: Matthew Wear <matthew.wear@gmail.com>
Co-authored-by: Naseem <naseem@transit.app>
Co-authored-by: Mark Wolff <mark.wolff@microsoft.com>
Co-authored-by: Cong Zou <32532612+EdZou@users.noreply.github.com>
Co-authored-by: Reginald McDonald <40721169+reggiemcdonald@users.noreply.github.com>
Co-authored-by: WhiteSource Renovate <bot@renovateapp.com>
Co-authored-by: srjames90 <srjames@lightstep.com>
Co-authored-by: David W <dwitt12345@gmail.com>
Co-authored-by: Mick Dekkers <mickdekkersnl@gmail.com>
pichlermarc pushed a commit to dynatrace-oss-contrib/opentelemetry-js that referenced this pull request Dec 15, 2023
* chore(mongodb): fix build after v5 release

* chore: pin @types/bson version in monorepo root for lerna hoisting

* chore: pin @types/bson version in monorepo root for lerna hoisting

* chore: pin @types/bson version in mongodb

* chore: patch winston module (logform breaking), ts 4.5.5 fixes

* chore: change typescript to 4.4.4

* chore: change typescript to 4.4.4
martinkuba pushed a commit to martinkuba/opentelemetry-js that referenced this pull request Mar 13, 2024
* chore(mongodb): fix build after v5 release

* chore: pin @types/bson version in monorepo root for lerna hoisting

* chore: pin @types/bson version in monorepo root for lerna hoisting

* chore: pin @types/bson version in mongodb

* chore: patch winston module (logform breaking), ts 4.5.5 fixes

* chore: change typescript to 4.4.4

* chore: change typescript to 4.4.4
martinkuba pushed a commit to martinkuba/opentelemetry-js that referenced this pull request Mar 16, 2024
* chore(mongodb): fix build after v5 release

* chore: pin @types/bson version in monorepo root for lerna hoisting

* chore: pin @types/bson version in monorepo root for lerna hoisting

* chore: pin @types/bson version in mongodb

* chore: patch winston module (logform breaking), ts 4.5.5 fixes

* chore: change typescript to 4.4.4

* chore: change typescript to 4.4.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants