Skip to content

Commit

Permalink
Merge branch 'main' into test/no-hardcoded-versions
Browse files Browse the repository at this point in the history
  • Loading branch information
pichlermarc authored Oct 14, 2024
2 parents eb4f970 + a1442fe commit d5d7839
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 3 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/publish-to-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish packages to NPM

on:
workflow_dispatch:

jobs:
release-to-npm:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'

- run: npm ci

- run: npm run compile

- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NPM_CONFIG_PROVENANCE: true
run: npx lerna publish --concurrency 1 from-package --no-push --no-private --no-git-tag-version --no-verify-access --yes
6 changes: 6 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ jobs:
run: npm run test
- name: Report Coverage
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
verbose: true
node-windows-tests:
Expand Down Expand Up @@ -102,6 +104,8 @@ jobs:
run: npm run test:browser
- name: Report Coverage
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
verbose: true
webworker-tests:
Expand All @@ -128,6 +132,8 @@ jobs:
run: npm run test:webworker
- name: Report Coverage
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
verbose: true
api-eol-node-test:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ For semantic convention package changes, see the [semconv CHANGELOG](packages/se
* fix(resources): prevent circular import (resource -> detector -> resource -> ...) [#4653](https://github.com/open-telemetry/opentelemetry-js/pull/4653) @pichlermarc
* fixes a circular import warning which would appear in rollup when bundling `@opentelemetry/resources`
* fix(exporter-metrics-otlp-grpc): add explicit otlp-exporter-base dependency to exporter-metrics-otlp-grpc [#4678](https://github.com/open-telemetry/opentelemetry-js/pull/4678) @AkselAllas
* fix(resources) wait for async attributes for detecting resources [#4687](https://github.com/open-telemetry/opentelemetry-js/pull/4687) @ziolekjj

## 1.24.0

Expand Down
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,16 @@ To run the unit tests continuously in watch mode while developing, use:
npm run tdd
```

Packages that are expected to run in the browser have browser specific tests:

```sh
# Run browser-specific test
npm run test:browser

# Run web worker test
npm run test:webworker
```

### Linting

This project uses `eslint` to lint source code. Just like tests and compilation, linting can be done for all packages or only a single package.
Expand Down
1 change: 1 addition & 0 deletions experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ All notable changes to experimental packages in this project will be documented
* `OTEL_EXPORTER_OTLP_METRICS_INSECURE`
* `OTEL_EXPORTER_OTLP_LOGS_INSECURE`
* fix(sdk-node): use warn instead of error on unknown OTEL_NODE_RESOURCE_DETECTORS values [#5034](https://github.com/open-telemetry/opentelemetry-js/pull/5034)
* fix(exporter-logs-otlp-proto): Use correct config type in Node constructor

### :books: (Refine Doc)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

import {
OTLPExporterConfigBase,
OTLPExporterNodeBase,
OTLPExporterNodeConfigBase,
} from '@opentelemetry/otlp-exporter-base';
import {
IExportLogsServiceResponse,
Expand All @@ -37,7 +37,7 @@ export class OTLPLogExporter
extends OTLPExporterNodeBase<ReadableLogRecord, IExportLogsServiceResponse>
implements LogRecordExporter
{
constructor(config: OTLPExporterConfigBase = {}) {
constructor(config: OTLPExporterNodeConfigBase = {}) {
super(
config,
ProtobufLogsSerializer,
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry-resources/src/detect-resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export const detectResourcesSync = (
if (isPromiseLike<Resource>(resourceOrPromise)) {
const createPromise = async () => {
const resolvedResource = await resourceOrPromise;
await resolvedResource.waitForAsyncAttributes?.();
return resolvedResource.attributes;
};
resource = new Resource({}, createPromise());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ describe('detectResourcesSync', () => {
it('handles resource detectors which return Promise<Resource>', async () => {
const detector: Detector = {
async detect() {
return new Resource({ sync: 'fromsync' });
return new Resource(
{ sync: 'fromsync' },
Promise.resolve().then(() => ({ async: 'fromasync' }))
);
},
};
const resource = detectResourcesSync({
Expand All @@ -38,6 +41,7 @@ describe('detectResourcesSync', () => {
await resource.waitForAsyncAttributes?.();
assert.deepStrictEqual(resource.attributes, {
sync: 'fromsync',
async: 'fromasync',
});
});

Expand Down

0 comments on commit d5d7839

Please sign in to comment.