Skip to content

Commit

Permalink
Fix issues in TypeScript getting started example code (#1374)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
  • Loading branch information
mickdekkers and dyladan authored Aug 5, 2020
1 parent 2af2d0c commit 88cd842
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions getting-started/ts-example/monitoring.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { MeterProvider } from '@opentelemetry/metrics';
import { Metric, BoundCounter } from '@opentelemetry/api';
import { Counter } from '@opentelemetry/api';
import { PrometheusExporter } from '@opentelemetry/exporter-prometheus';
import { RequestHandler } from "express";

const exporter = new PrometheusExporter(
{
Expand All @@ -18,13 +19,13 @@ const meter = new MeterProvider({
interval: 1000,
}).getMeter('example-ts');

const requestCount: Metric<BoundCounter> = meter.createCounter("requests", {
const requestCount: Counter = meter.createCounter("requests", {
description: "Count all incoming requests"
});

const handles = new Map();

export const countAllRequests = () => {
export const countAllRequests = (): RequestHandler => {
return (req, res, next) => {
if (!handles.has(req.path)) {
const labels = { route: req.path };
Expand Down
2 changes: 2 additions & 0 deletions getting-started/ts-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"devDependencies": {
"@types/express": "^4.17.7",
"@types/node": "^14.0.27",
"ts-node": "8.10.2"
},
"dependencies": {
Expand Down

0 comments on commit 88cd842

Please sign in to comment.