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

Counter example from the README generating TS errors #471

Closed
slia-stryber opened this issue Mar 21, 2024 · 2 comments
Closed

Counter example from the README generating TS errors #471

slia-stryber opened this issue Mar 21, 2024 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@slia-stryber
Copy link

slia-stryber commented Mar 21, 2024

import { OtelCounter } from 'nestjs-otel';
import { Counter } from '@opentelemetry/api';

@Controller()
export class AppController {
  @Get('/home')
  home(
    @OtelCounter('app_counter_1_inc', { description: 'counter 1 description' }) counter1: Counter
  ) {
    counter1.add(1);
  }
}

TS2345: Argument of type MetricOptions is not assignable to parameter of type
string | PipeTransform<any, any> | Type<PipeTransform<any, any>>

It's related to the { description: 'counter 1 description' } argument.

@slia-stryber
Copy link
Author

package.json

"dependencies": {
    "@nestjs/common": "^10.3.3",
    "@nestjs/core": "^10.3.3",
    "@nestjs/platform-express": "^10.3.3",
    "@nestjs/swagger": "^7.3.0",
    "@opentelemetry/auto-instrumentations-node": "^0.43.0",
    "@opentelemetry/exporter-prometheus": "^0.49.1",
    "@opentelemetry/exporter-trace-otlp-http": "^0.49.1",
    "@opentelemetry/host-metrics": "^0.35.0",
    "@opentelemetry/instrumentation-express": "^0.36.1",
    "@opentelemetry/instrumentation-nestjs-core": "^0.35.0",
    "@opentelemetry/instrumentation-pino": "^0.36.0",
    "@opentelemetry/sdk-node": "^0.49.1",
    "nestjs-otel": "^5.1.5",
    "nestjs-pino": "^4.0.0",
    "opentelemetry-node-metrics": "^3.0.0",
    "pino": "^8.19.0",
    "pino-http": "^9.0.0",
    "pino-pretty": "^10.3.1",
    "reflect-metadata": "^0.2.1",
    "swagger-ui-express": "^5.0.0",
    "rimraf": "^5.0.5"
  },
  "devDependencies": {
    "@nestjs/cli": "^10.3.2",
    "@nestjs/schematics": "^10.1.1",
    "@nestjs/testing": "^10.3.3",
    "@opentelemetry/api-metrics": "^0.32.0",
    "@types/express": "^4.17.21",
    "@types/jest": "^29.5.12",
    "@types/node": "^20.11.27",
    "@types/supertest": "^6.0.2",
    "@typescript-eslint/eslint-plugin": "^7.2.0",
    "@typescript-eslint/parser": "^7.2.0",
    "eslint": "^8.57.0",
    "eslint-config-prettier": "9.1.0",
    "eslint-plugin-prettier": "^5.1.3",
    "jest": "^29.7.0",
    "prettier": "^3.2.5",
    "supertest": "^6.3.4",
    "ts-jest": "^29.1.2",
    "ts-loader": "^9.5.1",
    "ts-node": "^10.9.2",
    "tsconfig-paths": "^4.2.0",
    "typescript": "^5.4.2"
  },

@pragmaticivan pragmaticivan added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers labels May 8, 2024
@pragmaticivan
Copy link
Owner

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants