Skip to content

Existing detectors fail to compile: breaking change in @opentelemetry/[email protected] #3676

@pichlermarc

Description

@pichlermarc

What happened?

Steps to Reproduce

  • npm i --save-exact @opentelemetry/[email protected]
  • npm i --save-dev typescript
  • create file detector.ts, add the code below
// detector.ts
import { Resource, Detector, ResourceDetectionConfig } from "@opentelemetry/resources";

class EmptyResourceDetector implements Detector{
    async detect(_config?: ResourceDetectionConfig): Promise<Resource> {
        return Resource.empty();
    }
}
  • npx tsc detector.ts --lib es2017

Expected Result

Compiles as it did with @opentelemetry/[email protected]

Actual Result

Fails with a compiler error.

Additional Details

Introduced in #3460

OpenTelemetry Setup Code

// no OpenTelemetry setup is necessary.

package.json

{
  "dependencies": {
    "@opentelemetry/resources": "1.10.0"
  },
  "devDependencies": {
    "typescript": "^4.9.5"
  }
}

Relevant log output

detector.ts:5:9 - error TS2739: Type 'IResource' is missing the following properties from type 'Resource': _attributes, _syncAttributes, _asyncAttributesPromise

5         return Resource.empty();
          ~~~~~~~~~~~~~~~~~~~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority:p1Bugs which cause problems in end-user applications such as crashes, data inconsistencies, etc

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions