@opentelemetry/core
Advanced tools
Comparing version 1.1.1 to 1.2.0
import { SpanAttributeValue, SpanAttributes } from '@opentelemetry/api'; | ||
export declare function sanitizeAttributes(attributes: unknown): SpanAttributes; | ||
export declare function isAttributeKey(key: unknown): key is string; | ||
export declare function isAttributeValue(val: unknown): val is SpanAttributeValue; | ||
//# sourceMappingURL=attributes.d.ts.map |
@@ -0,1 +1,16 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
var __values = (this && this.__values) || function(o) { | ||
@@ -28,20 +43,26 @@ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
}; | ||
import { diag } from '@opentelemetry/api'; | ||
export function sanitizeAttributes(attributes) { | ||
var e_1, _a; | ||
var out = {}; | ||
if (attributes == null || typeof attributes !== 'object') { | ||
if (typeof attributes !== 'object' || attributes == null) { | ||
return out; | ||
} | ||
try { | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
for (var _b = __values(Object.entries(attributes)), _c = _b.next(); !_c.done; _c = _b.next()) { | ||
var _d = __read(_c.value, 2), k = _d[0], v = _d[1]; | ||
if (isAttributeValue(v)) { | ||
if (Array.isArray(v)) { | ||
out[k] = v.slice(); | ||
} | ||
else { | ||
out[k] = v; | ||
} | ||
var _d = __read(_c.value, 2), key = _d[0], val = _d[1]; | ||
if (!isAttributeKey(key)) { | ||
diag.warn("Invalid attribute key: " + key); | ||
continue; | ||
} | ||
if (!isAttributeValue(val)) { | ||
diag.warn("Invalid attribute value set for key: " + key); | ||
continue; | ||
} | ||
if (Array.isArray(val)) { | ||
out[key] = val.slice(); | ||
} | ||
else { | ||
out[key] = val; | ||
} | ||
} | ||
@@ -58,2 +79,5 @@ } | ||
} | ||
export function isAttributeKey(key) { | ||
return typeof key === 'string' && key.length > 0; | ||
} | ||
export function isAttributeValue(val) { | ||
@@ -103,5 +127,3 @@ if (val == null) { | ||
case 'number': | ||
return true; | ||
case 'boolean': | ||
return true; | ||
case 'string': | ||
@@ -108,0 +130,0 @@ return true; |
@@ -1,2 +0,2 @@ | ||
import { SpanAttributes, Context, Link, Sampler, SamplingResult, SpanKind } from '@opentelemetry/api'; | ||
import { Context, Link, Sampler, SamplingResult, SpanAttributes, SpanKind } from '@opentelemetry/api'; | ||
/** | ||
@@ -3,0 +3,0 @@ * A composite sampler that either respects the parent span's sampling decision |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.1.1"; | ||
export declare const VERSION = "1.2.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -17,3 +17,3 @@ /* | ||
// this is autogenerated file, see scripts/version-update.js | ||
export var VERSION = '1.1.1'; | ||
export var VERSION = '1.2.0'; | ||
//# sourceMappingURL=version.js.map |
import { SpanAttributeValue, SpanAttributes } from '@opentelemetry/api'; | ||
export declare function sanitizeAttributes(attributes: unknown): SpanAttributes; | ||
export declare function isAttributeKey(key: unknown): key is string; | ||
export declare function isAttributeValue(val: unknown): val is SpanAttributeValue; | ||
//# sourceMappingURL=attributes.d.ts.map |
@@ -0,19 +1,43 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { diag } from '@opentelemetry/api'; | ||
export function sanitizeAttributes(attributes) { | ||
const out = {}; | ||
if (attributes == null || typeof attributes !== 'object') { | ||
if (typeof attributes !== 'object' || attributes == null) { | ||
return out; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
for (const [k, v] of Object.entries(attributes)) { | ||
if (isAttributeValue(v)) { | ||
if (Array.isArray(v)) { | ||
out[k] = v.slice(); | ||
} | ||
else { | ||
out[k] = v; | ||
} | ||
for (const [key, val] of Object.entries(attributes)) { | ||
if (!isAttributeKey(key)) { | ||
diag.warn(`Invalid attribute key: ${key}`); | ||
continue; | ||
} | ||
if (!isAttributeValue(val)) { | ||
diag.warn(`Invalid attribute value set for key: ${key}`); | ||
continue; | ||
} | ||
if (Array.isArray(val)) { | ||
out[key] = val.slice(); | ||
} | ||
else { | ||
out[key] = val; | ||
} | ||
} | ||
return out; | ||
} | ||
export function isAttributeKey(key) { | ||
return typeof key === 'string' && key.length > 0; | ||
} | ||
export function isAttributeValue(val) { | ||
@@ -52,5 +76,3 @@ if (val == null) { | ||
case 'number': | ||
return true; | ||
case 'boolean': | ||
return true; | ||
case 'string': | ||
@@ -57,0 +79,0 @@ return true; |
@@ -1,2 +0,2 @@ | ||
import { SpanAttributes, Context, Link, Sampler, SamplingResult, SpanKind } from '@opentelemetry/api'; | ||
import { Context, Link, Sampler, SamplingResult, SpanAttributes, SpanKind } from '@opentelemetry/api'; | ||
/** | ||
@@ -3,0 +3,0 @@ * A composite sampler that either respects the parent span's sampling decision |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.1.1"; | ||
export declare const VERSION = "1.2.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -17,3 +17,3 @@ /* | ||
// this is autogenerated file, see scripts/version-update.js | ||
export const VERSION = '1.1.1'; | ||
export const VERSION = '1.2.0'; | ||
//# sourceMappingURL=version.js.map |
import { SpanAttributeValue, SpanAttributes } from '@opentelemetry/api'; | ||
export declare function sanitizeAttributes(attributes: unknown): SpanAttributes; | ||
export declare function isAttributeKey(key: unknown): key is string; | ||
export declare function isAttributeValue(val: unknown): val is SpanAttributeValue; | ||
//# sourceMappingURL=attributes.d.ts.map |
"use strict"; | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isAttributeValue = exports.sanitizeAttributes = void 0; | ||
exports.isAttributeValue = exports.isAttributeKey = exports.sanitizeAttributes = void 0; | ||
const api_1 = require("@opentelemetry/api"); | ||
function sanitizeAttributes(attributes) { | ||
const out = {}; | ||
if (attributes == null || typeof attributes !== 'object') { | ||
if (typeof attributes !== 'object' || attributes == null) { | ||
return out; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
for (const [k, v] of Object.entries(attributes)) { | ||
if (isAttributeValue(v)) { | ||
if (Array.isArray(v)) { | ||
out[k] = v.slice(); | ||
} | ||
else { | ||
out[k] = v; | ||
} | ||
for (const [key, val] of Object.entries(attributes)) { | ||
if (!isAttributeKey(key)) { | ||
api_1.diag.warn(`Invalid attribute key: ${key}`); | ||
continue; | ||
} | ||
if (!isAttributeValue(val)) { | ||
api_1.diag.warn(`Invalid attribute value set for key: ${key}`); | ||
continue; | ||
} | ||
if (Array.isArray(val)) { | ||
out[key] = val.slice(); | ||
} | ||
else { | ||
out[key] = val; | ||
} | ||
} | ||
@@ -23,2 +44,6 @@ return out; | ||
exports.sanitizeAttributes = sanitizeAttributes; | ||
function isAttributeKey(key) { | ||
return typeof key === 'string' && key.length > 0; | ||
} | ||
exports.isAttributeKey = isAttributeKey; | ||
function isAttributeValue(val) { | ||
@@ -58,5 +83,3 @@ if (val == null) { | ||
case 'number': | ||
return true; | ||
case 'boolean': | ||
return true; | ||
case 'string': | ||
@@ -63,0 +86,0 @@ return true; |
@@ -1,2 +0,2 @@ | ||
import { SpanAttributes, Context, Link, Sampler, SamplingResult, SpanKind } from '@opentelemetry/api'; | ||
import { Context, Link, Sampler, SamplingResult, SpanAttributes, SpanKind } from '@opentelemetry/api'; | ||
/** | ||
@@ -3,0 +3,0 @@ * A composite sampler that either respects the parent span's sampling decision |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.1.1"; | ||
export declare const VERSION = "1.2.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '1.1.1'; | ||
exports.VERSION = '1.2.0'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/core", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "OpenTelemetry Core provides constants and utilities shared by all OpenTelemetry SDK packages.", | ||
@@ -32,3 +32,4 @@ "main": "build/src/index.js", | ||
"precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", | ||
"prewatch": "npm run precompile" | ||
"prewatch": "npm run precompile", | ||
"peer-api-check": "node ../../scripts/peer-api-check.js" | ||
}, | ||
@@ -47,3 +48,3 @@ "keywords": [ | ||
"engines": { | ||
"node": ">=8.5.0" | ||
"node": ">=8.12.0" | ||
}, | ||
@@ -68,3 +69,3 @@ "files": [ | ||
"devDependencies": { | ||
"@opentelemetry/api": "~1.1.0", | ||
"@opentelemetry/api": ">=1.0.0 <1.2.0", | ||
"@types/mocha": "8.2.3", | ||
@@ -96,5 +97,5 @@ "@types/node": "14.17.33", | ||
"dependencies": { | ||
"@opentelemetry/semantic-conventions": "1.1.1" | ||
"@opentelemetry/semantic-conventions": "1.2.0" | ||
}, | ||
"gitHead": "b0f8a2d36e6d1d3090c3d2380608d2102c826e0b" | ||
"gitHead": "a0a670a03fd35b0799bee8cc466f79e93b5b6dd2" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
772290
8739
+ Added@opentelemetry/semantic-conventions@1.2.0(transitive)
- Removed@opentelemetry/semantic-conventions@1.1.1(transitive)