Skip to content

Commit dc0b748

Browse files
authored
Merge branch 'main' into instrumentation-no-modules
2 parents 5c86acb + a7d053a commit dc0b748

File tree

4 files changed

+48
-22
lines changed

4 files changed

+48
-22
lines changed

.github/workflows/unit-test.yml

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ jobs:
5555
run: npm run codecov
5656
if: ${{ matrix.node_version == '14' }}
5757
node-windows-tests:
58-
strategy:
59-
fail-fast: false
6058
runs-on: windows-latest
6159
env:
6260
NPM_CONFIG_UNSAFE_PERM: true
@@ -96,15 +94,15 @@ jobs:
9694
run: npm run test
9795
browser-tests:
9896
runs-on: ubuntu-latest
99-
container:
100-
image: circleci/node:16-browsers
10197
env:
10298
NPM_CONFIG_UNSAFE_PERM: true
10399
steps:
104-
- name: Permission Setup
105-
run: sudo chmod -R 777 /github /__w
106100
- name: Checkout
107-
uses: actions/[email protected]
101+
uses: actions/checkout@v3
102+
103+
- uses: actions/setup-node@v3
104+
with:
105+
node-version: 16
108106

109107
- name: restore lerna
110108
id: cache
@@ -126,8 +124,6 @@ jobs:
126124
127125
- name: Build 🔧
128126
run: |
129-
npm run compile
130-
# run additional compilation variants
131127
npx lerna run compile
132128
133129
- name: Unit tests
@@ -136,15 +132,14 @@ jobs:
136132
run: npm run codecov:browser
137133
webworker-tests:
138134
runs-on: ubuntu-latest
139-
container:
140-
image: circleci/node:16-browsers
141135
env:
142136
NPM_CONFIG_UNSAFE_PERM: true
143137
steps:
144-
- name: Permission Setup
145-
run: sudo chmod -R 777 /github /__w
146138
- name: Checkout
147139
uses: actions/[email protected]
140+
- uses: actions/setup-node@v3
141+
with:
142+
node-version: 16
148143

149144
- name: restore lerna
150145
id: cache
@@ -166,11 +161,37 @@ jobs:
166161
167162
- name: Build 🔧
168163
run: |
169-
npm run compile
170-
# run additional compilation variants
171164
npx lerna run compile
172165
173166
- name: Unit tests
174167
run: npm run test:webworker
175168
- name: Report Coverage
176169
run: npm run codecov:webworker
170+
api-eol-node-test:
171+
strategy:
172+
fail-fast: false
173+
matrix:
174+
node_version:
175+
- "8"
176+
- "10"
177+
- "12"
178+
runs-on: ubuntu-latest
179+
steps:
180+
- name: Checkout
181+
uses: actions/checkout@v3
182+
183+
- uses: actions/setup-node@v3
184+
with:
185+
node-version: ${{ matrix.node_version }}
186+
187+
- name: Build
188+
working-directory: ./api
189+
run: |
190+
npm install --ignore-scripts
191+
npm install @types/mocha@^7 mocha@^7 ts-loader@^8 ts-mocha@^8
192+
node ../scripts/version-update.js
193+
tsc --build tsconfig.json tsconfig.esm.json
194+
195+
- name: Test
196+
working-directory: ./api
197+
run: npm test

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,15 @@ All notable changes to this project will be documented in this file.
1212

1313
### :bug: (Bug Fix)
1414

15+
* fix(resources): fix EnvDetector throwing errors when attribute values contain spaces
16+
[#3295](https://github.com/open-telemetry/opentelemetry-js/issues/3295)
17+
1518
### :books: (Refine Doc)
1619

1720
### :house: (Internal)
1821

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

2126
### :bug: (Bug Fix)

packages/opentelemetry-resources/src/detectors/EnvDetector.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class EnvDetector implements Detector {
110110
let [key, value] = keyValuePair;
111111
// Leading and trailing whitespaces are trimmed.
112112
key = key.trim();
113-
value = value.trim().split('^"|"$').join('');
113+
value = value.trim().split(/^"|"$/).join('');
114114
if (!this._isValidAndNotEmpty(key)) {
115115
throw new Error(`Attribute key ${this._ERROR_MESSAGE_INVALID_CHARS}`);
116116
}
@@ -136,7 +136,7 @@ class EnvDetector implements Detector {
136136
private _isPrintableString(str: string): boolean {
137137
for (let i = 0; i < str.length; i++) {
138138
const ch: string = str.charAt(i);
139-
if (ch <= ' ' || ch >= '~') {
139+
if (ch < ' ' || ch >= '~') {
140140
return false;
141141
}
142142
}

packages/opentelemetry-resources/test/detectors/node/EnvDetector.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
1817
import { envDetector, Resource } from '../../../src';
1918
import {
2019
assertK8sResource,
@@ -26,7 +25,7 @@ describeNode('envDetector() on Node.js', () => {
2625
describe('with valid env', () => {
2726
before(() => {
2827
process.env.OTEL_RESOURCE_ATTRIBUTES =
29-
'k8s.pod.name="pod-xyz-123",k8s.cluster.name="c1",k8s.namespace.name="default"';
28+
'k8s.pod.name="pod-xyz-123",k8s.cluster.name="c1",k8s.namespace.name="default",k8s.deployment.name="deployment name"';
3029
});
3130

3231
after(() => {
@@ -36,9 +35,10 @@ describeNode('envDetector() on Node.js', () => {
3635
it('should return resource information from environment variable', async () => {
3736
const resource: Resource = await envDetector.detect();
3837
assertK8sResource(resource, {
39-
[SemanticResourceAttributes.K8S_POD_NAME]: 'pod-xyz-123',
40-
[SemanticResourceAttributes.K8S_CLUSTER_NAME]: 'c1',
41-
[SemanticResourceAttributes.K8S_NAMESPACE_NAME]: 'default',
38+
podName: 'pod-xyz-123',
39+
clusterName: 'c1',
40+
namespaceName: 'default',
41+
deploymentName: 'deployment name'
4242
});
4343
});
4444
});

0 commit comments

Comments
 (0)