Skip to content

Commit

Permalink
Merge branch 'main' into feature/prometheus-serializer-resources
Browse files Browse the repository at this point in the history
  • Loading branch information
pichlermarc authored Oct 17, 2022
2 parents dd13525 + 92f2359 commit ea81f11
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 25 deletions.
51 changes: 36 additions & 15 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ jobs:
run: npm run codecov
if: ${{ matrix.node_version == '14' }}
node-windows-tests:
strategy:
fail-fast: false
runs-on: windows-latest
env:
NPM_CONFIG_UNSAFE_PERM: true
Expand Down Expand Up @@ -96,15 +94,15 @@ jobs:
run: npm run test
browser-tests:
runs-on: ubuntu-latest
container:
image: circleci/node:16-browsers
env:
NPM_CONFIG_UNSAFE_PERM: true
steps:
- name: Permission Setup
run: sudo chmod -R 777 /github /__w
- name: Checkout
uses: actions/[email protected]
uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 16

- name: restore lerna
id: cache
Expand All @@ -126,8 +124,6 @@ jobs:
- name: Build 🔧
run: |
npm run compile
# run additional compilation variants
npx lerna run compile
- name: Unit tests
Expand All @@ -136,15 +132,14 @@ jobs:
run: npm run codecov:browser
webworker-tests:
runs-on: ubuntu-latest
container:
image: circleci/node:16-browsers
env:
NPM_CONFIG_UNSAFE_PERM: true
steps:
- name: Permission Setup
run: sudo chmod -R 777 /github /__w
- name: Checkout
uses: actions/[email protected]
- uses: actions/setup-node@v3
with:
node-version: 16

- name: restore lerna
id: cache
Expand All @@ -166,11 +161,37 @@ jobs:
- name: Build 🔧
run: |
npm run compile
# run additional compilation variants
npx lerna run compile
- name: Unit tests
run: npm run test:webworker
- name: Report Coverage
run: npm run codecov:webworker
api-eol-node-test:
strategy:
fail-fast: false
matrix:
node_version:
- "8"
- "10"
- "12"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}

- name: Build
working-directory: ./api
run: |
npm install --ignore-scripts
npm install @types/mocha@^7 mocha@^7 ts-loader@^8 ts-mocha@^8
node ../scripts/version-update.js
tsc --build tsconfig.json tsconfig.esm.json
- name: Test
working-directory: ./api
run: npm test
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@ All notable changes to this project will be documented in this file.

### :bug: (Bug Fix)

* fix(resources): fix EnvDetector throwing errors when attribute values contain spaces
[#3295](https://github.com/open-telemetry/opentelemetry-js/issues/3295)

### :books: (Refine Doc)

### :house: (Internal)

* ci: run browser tests without circle [#3328](https://github.com/open-telemetry/opentelemetry-js/pull/3328) @dyladan

## 1.7.0

### :bug: (Bug Fix)
Expand Down
1 change: 1 addition & 0 deletions experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ All notable changes to experimental packages in this project will be documented

* fix(node-sdk): move `@opentelemetry/semantic-conventions` to `dependencies` [#3283](https://github.com/open-telemetry/opentelemetry-js/pull/3283) @mhassan1
* fix(exporters): do not append trailing '/' when URL contains path [#3274](https://github.com/open-telemetry/opentelemetry-js/pull/3274) @pichlermarc
* fix(instrumentation): debug log on no modules defined for instrumentation [#3308](https://github.com/open-telemetry/opentelemetry-js/pull/3308) @legendecas

### :books: (Refine Doc)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ export abstract class InstrumentationBase<T = any>
this._modules = (modules as InstrumentationModuleDefinition<T>[]) || [];

if (this._modules.length === 0) {
diag.warn(
'No modules instrumentation has been defined,' +
' nothing will be patched'
diag.debug(
'No modules instrumentation has been defined for ' +
`'${this.instrumentationName}@${this.instrumentationVersion}'` +
', nothing will be patched'
);
}

Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-resources/src/detectors/EnvDetector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class EnvDetector implements Detector {
let [key, value] = keyValuePair;
// Leading and trailing whitespaces are trimmed.
key = key.trim();
value = value.trim().split('^"|"$').join('');
value = value.trim().split(/^"|"$/).join('');
if (!this._isValidAndNotEmpty(key)) {
throw new Error(`Attribute key ${this._ERROR_MESSAGE_INVALID_CHARS}`);
}
Expand All @@ -136,7 +136,7 @@ class EnvDetector implements Detector {
private _isPrintableString(str: string): boolean {
for (let i = 0; i < str.length; i++) {
const ch: string = str.charAt(i);
if (ch <= ' ' || ch >= '~') {
if (ch < ' ' || ch >= '~') {
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/

import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
import { envDetector, Resource } from '../../../src';
import {
assertK8sResource,
Expand All @@ -26,7 +25,7 @@ describeNode('envDetector() on Node.js', () => {
describe('with valid env', () => {
before(() => {
process.env.OTEL_RESOURCE_ATTRIBUTES =
'k8s.pod.name="pod-xyz-123",k8s.cluster.name="c1",k8s.namespace.name="default"';
'k8s.pod.name="pod-xyz-123",k8s.cluster.name="c1",k8s.namespace.name="default",k8s.deployment.name="deployment name"';
});

after(() => {
Expand All @@ -36,9 +35,10 @@ describeNode('envDetector() on Node.js', () => {
it('should return resource information from environment variable', async () => {
const resource: Resource = await envDetector.detect();
assertK8sResource(resource, {
[SemanticResourceAttributes.K8S_POD_NAME]: 'pod-xyz-123',
[SemanticResourceAttributes.K8S_CLUSTER_NAME]: 'c1',
[SemanticResourceAttributes.K8S_NAMESPACE_NAME]: 'default',
podName: 'pod-xyz-123',
clusterName: 'c1',
namespaceName: 'default',
deploymentName: 'deployment name'
});
});
});
Expand Down

0 comments on commit ea81f11

Please sign in to comment.