From 42b7c9958d38635dadc34bc239af8b64996d2086 Mon Sep 17 00:00:00 2001 From: jjllee Date: Wed, 5 Mar 2025 13:09:41 -0800 Subject: [PATCH 1/6] sampler update --- .../package.json | 14 +- .../src/aws-xray-sampling-client.ts | 114 +++++++++ .../src/index.ts | 2 +- .../src/remote-sampler.ts | 232 ++++++++++++----- .../src/sampling-rule-applier.ts | 31 +++ .../src/sampling-rule.ts | 87 +++++++ .../src/semconv.ts | 168 +++++++++++++ .../src/statistics.ts | 43 ++++ .../src/types.ts | 92 +++++-- .../test/aws-xray-sampling-client.test.ts | 209 ++++++++++++++++ .../get-sampling-rules-response-sample-2.json | 48 ++++ ...ling-rules-response-sample-sample-all.json | 24 ++ .../get-sampling-rules-response-sample.json | 65 +++++ .../get-sampling-targets-response-sample.json | 20 ++ ...ampler_sampling-rules-response-sample.json | 45 ++++ ...pler_sampling-targets-response-sample.json | 20 ++ .../test/remote-sampler.test.ts | 236 ++++++++---------- .../test/sampling-rule-applier.test.ts | 17 ++ .../test/sampling-rule.test.ts | 89 +++++++ .../test/statistics.test.ts | 31 +++ 20 files changed, 1362 insertions(+), 225 deletions(-) create mode 100644 incubator/opentelemetry-sampler-aws-xray/src/aws-xray-sampling-client.ts create mode 100644 incubator/opentelemetry-sampler-aws-xray/src/sampling-rule-applier.ts create mode 100644 incubator/opentelemetry-sampler-aws-xray/src/sampling-rule.ts create mode 100644 incubator/opentelemetry-sampler-aws-xray/src/semconv.ts create mode 100644 incubator/opentelemetry-sampler-aws-xray/src/statistics.ts create mode 100644 incubator/opentelemetry-sampler-aws-xray/test/aws-xray-sampling-client.test.ts create mode 100644 incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-2.json create mode 100644 incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-sample-all.json create mode 100644 incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample.json create mode 100644 incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-targets-response-sample.json create mode 100644 incubator/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-rules-response-sample.json create mode 100644 incubator/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-targets-response-sample.json create mode 100644 incubator/opentelemetry-sampler-aws-xray/test/sampling-rule-applier.test.ts create mode 100644 incubator/opentelemetry-sampler-aws-xray/test/sampling-rule.test.ts create mode 100644 incubator/opentelemetry-sampler-aws-xray/test/statistics.test.ts diff --git a/incubator/opentelemetry-sampler-aws-xray/package.json b/incubator/opentelemetry-sampler-aws-xray/package.json index 109963171d..4341f20ba7 100644 --- a/incubator/opentelemetry-sampler-aws-xray/package.json +++ b/incubator/opentelemetry-sampler-aws-xray/package.json @@ -40,17 +40,15 @@ "version:update": "node ../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json" }, - "peerDependencies": { - "@opentelemetry/api": "^1.3.0" - }, "dependencies": { - "@opentelemetry/core": "^1.8.0", - "@opentelemetry/sdk-trace-base": "^1.8.0", - "axios": "^1.3.5" + "@opentelemetry/api": "^1.9.0", + "@opentelemetry/core": "^1.26.0", + "@opentelemetry/resources": "^1.10.0", + "@opentelemetry/sdk-trace-base": "^1.26.0", + "@opentelemetry/semantic-conventions": "^1.27.0" }, "devDependencies": { - "@opentelemetry/api": "^1.3.0", - "@opentelemetry/contrib-test-utils": "^0.35.0", + "@opentelemetry/sdk-trace-node": "^1.26.0", "@types/mocha": "10.0.10", "@types/node": "18.18.14", "@types/sinon": "17.0.4", diff --git a/incubator/opentelemetry-sampler-aws-xray/src/aws-xray-sampling-client.ts b/incubator/opentelemetry-sampler-aws-xray/src/aws-xray-sampling-client.ts new file mode 100644 index 0000000000..1634641f44 --- /dev/null +++ b/incubator/opentelemetry-sampler-aws-xray/src/aws-xray-sampling-client.ts @@ -0,0 +1,114 @@ +/* + * 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 { DiagLogFunction, DiagLogger, context } from '@opentelemetry/api'; +import { suppressTracing } from '@opentelemetry/core'; +import * as http from 'http'; +import { + GetSamplingRulesResponse, + GetSamplingTargetsBody, + GetSamplingTargetsResponse, +} from './types'; + +export class AWSXRaySamplingClient { + private getSamplingRulesEndpoint: string; + private samplingTargetsEndpoint: string; + private samplerDiag: DiagLogger; + + constructor(endpoint: string, samplerDiag: DiagLogger) { + this.getSamplingRulesEndpoint = endpoint + '/GetSamplingRules'; + this.samplingTargetsEndpoint = endpoint + '/SamplingTargets'; + this.samplerDiag = samplerDiag; + } + + public fetchSamplingTargets( + requestBody: GetSamplingTargetsBody, + callback: (responseObject: GetSamplingTargetsResponse) => void + ) { + this.makeSamplingRequest( + this.samplingTargetsEndpoint, + callback, + this.samplerDiag.debug, + JSON.stringify(requestBody) + ); + } + + public fetchSamplingRules( + callback: (responseObject: GetSamplingRulesResponse) => void + ) { + this.makeSamplingRequest( + this.getSamplingRulesEndpoint, + callback, + this.samplerDiag.error + ); + } + + private makeSamplingRequest( + url: string, + callback: (responseObject: T) => void, + logger: DiagLogFunction, + requestBodyJsonString?: string + ): void { + const options: http.RequestOptions = { + method: 'POST', + headers: {}, + }; + + if (requestBodyJsonString) { + options.headers = { + 'Content-Type': 'application/json', + 'Content-Length': Buffer.byteLength(requestBodyJsonString), + }; + } + + // Ensure AWS X-Ray Sampler does not generate traces itself + context.with(suppressTracing(context.active()), () => { + const req: http.ClientRequest = http + .request(url, options, response => { + response.setEncoding('utf-8'); + let responseData = ''; + response.on('data', dataChunk => (responseData += dataChunk)); + response.on('end', () => { + if (response.statusCode === 200 && responseData.length > 0) { + let responseObject: T | undefined = undefined; + try { + responseObject = JSON.parse(responseData) as T; + } catch (e: unknown) { + logger(`Error occurred when parsing responseData from ${url}`); + } + + if (responseObject) { + callback(responseObject); + } + } else { + this.samplerDiag.debug( + `${url} Response Code is: ${response.statusCode}` + ); + this.samplerDiag.debug(`${url} responseData is: ${responseData}`); + } + }); + }) + .on('error', (error: unknown) => { + logger(`Error occurred when making an HTTP POST to ${url}: ${error}`); + }); + if (requestBodyJsonString) { + req.end(requestBodyJsonString); + } else { + req.end(); + } + }); + } +} diff --git a/incubator/opentelemetry-sampler-aws-xray/src/index.ts b/incubator/opentelemetry-sampler-aws-xray/src/index.ts index eb37ee9739..7051864c14 100644 --- a/incubator/opentelemetry-sampler-aws-xray/src/index.ts +++ b/incubator/opentelemetry-sampler-aws-xray/src/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ export * from './remote-sampler'; -export { AWSXRaySamplerConfig } from './types'; +export { AWSXRayRemoteSamplerConfig } from './types'; diff --git a/incubator/opentelemetry-sampler-aws-xray/src/remote-sampler.ts b/incubator/opentelemetry-sampler-aws-xray/src/remote-sampler.ts index efa169c52a..c73fffb382 100644 --- a/incubator/opentelemetry-sampler-aws-xray/src/remote-sampler.ts +++ b/incubator/opentelemetry-sampler-aws-xray/src/remote-sampler.ts @@ -15,100 +15,202 @@ */ import { + Attributes, + Context, + DiagLogger, + Link, + SpanKind, + diag, +} from '@opentelemetry/api'; +import { + ParentBasedSampler, Sampler, SamplingDecision, SamplingResult, } from '@opentelemetry/sdk-trace-base'; -import { diag, DiagLogger } from '@opentelemetry/api'; +import { AWSXRaySamplingClient } from './aws-xray-sampling-client'; import { - SamplingRule, - AWSXRaySamplerConfig, + AWSXRayRemoteSamplerConfig, + GetSamplingRulesResponse, SamplingRuleRecord, } from './types'; -import axios from 'axios'; +import { SamplingRuleApplier } from './sampling-rule-applier'; -// 5 minute interval on sampling rules fetch (default polling interval) -const DEFAULT_INTERVAL_MS = 5 * 60 * 1000; +// 5 minute default sampling rules polling interval +const DEFAULT_RULES_POLLING_INTERVAL_SECONDS: number = 5 * 60; // Default endpoint for awsproxy : https://aws-otel.github.io/docs/getting-started/remote-sampling#enable-awsproxy-extension const DEFAULT_AWS_PROXY_ENDPOINT = 'http://localhost:2000'; -const SAMPLING_RULES_PATH = '/GetSamplingRules'; -// IN PROGRESS - SKELETON CLASS +// Wrapper class to ensure that all XRay Sampler Functionality in _AWSXRayRemoteSampler +// uses ParentBased logic to respect the parent span's sampling decision export class AWSXRayRemoteSampler implements Sampler { - private _pollingInterval: number; - private _awsProxyEndpoint: string; - private _samplerDiag: DiagLogger; - - constructor(samplerConfig: AWSXRaySamplerConfig) { - this._pollingInterval = - samplerConfig.pollingIntervalMs ?? DEFAULT_INTERVAL_MS; - this._awsProxyEndpoint = samplerConfig.endpoint + private _root: ParentBasedSampler; + private internalXraySampler: _AWSXRayRemoteSampler; + constructor(samplerConfig: AWSXRayRemoteSamplerConfig) { + this.internalXraySampler = new _AWSXRayRemoteSampler(samplerConfig); + this._root = new ParentBasedSampler({ + root: this.internalXraySampler, + }); + } + public shouldSample( + context: Context, + traceId: string, + spanName: string, + spanKind: SpanKind, + attributes: Attributes, + links: Link[] + ): SamplingResult { + return this._root.shouldSample( + context, + traceId, + spanName, + spanKind, + attributes, + links + ); + } + + public toString(): string { + return `AWSXRayRemoteSampler{root=${this._root.toString()}`; + } + + public stopPollers() { + this.internalXraySampler.stopPollers(); + } +} + +// IN PROGRESS - SKELETON CLASS +// +// _AWSXRayRemoteSampler contains all core XRay Sampler Functionality, +// however it is NOT Parent-based (e.g. Sample logic runs for each span) +// Not intended for external use, use Parent-based `AWSXRayRemoteSampler` instead. +export class _AWSXRayRemoteSampler implements Sampler { + private rulePollingIntervalMillis: number; + private awsProxyEndpoint: string; + private samplerDiag: DiagLogger; + private rulePoller: NodeJS.Timeout | undefined; + private clientId: string; + private rulePollingJitterMillis: number; + private samplingClient: AWSXRaySamplingClient; + + constructor(samplerConfig: AWSXRayRemoteSamplerConfig) { + this.samplerDiag = diag; + + if ( + samplerConfig.pollingInterval == null || + samplerConfig.pollingInterval < 10 + ) { + this.samplerDiag.warn( + `'pollingInterval' is undefined or too small. Defaulting to ${DEFAULT_RULES_POLLING_INTERVAL_SECONDS} seconds` + ); + this.rulePollingIntervalMillis = + DEFAULT_RULES_POLLING_INTERVAL_SECONDS * 1000; + } else { + this.rulePollingIntervalMillis = samplerConfig.pollingInterval * 1000; + } + + this.rulePollingJitterMillis = Math.random() * 5 * 1000; + + this.awsProxyEndpoint = samplerConfig.endpoint ? samplerConfig.endpoint : DEFAULT_AWS_PROXY_ENDPOINT; + this.clientId = _AWSXRayRemoteSampler.generateClientId(); - if (this._pollingInterval <= 0) { - throw new TypeError('pollingInterval must be a positive integer'); - } + this.samplingClient = new AWSXRaySamplingClient( + this.awsProxyEndpoint, + this.samplerDiag + ); - this._samplerDiag = diag.createComponentLogger({ - namespace: '@opentelemetry/sampler-aws-xray', - }); + // Start the Sampling Rules poller + this.startSamplingRulesPoller(); - // execute first get Sampling rules update using polling interval - this.startRulePoller(); + // TODO: Start the Sampling Targets poller } - shouldSample(): SamplingResult { + public shouldSample( + context: Context, + traceId: string, + spanName: string, + spanKind: SpanKind, + attributes: Attributes, + links: Link[] + ): SamplingResult { // Implementation to be added return { decision: SamplingDecision.NOT_RECORD }; } - toString(): string { - return `AWSXRayRemoteSampler{endpoint=${this._awsProxyEndpoint}, pollingInterval=${this._pollingInterval}}`; + public toString(): string { + return `_AWSXRayRemoteSampler{awsProxyEndpoint=${ + this.awsProxyEndpoint + }, rulePollingIntervalMillis=${this.rulePollingIntervalMillis.toString()}}`; } - private getAndUpdateSamplingRules = async (): Promise => { - let samplingRules: SamplingRule[] = []; // reset rules array - - const requestConfig = { - headers: { - 'Content-Type': 'application/json', - }, - }; - - try { - const samplingRulesEndpoint = - this._awsProxyEndpoint + SAMPLING_RULES_PATH; - const response = await axios.post( - samplingRulesEndpoint, - {}, - requestConfig - ); - const responseJson = response.data; + public stopPollers() { + clearInterval(this.rulePoller); + } + + private startSamplingRulesPoller(): void { + // Execute first update + this.getAndUpdateSamplingRules(); + // Update sampling rules every 5 minutes (or user-defined polling interval) + this.rulePoller = setInterval( + () => this.getAndUpdateSamplingRules(), + this.rulePollingIntervalMillis + this.rulePollingJitterMillis + ); + this.rulePoller.unref(); + } - samplingRules = - responseJson?.SamplingRuleRecords.map( - (record: SamplingRuleRecord) => record.SamplingRule - ).filter(Boolean) ?? []; + private getAndUpdateSamplingRules(): void { + this.samplingClient.fetchSamplingRules(this.updateSamplingRules.bind(this)); + } + + private updateSamplingRules(responseObject: GetSamplingRulesResponse): void { + let samplingRules: SamplingRuleApplier[] = []; + + samplingRules = []; + if (responseObject.SamplingRuleRecords) { + responseObject.SamplingRuleRecords.forEach( + (record: SamplingRuleRecord) => { + if (record.SamplingRule) { + samplingRules.push( + new SamplingRuleApplier(record.SamplingRule, undefined) + ); + } + } + ); // TODO: pass samplingRules to rule cache, temporarily logging the samplingRules array - this._samplerDiag.debug('sampling rules: ', samplingRules); - } catch (error) { - // Log error - this._samplerDiag.warn('Error fetching sampling rules: ', error); + this.samplerDiag.debug('sampling rules: ', samplingRules); + } else { + this.samplerDiag.error( + 'SamplingRuleRecords from GetSamplingRules request is not defined' + ); } - }; + } - // fetch sampling rules every polling interval - private startRulePoller(): void { - // execute first update - // this.getAndUpdateSamplingRules() never rejects. Using void operator to suppress @typescript-eslint/no-floating-promises. - void this.getAndUpdateSamplingRules(); - // Update sampling rules every 5 minutes (or user-defined polling interval) - const rulePoller = setInterval( - () => this.getAndUpdateSamplingRules(), - this._pollingInterval - ); - rulePoller.unref(); + private static generateClientId(): string { + const hexChars: string[] = [ + '0', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + ]; + const clientIdArray: string[] = []; + for (let _ = 0; _ < 24; _ += 1) { + clientIdArray.push(hexChars[Math.floor(Math.random() * hexChars.length)]); + } + return clientIdArray.join(''); } } diff --git a/incubator/opentelemetry-sampler-aws-xray/src/sampling-rule-applier.ts b/incubator/opentelemetry-sampler-aws-xray/src/sampling-rule-applier.ts new file mode 100644 index 0000000000..e1d0fd0378 --- /dev/null +++ b/incubator/opentelemetry-sampler-aws-xray/src/sampling-rule-applier.ts @@ -0,0 +1,31 @@ +/* + * 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 { ISamplingRule, SamplingTargetDocument } from './types'; +import { SamplingRule } from './sampling-rule'; +import { Statistics } from './statistics'; + +export class SamplingRuleApplier { + public samplingRule: SamplingRule; + + constructor( + samplingRule: ISamplingRule, + statistics: Statistics = new Statistics(), + target?: SamplingTargetDocument + ) { + this.samplingRule = new SamplingRule(samplingRule); + } +} diff --git a/incubator/opentelemetry-sampler-aws-xray/src/sampling-rule.ts b/incubator/opentelemetry-sampler-aws-xray/src/sampling-rule.ts new file mode 100644 index 0000000000..d0c63c9202 --- /dev/null +++ b/incubator/opentelemetry-sampler-aws-xray/src/sampling-rule.ts @@ -0,0 +1,87 @@ +/* + * 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 { ISamplingRule } from './types'; + +export class SamplingRule implements ISamplingRule { + public RuleName: string; + public RuleARN: string | undefined; + public Priority: number; + public ReservoirSize: number; + public FixedRate: number; + public ServiceName: string; + public ServiceType: string; + public Host: string; + public HTTPMethod: string; + public URLPath: string; + public ResourceARN: string; + public Attributes: { [key: string]: string } | undefined; + public Version: number; + + constructor(samplingRule: ISamplingRule) { + // The AWS API docs mark `RuleName` as an optional field but in practice it seems to always be + // present, and sampling targets could not be computed without it. For now provide an arbitrary fallback just in + // case the AWS API docs are correct. + this.RuleName = samplingRule.RuleName ? samplingRule.RuleName : 'Default'; + this.RuleARN = samplingRule.RuleARN; + this.Priority = samplingRule.Priority; + this.ReservoirSize = samplingRule.ReservoirSize; + this.FixedRate = samplingRule.FixedRate; + this.ServiceName = samplingRule.ServiceName; + this.ServiceType = samplingRule.ServiceType; + this.Host = samplingRule.Host; + this.HTTPMethod = samplingRule.HTTPMethod; + this.URLPath = samplingRule.URLPath; + this.ResourceARN = samplingRule.ResourceARN; + this.Version = samplingRule.Version; + this.Attributes = samplingRule.Attributes; + } + + public equals(other: ISamplingRule): boolean { + let attributesEquals: boolean; + + if (this.Attributes === undefined || other.Attributes === undefined) { + attributesEquals = this.Attributes === other.Attributes; + } else { + attributesEquals = this.Attributes.length === other.Attributes.length; + for (const attributeKey in other.Attributes) { + if ( + !(attributeKey in this.Attributes) || + this.Attributes[attributeKey] !== other.Attributes[attributeKey] + ) { + attributesEquals = false; + break; + } + } + } + + return ( + this.FixedRate === other.FixedRate && + this.HTTPMethod === other.HTTPMethod && + this.Host === other.Host && + this.Priority === other.Priority && + this.ReservoirSize === other.ReservoirSize && + this.ResourceARN === other.ResourceARN && + this.RuleARN === other.RuleARN && + this.RuleName === other.RuleName && + this.ServiceName === other.ServiceName && + this.ServiceType === other.ServiceType && + this.URLPath === other.URLPath && + this.Version === other.Version && + attributesEquals + ); + } +} diff --git a/incubator/opentelemetry-sampler-aws-xray/src/semconv.ts b/incubator/opentelemetry-sampler-aws-xray/src/semconv.ts new file mode 100644 index 0000000000..3e2fe891c9 --- /dev/null +++ b/incubator/opentelemetry-sampler-aws-xray/src/semconv.ts @@ -0,0 +1,168 @@ +/* + * 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. + */ + +/* + * This file contains a copy of unstable semantic convention definitions + * used by this package. + * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv + */ + +/** + * The cloud platform in use. + * + * @note The prefix of the service **SHOULD** match the one specified in `cloud.provider`. + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_CLOUD_PLATFORM = 'cloud.platform' as const; + +/** + * The full invoked ARN as provided on the `Context` passed to the function (`Lambda-Runtime-Invoked-Function-Arn` header on the `/runtime/invocation/next` applicable). + * + * @example arn:aws:lambda:us-east-1:123456:function:myfunction:myalias + * + * @note This may be different from `cloud.resource_id` if an alias is involved. + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_AWS_LAMBDA_INVOKED_ARN = 'aws.lambda.invoked_arn' as const; + +/** + * The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). + * + * @example arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_AWS_ECS_CLUSTER_ARN = 'aws.ecs.cluster.arn' as const; + +/** + * The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + * + * @example arn:aws:ecs:us-west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9 + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_AWS_ECS_CONTAINER_ARN = 'aws.ecs.container.arn' as const; + +/** + * The ARN of an EKS cluster. + * + * @example arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_AWS_EKS_CLUSTER_ARN = 'aws.eks.cluster.arn' as const; + +/** + * Deprecated, use one of `server.address`, `client.address` or `http.request.header.host` instead, depending on the usage. + * + * @example www.example.org + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + * + * @deprecated Replaced by one of `server.address`, `client.address` or `http.request.header.host`, depending on the usage. + */ +export const ATTR_HTTP_HOST = 'http.host' as const; + +/** + * Deprecated, use `http.request.method` instead. + * + * @example GET + * @example POST + * @example HEAD + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + * + * @deprecated Replaced by `http.request.method`. + */ +export const ATTR_HTTP_METHOD = 'http.method' as const; + +/** + * Deprecated, use `url.path` and `url.query` instead. + * + * @example /search?q=OpenTelemetry#SemConv + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + * + * @deprecated Split to `url.path` and `url.query. + */ +export const ATTR_HTTP_TARGET = 'http.target' as const; + +/** + * Deprecated, use `url.full` instead. + * + * @example https://www.foo.bar/search?q=OpenTelemetry#SemConv + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + * + * @deprecated Replaced by `url.full`. + */ +export const ATTR_HTTP_URL = 'http.url' as const; + +/** + * Enum value "aws_ec2" for attribute {@link ATTR_CLOUD_PLATFORM}. + */ +export const CLOUD_PLATFORM_VALUE_AWS_EC2 = 'aws_ec2' as const; + +/** + * Enum value "aws_ecs" for attribute {@link ATTR_CLOUD_PLATFORM}. + */ +export const CLOUD_PLATFORM_VALUE_AWS_ECS = 'aws_ecs' as const; + +/** + * Enum value "aws_eks" for attribute {@link ATTR_CLOUD_PLATFORM}. + */ +export const CLOUD_PLATFORM_VALUE_AWS_EKS = 'aws_eks' as const; + +/** + * Enum value "aws_elastic_beanstalk" for attribute {@link ATTR_CLOUD_PLATFORM}. + */ +export const CLOUD_PLATFORM_VALUE_AWS_ELASTIC_BEANSTALK = + 'aws_elastic_beanstalk' as const; + +/** + * Enum value "aws_lambda" for attribute {@link ATTR_CLOUD_PLATFORM}. + */ +export const CLOUD_PLATFORM_VALUE_AWS_LAMBDA = 'aws_lambda' as const; + +/** + * Cloud provider-specific native identifier of the monitored cloud resource (e.g. an [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) on AWS, a [fully qualified resource ID](https://learn.microsoft.com/rest/api/resources/resources/get-by-id) on Azure, a [full resource name](https://cloud.google.com/apis/design/resource_names#full_resource_name) on GCP) + * + * @example arn:aws:lambda:REGION:ACCOUNT_ID:function:my-function + * @example //run.googleapis.com/projects/PROJECT_ID/locations/LOCATION_ID/services/SERVICE_ID + * @example /subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/ + * + * @note On some cloud providers, it may not be possible to determine the full ID at startup, + * so it may be necessary to set `cloud.resource_id` as a span attribute instead. + * + * The exact value to use for `cloud.resource_id` depends on the cloud provider. + * The following well-known definitions **MUST** be used if you set this attribute and they apply: + * + * - **AWS Lambda:** The function [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). + * Take care not to use the "invoked ARN" directly but replace any + * [alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) + * with the resolved function version, as the same runtime instance may be invocable with + * multiple different aliases. + * - **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full-resource-names) + * - **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/rest/api/resources/resources/get-by-id) of the invoked function, + * *not* the function app, having the form + * `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/`. + * This means that a span attribute **MUST** be used, as an Azure function app can host multiple functions that would usually share + * a TracerProvider. + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_CLOUD_RESOURCE_ID = 'cloud.resource_id' as const; diff --git a/incubator/opentelemetry-sampler-aws-xray/src/statistics.ts b/incubator/opentelemetry-sampler-aws-xray/src/statistics.ts new file mode 100644 index 0000000000..fdee6cbbe9 --- /dev/null +++ b/incubator/opentelemetry-sampler-aws-xray/src/statistics.ts @@ -0,0 +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 { ISamplingStatistics } from './types'; + +export class Statistics implements ISamplingStatistics { + public RequestCount: number; + public SampleCount: number; + public BorrowCount: number; + + constructor(requestCount = 0, sampleCount = 0, borrowCount = 0) { + this.RequestCount = requestCount; + this.SampleCount = sampleCount; + this.BorrowCount = borrowCount; + } + + public getStatistics(): ISamplingStatistics { + return { + RequestCount: this.RequestCount, + SampleCount: this.SampleCount, + BorrowCount: this.BorrowCount, + }; + } + + public resetStatistics(): void { + this.RequestCount = 0; + this.SampleCount = 0; + this.BorrowCount = 0; + } +} diff --git a/incubator/opentelemetry-sampler-aws-xray/src/types.ts b/incubator/opentelemetry-sampler-aws-xray/src/types.ts index de595ad77b..5174588812 100644 --- a/incubator/opentelemetry-sampler-aws-xray/src/types.ts +++ b/incubator/opentelemetry-sampler-aws-xray/src/types.ts @@ -14,10 +14,26 @@ * limitations under the License. */ -// X-Ray Sampling rule reference: https://docs.aws.amazon.com/xray/latest/api/API_GetSamplingRules.html -export interface SamplingRule { - // a unique name for the rule - RuleName: string; +import { Resource } from '@opentelemetry/resources'; + +export interface AWSXRayRemoteSamplerConfig { + // resource to control sampling at the service level + resource: Resource; + + // endpoint of awsproxy - for more information see https://aws-otel.github.io/docs/getting-started/remote-sampling + endpoint?: string; + + // interval for polling sampling rules + pollingInterval?: number; +} + +// https://docs.aws.amazon.com/xray/latest/api/API_SamplingRule.html +export interface ISamplingRule { + // A unique name for the rule + RuleName?: string; + + // The ARN of the sampling rule + RuleARN?: string; // (integer between 1 and 9999) - the priority of the sampling rule. Services evaluate rules in ascending order of // priority, and make a sampling decision with the first rule that matches. @@ -47,23 +63,38 @@ export interface SamplingRule { // The ARN of the AWS resource running the service. ResourceARN: string; - // (Optional) segment attributes that are known when the sampling decision is made. + // Segment attributes to be matched when the sampling decision is being made. Attributes?: { [key: string]: string }; + Version: number; } +// https://docs.aws.amazon.com/xray/latest/api/API_SamplingRuleRecord.html export interface SamplingRuleRecord { - CreatedAt: number; - ModifiedAt: number; - SamplingRule?: SamplingRule; + CreatedAt?: number; + ModifiedAt?: number; + SamplingRule?: ISamplingRule; } +// https://docs.aws.amazon.com/xray/latest/api/API_GetSamplingRules.html#API_GetSamplingRules_ResponseSyntax export interface GetSamplingRulesResponse { NextToken?: string; SamplingRuleRecords?: SamplingRuleRecord[]; } -// samplingStatisticsDocument is used to store current state of sampling data. +export interface ISamplingStatistics { + // RequestCount is the number of requests matched against a specific rule. + RequestCount: number; + + // SampleCount is the number of requests sampled using a specific rule. + SampleCount: number; + + // BorrowCount is the number of requests borrowed using a specific rule. + BorrowCount: number; +} + +// https://docs.aws.amazon.com/xray/latest/api/API_GetSamplingTargets.html#API_GetSamplingTargets_RequestSyntax +// SamplingStatisticsDocument is used to store current state of sampling statistics. export interface SamplingStatisticsDocument { // A unique identifier for the service in hexadecimal. ClientID: string; @@ -71,7 +102,7 @@ export interface SamplingStatisticsDocument { RuleName: string; // The number of requests that matched the rule. RequestCount: number; - // The number of requests borrowed. + // The number of requests borrowed using the rule. BorrowCount: number; // The number of requests sampled using the rule. SampledCount: number; @@ -79,12 +110,39 @@ export interface SamplingStatisticsDocument { Timestamp: number; } -export interface AWSXRaySamplerConfig { - // endpoint of awsproxy - for more information see https://aws-otel.github.io/docs/getting-started/remote-sampling - // defaults to localhost:2000 if not specified - endpoint?: string; +// https://docs.aws.amazon.com/xray/latest/api/API_GetSamplingTargets.html#API_GetSamplingTargets_RequestBody +export interface SamplingTargetDocument { + // The percentage of matching requests to instrument, after the reservoir is exhausted. + FixedRate: number; + // The number of seconds to wait before fetching sampling targets again + Interval?: number | null; + // The number of requests per second that X-Ray allocated this service. + ReservoirQuota?: number | null; + // Time when the reservoir quota will expire + ReservoirQuotaTTL?: number | null; + // The name of the sampling rule + RuleName: string; +} + +// https://docs.aws.amazon.com/xray/latest/api/API_GetSamplingTargets.html#API_GetSamplingTargets_RequestBody +export interface UnprocessedStatistic { + ErrorCode: string; + Message: string; + RuleName: string; +} + +// https://docs.aws.amazon.com/xray/latest/api/API_GetSamplingTargets.html#API_GetSamplingTargets_RequestBody +export interface GetSamplingTargetsBody { + SamplingStatisticsDocuments: SamplingStatisticsDocument[]; +} + +// https://docs.aws.amazon.com/xray/latest/api/API_GetSamplingTargets.html#API_GetSamplingTargets_ResponseSyntax +export interface GetSamplingTargetsResponse { + LastRuleModification: number; + SamplingTargetDocuments: SamplingTargetDocument[]; + UnprocessedStatistics: UnprocessedStatistic[]; +} - // interval of polling sampling rules (in ms) - // defaults to 5 minutes if not specified - pollingIntervalMs?: number; +export interface TargetMap { + [targetName: string]: SamplingTargetDocument; } diff --git a/incubator/opentelemetry-sampler-aws-xray/test/aws-xray-sampling-client.test.ts b/incubator/opentelemetry-sampler-aws-xray/test/aws-xray-sampling-client.test.ts new file mode 100644 index 0000000000..e7a20ee692 --- /dev/null +++ b/incubator/opentelemetry-sampler-aws-xray/test/aws-xray-sampling-client.test.ts @@ -0,0 +1,209 @@ +/* + * 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 { expect } from 'expect'; +import * as nock from 'nock'; +import { DiagConsoleLogger } from '@opentelemetry/api'; +import { AWSXRaySamplingClient } from '../src/aws-xray-sampling-client'; +import { + GetSamplingRulesResponse, + GetSamplingTargetsBody, + GetSamplingTargetsResponse, +} from '../src/types'; + +const DATA_DIR = __dirname + '/data'; +const TEST_URL = 'http://127.0.0.1:2000'; + +describe('AWSXRaySamplingClient', () => { + it('testGetNoSamplingRules', done => { + nock(TEST_URL) + .post('/GetSamplingRules') + .reply(200, { SamplingRuleRecords: [] }); + const client = new AWSXRaySamplingClient(TEST_URL, new DiagConsoleLogger()); + + client.fetchSamplingRules((response: GetSamplingRulesResponse) => { + expect(response.SamplingRuleRecords?.length).toEqual(0); + done(); + }); + }); + + it('testGetInvalidResponse', done => { + nock(TEST_URL).post('/GetSamplingRules').reply(200, {}); + const client = new AWSXRaySamplingClient(TEST_URL, new DiagConsoleLogger()); + + client.fetchSamplingRules((response: GetSamplingRulesResponse) => { + expect(response.SamplingRuleRecords?.length).toEqual(undefined); + done(); + }); + }); + + it('testGetSamplingRuleMissingInRecords', done => { + nock(TEST_URL) + .post('/GetSamplingRules') + .reply(200, { SamplingRuleRecords: [{}] }); + const client = new AWSXRaySamplingClient(TEST_URL, new DiagConsoleLogger()); + client.fetchSamplingRules((response: GetSamplingRulesResponse) => { + expect(response.SamplingRuleRecords?.length).toEqual(1); + done(); + }); + }); + + it('testDefaultValuesUsedWhenMissingPropertiesInSamplingRule', done => { + nock(TEST_URL) + .post('/GetSamplingRules') + .reply(200, { SamplingRuleRecords: [{ SamplingRule: {} }] }); + const client = new AWSXRaySamplingClient(TEST_URL, new DiagConsoleLogger()); + client.fetchSamplingRules((response: GetSamplingRulesResponse) => { + expect(response.SamplingRuleRecords?.length).toEqual(1); + expect( + response.SamplingRuleRecords?.[0].SamplingRule + ).not.toBeUndefined(); + expect( + response.SamplingRuleRecords?.[0].SamplingRule?.Attributes + ).toEqual(undefined); + expect(response.SamplingRuleRecords?.[0].SamplingRule?.FixedRate).toEqual( + undefined + ); + expect( + response.SamplingRuleRecords?.[0].SamplingRule?.HTTPMethod + ).toEqual(undefined); + expect(response.SamplingRuleRecords?.[0].SamplingRule?.Host).toEqual( + undefined + ); + expect(response.SamplingRuleRecords?.[0].SamplingRule?.Priority).toEqual( + undefined + ); + expect( + response.SamplingRuleRecords?.[0].SamplingRule?.ReservoirSize + ).toEqual(undefined); + expect( + response.SamplingRuleRecords?.[0].SamplingRule?.ResourceARN + ).toEqual(undefined); + expect(response.SamplingRuleRecords?.[0].SamplingRule?.RuleARN).toEqual( + undefined + ); + expect(response.SamplingRuleRecords?.[0].SamplingRule?.RuleName).toEqual( + undefined + ); + expect( + response.SamplingRuleRecords?.[0].SamplingRule?.ServiceName + ).toEqual(undefined); + expect( + response.SamplingRuleRecords?.[0].SamplingRule?.ServiceType + ).toEqual(undefined); + expect(response.SamplingRuleRecords?.[0].SamplingRule?.URLPath).toEqual( + undefined + ); + expect(response.SamplingRuleRecords?.[0].SamplingRule?.Version).toEqual( + undefined + ); + done(); + }); + }); + + it('testGetCorrectNumberOfSamplingRules', done => { + const data = require(DATA_DIR + '/get-sampling-rules-response-sample.json'); + const records = data['SamplingRuleRecords']; + nock(TEST_URL).post('/GetSamplingRules').reply(200, data); + + const client = new AWSXRaySamplingClient(TEST_URL, new DiagConsoleLogger()); + + client.fetchSamplingRules((response: GetSamplingRulesResponse) => { + expect(response.SamplingRuleRecords?.length).toEqual(records.length); + for (let i = 0; i < records.length; i++) { + expect( + response.SamplingRuleRecords?.[i].SamplingRule?.Attributes + ).toEqual(records[i].SamplingRule.Attributes); + expect( + response.SamplingRuleRecords?.[i].SamplingRule?.FixedRate + ).toEqual(records[i].SamplingRule.FixedRate); + expect( + response.SamplingRuleRecords?.[i].SamplingRule?.HTTPMethod + ).toEqual(records[i].SamplingRule.HTTPMethod); + expect(response.SamplingRuleRecords?.[i].SamplingRule?.Host).toEqual( + records[i].SamplingRule.Host + ); + expect( + response.SamplingRuleRecords?.[i].SamplingRule?.Priority + ).toEqual(records[i].SamplingRule.Priority); + expect( + response.SamplingRuleRecords?.[i].SamplingRule?.ReservoirSize + ).toEqual(records[i].SamplingRule.ReservoirSize); + expect( + response.SamplingRuleRecords?.[i].SamplingRule?.ResourceARN + ).toEqual(records[i].SamplingRule.ResourceARN); + expect(response.SamplingRuleRecords?.[i].SamplingRule?.RuleARN).toEqual( + records[i].SamplingRule.RuleARN + ); + expect( + response.SamplingRuleRecords?.[i].SamplingRule?.RuleName + ).toEqual(records[i].SamplingRule.RuleName); + expect( + response.SamplingRuleRecords?.[i].SamplingRule?.ServiceName + ).toEqual(records[i].SamplingRule.ServiceName); + expect( + response.SamplingRuleRecords?.[i].SamplingRule?.ServiceType + ).toEqual(records[i].SamplingRule.ServiceType); + expect(response.SamplingRuleRecords?.[i].SamplingRule?.URLPath).toEqual( + records[i].SamplingRule.URLPath + ); + expect(response.SamplingRuleRecords?.[i].SamplingRule?.Version).toEqual( + records[i].SamplingRule.Version + ); + } + done(); + }); + }); + + it('testGetSamplingTargets', done => { + const data = require(DATA_DIR + + '/get-sampling-targets-response-sample.json'); + nock(TEST_URL).post('/SamplingTargets').reply(200, data); + + const client = new AWSXRaySamplingClient(TEST_URL, new DiagConsoleLogger()); + + client.fetchSamplingTargets( + data, + (response: GetSamplingTargetsResponse) => { + expect(response.SamplingTargetDocuments.length).toEqual(2); + expect(response.UnprocessedStatistics.length).toEqual(0); + expect(response.LastRuleModification).toEqual(1707551387); + done(); + } + ); + }); + + it('testGetInvalidSamplingTargets', done => { + const data = { + LastRuleModification: null, + SamplingTargetDocuments: null, + UnprocessedStatistics: null, + }; + nock(TEST_URL).post('/SamplingTargets').reply(200, data); + + const client = new AWSXRaySamplingClient(TEST_URL, new DiagConsoleLogger()); + + client.fetchSamplingTargets( + data as unknown as GetSamplingTargetsBody, + (response: GetSamplingTargetsResponse) => { + expect(response.SamplingTargetDocuments).toBe(null); + expect(response.UnprocessedStatistics).toBe(null); + expect(response.LastRuleModification).toBe(null); + done(); + } + ); + }); +}); diff --git a/incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-2.json b/incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-2.json new file mode 100644 index 0000000000..6bf24ebac9 --- /dev/null +++ b/incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-2.json @@ -0,0 +1,48 @@ +{ + "NextToken": null, + "SamplingRuleRecords": [ + { + "CreatedAt": 1.676038494E9, + "ModifiedAt": 1.676038494E9, + "SamplingRule": { + "Attributes": { + "foo": "bar", + "abc": "1234" + }, + "FixedRate": 0.05, + "HTTPMethod": "*", + "Host": "*", + "Priority": 10000, + "ReservoirSize": 100, + "ResourceARN": "*", + "RuleARN": "arn:aws:xray:us-east-1:999999999999:sampling-rule/Default", + "RuleName": "Default", + "ServiceName": "*", + "ServiceType": "*", + "URLPath": "*", + "Version": 1 + } + }, + { + "CreatedAt": 1.67799933E9, + "ModifiedAt": 1.67799933E9, + "SamplingRule": { + "Attributes": { + "abc": "1234" + }, + "FixedRate": 0.11, + "HTTPMethod": "*", + "Host": "*", + "Priority": 20, + "ReservoirSize": 1, + "ResourceARN": "*", + "RuleARN": "arn:aws:xray:us-east-1:999999999999:sampling-rule/test", + "RuleName": "test", + "ServiceName": "*", + "ServiceType": "*", + "URLPath": "*", + "Version": 1 + } + } + ] +} \ No newline at end of file diff --git a/incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-sample-all.json b/incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-sample-all.json new file mode 100644 index 0000000000..7a4b9ea0da --- /dev/null +++ b/incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-sample-all.json @@ -0,0 +1,24 @@ +{ + "NextToken": null, + "SamplingRuleRecords": [ + { + "CreatedAt": 0.0, + "ModifiedAt": 1.611564245E9, + "SamplingRule": { + "Attributes": {}, + "FixedRate": 1.00, + "HTTPMethod": "*", + "Host": "*", + "Priority": 10000, + "ReservoirSize": 1, + "ResourceARN": "*", + "RuleARN": "arn:aws:xray:us-west-2:123456789000:sampling-rule/Default", + "RuleName": "Default", + "ServiceName": "*", + "ServiceType": "*", + "URLPath": "*", + "Version": 1 + } + } + ] +} \ No newline at end of file diff --git a/incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample.json b/incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample.json new file mode 100644 index 0000000000..a0d3c5ba21 --- /dev/null +++ b/incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample.json @@ -0,0 +1,65 @@ +{ + "NextToken": null, + "SamplingRuleRecords": [ + { + "CreatedAt": 1.67799933E9, + "ModifiedAt": 1.67799933E9, + "SamplingRule": { + "Attributes": { + "foo": "bar", + "doo": "baz" + }, + "FixedRate": 0.05, + "HTTPMethod": "*", + "Host": "*", + "Priority": 1000, + "ReservoirSize": 10, + "ResourceARN": "*", + "RuleARN": "arn:aws:xray:us-west-2:123456789000:sampling-rule/Rule1", + "RuleName": "Rule1", + "ServiceName": "*", + "ServiceType": "AWS::Foo::Bar", + "URLPath": "*", + "Version": 1 + } + }, + { + "CreatedAt": 0.0, + "ModifiedAt": 1.611564245E9, + "SamplingRule": { + "Attributes": {}, + "FixedRate": 0.05, + "HTTPMethod": "*", + "Host": "*", + "Priority": 10000, + "ReservoirSize": 1, + "ResourceARN": "*", + "RuleARN": "arn:aws:xray:us-west-2:123456789000:sampling-rule/Default", + "RuleName": "Default", + "ServiceName": "*", + "ServiceType": "*", + "URLPath": "*", + "Version": 1 + } + }, + { + "CreatedAt": 1.676038494E9, + "ModifiedAt": 1.676038494E9, + "SamplingRule": { + "Attributes": {}, + "FixedRate": 0.2, + "HTTPMethod": "GET", + "Host": "*", + "Priority": 1, + "ReservoirSize": 10, + "ResourceARN": "*", + "RuleARN": "arn:aws:xray:us-west-2:123456789000:sampling-rule/Rule2", + "RuleName": "Rule2", + "ServiceName": "FooBar", + "ServiceType": "*", + "URLPath": "/foo/bar", + "Version": 1 + } + } + ] +} \ No newline at end of file diff --git a/incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-targets-response-sample.json b/incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-targets-response-sample.json new file mode 100644 index 0000000000..498fe1505b --- /dev/null +++ b/incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-targets-response-sample.json @@ -0,0 +1,20 @@ +{ + "LastRuleModification": 1707551387.0, + "SamplingTargetDocuments": [ + { + "FixedRate": 0.10, + "Interval": 10, + "ReservoirQuota": 30, + "ReservoirQuotaTTL": 1707764006.0, + "RuleName": "test" + }, + { + "FixedRate": 0.05, + "Interval": 10, + "ReservoirQuota": 0, + "ReservoirQuotaTTL": 1707764006.0, + "RuleName": "Default" + } + ], + "UnprocessedStatistics": [] +} \ No newline at end of file diff --git a/incubator/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-rules-response-sample.json b/incubator/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-rules-response-sample.json new file mode 100644 index 0000000000..a5c0d2cb5b --- /dev/null +++ b/incubator/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-rules-response-sample.json @@ -0,0 +1,45 @@ +{ + "NextToken": null, + "SamplingRuleRecords": [ + { + "CreatedAt": 1.676038494E9, + "ModifiedAt": 1.676038494E9, + "SamplingRule": { + "Attributes": {}, + "FixedRate": 1.0, + "HTTPMethod": "*", + "Host": "*", + "Priority": 10000, + "ReservoirSize": 0, + "ResourceARN": "*", + "RuleARN": "arn:aws:xray:us-east-1:999999999999:sampling-rule/Default", + "RuleName": "Default", + "ServiceName": "*", + "ServiceType": "*", + "URLPath": "*", + "Version": 1 + } + }, + { + "CreatedAt": 1.67799933E9, + "ModifiedAt": 1.67799933E9, + "SamplingRule": { + "Attributes": { + "abc": "1234" + }, + "FixedRate": 0, + "HTTPMethod": "*", + "Host": "*", + "Priority": 20, + "ReservoirSize": 0, + "ResourceARN": "*", + "RuleARN": "arn:aws:xray:us-east-1:999999999999:sampling-rule/test", + "RuleName": "test", + "ServiceName": "*", + "ServiceType": "*", + "URLPath": "*", + "Version": 1 + } + } + ] +} \ No newline at end of file diff --git a/incubator/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-targets-response-sample.json b/incubator/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-targets-response-sample.json new file mode 100644 index 0000000000..bc9b4718fb --- /dev/null +++ b/incubator/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-targets-response-sample.json @@ -0,0 +1,20 @@ +{ + "LastRuleModification": 1707551387.0, + "SamplingTargetDocuments": [ + { + "FixedRate": 0.0, + "Interval": 100000, + "ReservoirQuota": 1000, + "ReservoirQuotaTTL": 9999999999.0, + "RuleName": "test" + }, + { + "FixedRate": 0.0, + "Interval": 1000, + "ReservoirQuota": 100, + "ReservoirQuotaTTL": 9999999999.0, + "RuleName": "Default" + } + ], + "UnprocessedStatistics": [] +} \ No newline at end of file diff --git a/incubator/opentelemetry-sampler-aws-xray/test/remote-sampler.test.ts b/incubator/opentelemetry-sampler-aws-xray/test/remote-sampler.test.ts index b7d31c7fd4..0a99d71cae 100644 --- a/incubator/opentelemetry-sampler-aws-xray/test/remote-sampler.test.ts +++ b/incubator/opentelemetry-sampler-aws-xray/test/remote-sampler.test.ts @@ -14,160 +14,128 @@ * limitations under the License. */ +import { Resource } from '@opentelemetry/resources'; +import { + SEMRESATTRS_CLOUD_PLATFORM, + ATTR_SERVICE_NAME, +} from '@opentelemetry/semantic-conventions'; +import { expect } from 'expect'; +import { + _AWSXRayRemoteSampler, + AWSXRayRemoteSampler, +} from '../src/remote-sampler'; import * as sinon from 'sinon'; -import axios from 'axios'; -import * as nock from 'nock'; -import * as assert from 'assert'; - -import { AWSXRayRemoteSampler } from '../src'; - -describe('GetSamplingRules', () => { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const getSamplingRulesResponseStub: any = { - NextToken: null, - SamplingRuleRecords: [ - { - CreatedAt: 1.67799933e9, - ModifiedAt: 1.67799933e9, - SamplingRule: { - Attributes: { - foo: 'bar', - doo: 'baz', - }, - FixedRate: 0.05, - HTTPMethod: '*', - Host: '*', - Priority: 1000, - ReservoirSize: 10, - ResourceARN: '*', - RuleARN: 'arn:aws:xray:us-west-2:123456789000:sampling-rule/Rule1', - RuleName: 'Rule1', - ServiceName: '*', - ServiceType: 'AWS::Foo::Bar', - URLPath: '*', - Version: 1, - }, - }, - { - CreatedAt: 0.0, - ModifiedAt: 1.611564245e9, - SamplingRule: { - Attributes: {}, - FixedRate: 0.05, - HTTPMethod: '*', - Host: '*', - Priority: 10000, - ReservoirSize: 1, - ResourceARN: '*', - RuleARN: 'arn:aws:xray:us-west-2:123456789000:sampling-rule/Default', - RuleName: 'Default', - ServiceName: '*', - ServiceType: '*', - URLPath: '*', - Version: 1, - }, - }, - { - CreatedAt: 1.676038494e9, - ModifiedAt: 1.676038494e9, - SamplingRule: { - Attributes: {}, - FixedRate: 0.2, - HTTPMethod: 'GET', - Host: '*', - Priority: 1, - ReservoirSize: 10, - ResourceARN: '*', - RuleARN: 'arn:aws:xray:us-west-2:123456789000:sampling-rule/Rule2', - RuleName: 'Rule2', - ServiceName: 'FooBar', - ServiceType: '*', - URLPath: '/foo/bar', - Version: 1, - }, - }, - ], - }; +import * as http from 'http'; - let clock: sinon.SinonFakeTimers; - let sampler: AWSXRayRemoteSampler; - let axiosPostSpy: sinon.SinonSpy; - - const defaultEndpoint = 'http://localhost:1234'; - const pollingInterval = 60 * 1000; - const config = { - endpoint: defaultEndpoint, - pollingIntervalMs: pollingInterval, - }; - - before(() => { - nock('http://localhost:2000') - .persist() - .post('/GetSamplingRules') - .reply(200, getSamplingRulesResponseStub); +describe('AWSXRayRemoteSampler', () => { + let sampler: AWSXRayRemoteSampler | undefined; + + afterEach(() => { + if (sampler != null) { + sampler.stopPollers(); + } }); - beforeEach(() => { - clock = sinon.useFakeTimers(); - axiosPostSpy = sinon.spy(axios, 'post'); - sampler = new AWSXRayRemoteSampler(config); + it('testCreateRemoteSamplerWithEmptyResource', () => { + sampler = new AWSXRayRemoteSampler({ + resource: Resource.EMPTY, + }); + + expect((sampler as any)._root._root.rulePoller).not.toBeFalsy(); + expect((sampler as any)._root._root.rulePollingIntervalMillis).toEqual( + 300 * 1000 + ); + expect((sampler as any)._root._root.samplingClient).not.toBeFalsy(); + expect((sampler as any)._root._root.clientId).toMatch(/[a-f0-9]{24}/); }); - afterEach(() => { - clock.restore(); - axiosPostSpy.restore(); + it('testCreateRemoteSamplerWithPopulatedResource', () => { + const resource = new Resource({ + [ATTR_SERVICE_NAME]: 'test-service-name', + [SEMRESATTRS_CLOUD_PLATFORM]: 'test-cloud-platform', + }); + sampler = new AWSXRayRemoteSampler({ resource: resource }); + + expect((sampler as any)._root._root.rulePoller).not.toBeFalsy(); + expect((sampler as any)._root._root.rulePollingIntervalMillis).toEqual( + 300 * 1000 + ); + expect((sampler as any)._root._root.samplingClient).not.toBeFalsy(); + expect((sampler as any)._root._root.clientId).toMatch(/[a-f0-9]{24}/); }); - it('should throw TypeError when an invalid polling interval is passed in', async () => { - const configWithZeroPollingInterval = { - pollingIntervalMs: 0, - }; - const configWithNegativeInterval = { - pollingIntervalMs: -5, - }; - - assert.throws( - () => new AWSXRayRemoteSampler(configWithZeroPollingInterval), - TypeError + it('testCreateRemoteSamplerWithAllFieldsPopulated', () => { + const resource = new Resource({ + [ATTR_SERVICE_NAME]: 'test-service-name', + [SEMRESATTRS_CLOUD_PLATFORM]: 'test-cloud-platform', + }); + sampler = new AWSXRayRemoteSampler({ + resource: resource, + endpoint: 'http://abc.com', + pollingInterval: 120, // seconds + }); + + expect((sampler as any)._root._root.rulePoller).not.toBeFalsy(); + expect((sampler as any)._root._root.rulePollingIntervalMillis).toEqual( + 120 * 1000 ); - assert.throws( - () => new AWSXRayRemoteSampler(configWithNegativeInterval), - TypeError + expect((sampler as any)._root._root.samplingClient).not.toBeFalsy(); + expect((sampler as any)._root._root.awsProxyEndpoint).toEqual( + 'http://abc.com' ); + expect((sampler as any)._root._root.clientId).toMatch(/[a-f0-9]{24}/); }); - it('should make a POST request to the /GetSamplingRules endpoint upon initialization', async () => { - sinon.assert.calledOnce(axiosPostSpy); + it('toString()', () => { + expect( + new AWSXRayRemoteSampler({ resource: Resource.EMPTY }).toString() + ).toEqual( + 'AWSXRayRemoteSampler{root=ParentBased{root=_AWSXRayRemoteSampler{awsProxyEndpoint=http://localhost:2000, rulePollingIntervalMillis=300000}, remoteParentSampled=AlwaysOnSampler, remoteParentNotSampled=AlwaysOffSampler, localParentSampled=AlwaysOnSampler, localParentNotSampled=AlwaysOffSampler}' + ); }); +}); - it('should make a POST request to the /GetSamplingRules endpoint', async () => { - clock.tick(pollingInterval); - sinon.assert.calledTwice(axiosPostSpy); - }); +describe('_AWSXRayRemoteSampler', () => { + const pollingInterval = 60; + let clock: sinon.SinonFakeTimers; + let xrayClientSpy: sinon.SinonSpy; + let sampler: _AWSXRayRemoteSampler | undefined; - it('should make 3 POST requests to the /GetSamplingRules endpoint after 3 intervals have passed', async () => { - clock.tick(pollingInterval); - clock.tick(pollingInterval); + beforeEach(() => { + xrayClientSpy = sinon.spy(http, 'request'); + clock = sinon.useFakeTimers(); + }); - sinon.assert.calledThrice(axiosPostSpy); + afterEach(() => { + if (sampler != null) { + sampler.stopPollers(); + } + xrayClientSpy.restore(); + clock.restore(); }); - it('should initialize endpoint and polling interval from config correctly', async () => { - assert.strictEqual( - sampler.toString(), - `AWSXRayRemoteSampler{endpoint=${defaultEndpoint}, pollingInterval=${pollingInterval}}` - ); + it('should make a POST request to the /GetSamplingRules endpoint upon initialization', async () => { + sampler = new _AWSXRayRemoteSampler({ + resource: Resource.EMPTY, + pollingInterval: pollingInterval, + }); + sinon.assert.calledOnce(xrayClientSpy); }); - it('should fall back to default polling interval and endpoint if not specified in config', async () => { - const sampler = new AWSXRayRemoteSampler({}); + it('should make 3 POST requests to the /GetSamplingRules endpoint after 3 intervals have passed', async () => { + sampler = new _AWSXRayRemoteSampler({ + resource: Resource.EMPTY, + pollingInterval: pollingInterval, + }); + clock.tick(pollingInterval * 1000 + 5000); + clock.tick(pollingInterval * 1000 + 5000); + + sinon.assert.calledThrice(xrayClientSpy); + }); - // default polling interval (5 minutes) = 5 * 60 * 1000 - assert.strictEqual( - sampler.toString(), - `AWSXRayRemoteSampler{endpoint=http://localhost:2000, pollingInterval=${ - 5 * 60 * 1000 - }}` - ); + it('generates valid ClientId', () => { + const clientId: string = _AWSXRayRemoteSampler['generateClientId'](); + const match: RegExpMatchArray | null = clientId.match(/[0-9a-z]{24}/g); + expect(match).not.toBeNull(); }); }); diff --git a/incubator/opentelemetry-sampler-aws-xray/test/sampling-rule-applier.test.ts b/incubator/opentelemetry-sampler-aws-xray/test/sampling-rule-applier.test.ts new file mode 100644 index 0000000000..9f08020195 --- /dev/null +++ b/incubator/opentelemetry-sampler-aws-xray/test/sampling-rule-applier.test.ts @@ -0,0 +1,17 @@ +/* + * 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. + */ + +describe('SamplingRuleApplier', () => {}); diff --git a/incubator/opentelemetry-sampler-aws-xray/test/sampling-rule.test.ts b/incubator/opentelemetry-sampler-aws-xray/test/sampling-rule.test.ts new file mode 100644 index 0000000000..daea7c378a --- /dev/null +++ b/incubator/opentelemetry-sampler-aws-xray/test/sampling-rule.test.ts @@ -0,0 +1,89 @@ +/* + * 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 { expect } from 'expect'; +import { SamplingRule } from '../src/sampling-rule'; + +describe('SamplingRule', () => { + it('testSamplingRuleEquality', () => { + const rule = new SamplingRule({ + Attributes: { abc: '123', def: '4?6', ghi: '*89' }, + FixedRate: 0.11, + HTTPMethod: 'GET', + Host: 'localhost', + Priority: 20, + ReservoirSize: 1, + ResourceARN: '*', + RuleARN: 'arn:aws:xray:us-east-1:999999999999:sampling-rule/test', + RuleName: 'test', + ServiceName: 'myServiceName', + ServiceType: 'AWS::EKS::Container', + URLPath: '/helloworld', + Version: 1, + }); + const rule_unordered_attributes = new SamplingRule({ + Attributes: { ghi: '*89', abc: '123', def: '4?6' }, + FixedRate: 0.11, + HTTPMethod: 'GET', + Host: 'localhost', + Priority: 20, + ReservoirSize: 1, + ResourceARN: '*', + RuleARN: 'arn:aws:xray:us-east-1:999999999999:sampling-rule/test', + RuleName: 'test', + ServiceName: 'myServiceName', + ServiceType: 'AWS::EKS::Container', + URLPath: '/helloworld', + Version: 1, + }); + + expect(rule.equals(rule_unordered_attributes)); + + const rule_updated = new SamplingRule({ + Attributes: { ghi: '*89', abc: '123', def: '4?6' }, + FixedRate: 0.11, + HTTPMethod: 'GET', + Host: 'localhost', + Priority: 20, + ReservoirSize: 1, + ResourceARN: '*', + RuleARN: 'arn:aws:xray:us-east-1:999999999999:sampling-rule/test', + RuleName: 'test', + ServiceName: 'myServiceName', + ServiceType: 'AWS::EKS::Container', + URLPath: '/helloworld_new', + Version: 1, + }); + const rule_updated_2 = new SamplingRule({ + Attributes: { abc: '128', def: '4?6', ghi: '*89' }, + FixedRate: 0.11, + HTTPMethod: 'GET', + Host: 'localhost', + Priority: 20, + ReservoirSize: 1, + ResourceARN: '*', + RuleARN: 'arn:aws:xray:us-east-1:999999999999:sampling-rule/test', + RuleName: 'test', + ServiceName: 'myServiceName', + ServiceType: 'AWS::EKS::Container', + URLPath: '/helloworld', + Version: 1, + }); + + expect(rule.equals(rule_updated)).toEqual(false); + expect(rule.equals(rule_updated_2)).toEqual(false); + }); +}); diff --git a/incubator/opentelemetry-sampler-aws-xray/test/statistics.test.ts b/incubator/opentelemetry-sampler-aws-xray/test/statistics.test.ts new file mode 100644 index 0000000000..cfb24b3a0c --- /dev/null +++ b/incubator/opentelemetry-sampler-aws-xray/test/statistics.test.ts @@ -0,0 +1,31 @@ +/* + * 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 { expect } from 'expect'; +import { Statistics } from '../src/statistics'; + +describe('Statistics', () => { + it('construct statistics and get statistics', () => { + const statistics = new Statistics(12, 3456, 7); + expect(statistics.RequestCount).toEqual(12); + expect(statistics.SampleCount).toEqual(3456); + expect(statistics.BorrowCount).toEqual(7); + const obtainedStatistics = statistics.getStatistics(); + expect(obtainedStatistics.RequestCount).toEqual(12); + expect(obtainedStatistics.SampleCount).toEqual(3456); + expect(obtainedStatistics.BorrowCount).toEqual(7); + }); +}); From 4dab50cc9b8e18119c4467734ce1f208b39dfc84 Mon Sep 17 00:00:00 2001 From: jjllee Date: Mon, 10 Mar 2025 09:51:39 -0700 Subject: [PATCH 2/6] add incubator to repo workspaces --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 591686dc69..b6bf1133bf 100644 --- a/package.json +++ b/package.json @@ -83,6 +83,7 @@ "plugins/web/*", "propagators/*", "detectors/node/*", - "metapackages/*" + "metapackages/*", + "incubator/*" ] } From 198fcf9ddbb2c52d41068bfa69dea122ef9067de Mon Sep 17 00:00:00 2001 From: jjllee Date: Mon, 10 Mar 2025 10:36:50 -0700 Subject: [PATCH 3/6] remove unused deps/vars, update package-lock --- .../package.json | 7 +- .../src/remote-sampler.ts | 28 ------ .../test/remote-sampler.test.ts | 9 -- package-lock.json | 98 ++++++++++++++++++- 4 files changed, 101 insertions(+), 41 deletions(-) diff --git a/incubator/opentelemetry-sampler-aws-xray/package.json b/incubator/opentelemetry-sampler-aws-xray/package.json index 4341f20ba7..9a99bb5044 100644 --- a/incubator/opentelemetry-sampler-aws-xray/package.json +++ b/incubator/opentelemetry-sampler-aws-xray/package.json @@ -40,12 +40,13 @@ "version:update": "node ../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json" }, + "peerDependencies": { + "@opentelemetry/api": "^1.9.0" + }, "dependencies": { - "@opentelemetry/api": "^1.9.0", "@opentelemetry/core": "^1.26.0", "@opentelemetry/resources": "^1.10.0", - "@opentelemetry/sdk-trace-base": "^1.26.0", - "@opentelemetry/semantic-conventions": "^1.27.0" + "@opentelemetry/sdk-trace-base": "^1.26.0" }, "devDependencies": { "@opentelemetry/sdk-trace-node": "^1.26.0", diff --git a/incubator/opentelemetry-sampler-aws-xray/src/remote-sampler.ts b/incubator/opentelemetry-sampler-aws-xray/src/remote-sampler.ts index c73fffb382..55734c8a50 100644 --- a/incubator/opentelemetry-sampler-aws-xray/src/remote-sampler.ts +++ b/incubator/opentelemetry-sampler-aws-xray/src/remote-sampler.ts @@ -89,7 +89,6 @@ export class _AWSXRayRemoteSampler implements Sampler { private awsProxyEndpoint: string; private samplerDiag: DiagLogger; private rulePoller: NodeJS.Timeout | undefined; - private clientId: string; private rulePollingJitterMillis: number; private samplingClient: AWSXRaySamplingClient; @@ -114,7 +113,6 @@ export class _AWSXRayRemoteSampler implements Sampler { this.awsProxyEndpoint = samplerConfig.endpoint ? samplerConfig.endpoint : DEFAULT_AWS_PROXY_ENDPOINT; - this.clientId = _AWSXRayRemoteSampler.generateClientId(); this.samplingClient = new AWSXRaySamplingClient( this.awsProxyEndpoint, @@ -187,30 +185,4 @@ export class _AWSXRayRemoteSampler implements Sampler { ); } } - - private static generateClientId(): string { - const hexChars: string[] = [ - '0', - '1', - '2', - '3', - '4', - '5', - '6', - '7', - '8', - '9', - 'a', - 'b', - 'c', - 'd', - 'e', - 'f', - ]; - const clientIdArray: string[] = []; - for (let _ = 0; _ < 24; _ += 1) { - clientIdArray.push(hexChars[Math.floor(Math.random() * hexChars.length)]); - } - return clientIdArray.join(''); - } } diff --git a/incubator/opentelemetry-sampler-aws-xray/test/remote-sampler.test.ts b/incubator/opentelemetry-sampler-aws-xray/test/remote-sampler.test.ts index 0a99d71cae..88861583f8 100644 --- a/incubator/opentelemetry-sampler-aws-xray/test/remote-sampler.test.ts +++ b/incubator/opentelemetry-sampler-aws-xray/test/remote-sampler.test.ts @@ -46,7 +46,6 @@ describe('AWSXRayRemoteSampler', () => { 300 * 1000 ); expect((sampler as any)._root._root.samplingClient).not.toBeFalsy(); - expect((sampler as any)._root._root.clientId).toMatch(/[a-f0-9]{24}/); }); it('testCreateRemoteSamplerWithPopulatedResource', () => { @@ -61,7 +60,6 @@ describe('AWSXRayRemoteSampler', () => { 300 * 1000 ); expect((sampler as any)._root._root.samplingClient).not.toBeFalsy(); - expect((sampler as any)._root._root.clientId).toMatch(/[a-f0-9]{24}/); }); it('testCreateRemoteSamplerWithAllFieldsPopulated', () => { @@ -83,7 +81,6 @@ describe('AWSXRayRemoteSampler', () => { expect((sampler as any)._root._root.awsProxyEndpoint).toEqual( 'http://abc.com' ); - expect((sampler as any)._root._root.clientId).toMatch(/[a-f0-9]{24}/); }); it('toString()', () => { @@ -132,10 +129,4 @@ describe('_AWSXRayRemoteSampler', () => { sinon.assert.calledThrice(xrayClientSpy); }); - - it('generates valid ClientId', () => { - const clientId: string = _AWSXRayRemoteSampler['generateClientId'](); - const match: RegExpMatchArray | null = clientId.match(/[0-9a-z]{24}/g); - expect(match).not.toBeNull(); - }); }); diff --git a/package-lock.json b/package-lock.json index 0f23d64e6b..b13e21fac9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,8 @@ "plugins/web/*", "propagators/*", "detectors/node/*", - "metapackages/*" + "metapackages/*", + "incubator/*" ], "devDependencies": { "@typescript-eslint/eslint-plugin": "5.8.1", @@ -390,6 +391,60 @@ "node": ">=4.2.0" } }, + "incubator/opentelemetry-sampler-aws-xray": { + "name": "@opentelemetry/sampler-aws-xray", + "version": "0.34.0", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "^1.26.0", + "@opentelemetry/resources": "^1.10.0", + "@opentelemetry/sdk-trace-base": "^1.26.0" + }, + "devDependencies": { + "@opentelemetry/sdk-trace-node": "^1.26.0", + "@types/mocha": "10.0.10", + "@types/node": "18.18.14", + "@types/sinon": "17.0.4", + "@typescript-eslint/eslint-plugin": "5.8.1", + "@typescript-eslint/parser": "5.8.1", + "eslint": "8.7.0", + "expect": "29.2.0", + "nock": "13.3.3", + "nyc": "15.1.0", + "sinon": "15.2.0", + "typescript": "4.4.4" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.9.0" + } + }, + "incubator/opentelemetry-sampler-aws-xray/node_modules/@types/node": { + "version": "18.18.14", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.14.tgz", + "integrity": "sha512-iSOeNeXYNYNLLOMDSVPvIFojclvMZ/HDY2dU17kUlcsOsSQETbWIslJbYLZgA+ox8g2XQwSHKTkght1a5X26lQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "incubator/opentelemetry-sampler-aws-xray/node_modules/typescript": { + "version": "4.4.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz", + "integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, "metapackages/auto-configuration-propagators": { "name": "@opentelemetry/auto-configuration-propagators", "version": "0.3.3", @@ -10335,6 +10390,10 @@ "node": ">=14" } }, + "node_modules/@opentelemetry/sampler-aws-xray": { + "resolved": "incubator/opentelemetry-sampler-aws-xray", + "link": true + }, "node_modules/@opentelemetry/sdk-logs": { "version": "0.57.2", "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-logs/-/sdk-logs-0.57.2.tgz", @@ -49303,6 +49362,43 @@ } } }, + "@opentelemetry/sampler-aws-xray": { + "version": "file:incubator/opentelemetry-sampler-aws-xray", + "requires": { + "@opentelemetry/core": "^1.26.0", + "@opentelemetry/resources": "^1.10.0", + "@opentelemetry/sdk-trace-base": "^1.26.0", + "@opentelemetry/sdk-trace-node": "^1.26.0", + "@types/mocha": "10.0.10", + "@types/node": "18.18.14", + "@types/sinon": "17.0.4", + "@typescript-eslint/eslint-plugin": "5.8.1", + "@typescript-eslint/parser": "5.8.1", + "eslint": "8.7.0", + "expect": "29.2.0", + "nock": "13.3.3", + "nyc": "15.1.0", + "sinon": "15.2.0", + "typescript": "4.4.4" + }, + "dependencies": { + "@types/node": { + "version": "18.18.14", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.14.tgz", + "integrity": "sha512-iSOeNeXYNYNLLOMDSVPvIFojclvMZ/HDY2dU17kUlcsOsSQETbWIslJbYLZgA+ox8g2XQwSHKTkght1a5X26lQ==", + "dev": true, + "requires": { + "undici-types": "~5.26.4" + } + }, + "typescript": { + "version": "4.4.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz", + "integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==", + "dev": true + } + } + }, "@opentelemetry/sdk-logs": { "version": "0.57.2", "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-logs/-/sdk-logs-0.57.2.tgz", From f0d3ba66b62804ab74893b6eb727603c868d2281 Mon Sep 17 00:00:00 2001 From: jjllee Date: Sat, 15 Mar 2025 00:08:46 -0700 Subject: [PATCH 4/6] update comments, move package back to packages --- package-lock.json | 88 +++++++++++++------ package.json | 3 +- .../.eslintignore | 0 .../.eslintrc.js | 0 .../opentelemetry-sampler-aws-xray/LICENSE | 0 .../opentelemetry-sampler-aws-xray/README.md | 0 .../package.json | 1 + .../src/aws-xray-sampling-client.ts | 4 + .../src/index.ts | 0 .../src/remote-sampler.ts | 4 + .../src/sampling-rule-applier.ts | 4 + .../src/sampling-rule.ts | 4 + .../src/semconv.ts | 0 .../src/statistics.ts | 4 + .../src/types.ts | 4 + .../test/aws-xray-sampling-client.test.ts | 4 + .../get-sampling-rules-response-sample-2.json | 0 ...ling-rules-response-sample-sample-all.json | 0 .../get-sampling-rules-response-sample.json | 0 .../get-sampling-targets-response-sample.json | 0 ...ampler_sampling-rules-response-sample.json | 0 ...pler_sampling-targets-response-sample.json | 0 .../test/remote-sampler.test.ts | 4 + .../test/sampling-rule-applier.test.ts | 0 .../test/sampling-rule.test.ts | 4 + .../test/statistics.test.ts | 4 + .../tsconfig.esm.json | 0 .../tsconfig.json | 0 release-please-config.json | 3 + 29 files changed, 105 insertions(+), 30 deletions(-) rename {incubator => packages}/opentelemetry-sampler-aws-xray/.eslintignore (100%) rename {incubator => packages}/opentelemetry-sampler-aws-xray/.eslintrc.js (100%) rename {incubator => packages}/opentelemetry-sampler-aws-xray/LICENSE (100%) rename {incubator => packages}/opentelemetry-sampler-aws-xray/README.md (100%) rename {incubator => packages}/opentelemetry-sampler-aws-xray/package.json (98%) rename {incubator => packages}/opentelemetry-sampler-aws-xray/src/aws-xray-sampling-client.ts (96%) rename {incubator => packages}/opentelemetry-sampler-aws-xray/src/index.ts (100%) rename {incubator => packages}/opentelemetry-sampler-aws-xray/src/remote-sampler.ts (97%) rename {incubator => packages}/opentelemetry-sampler-aws-xray/src/sampling-rule-applier.ts (88%) rename {incubator => packages}/opentelemetry-sampler-aws-xray/src/sampling-rule.ts (96%) rename {incubator => packages}/opentelemetry-sampler-aws-xray/src/semconv.ts (100%) rename {incubator => packages}/opentelemetry-sampler-aws-xray/src/statistics.ts (90%) rename {incubator => packages}/opentelemetry-sampler-aws-xray/src/types.ts (97%) rename {incubator => packages}/opentelemetry-sampler-aws-xray/test/aws-xray-sampling-client.test.ts (98%) rename {incubator => packages}/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-2.json (100%) rename {incubator => packages}/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-sample-all.json (100%) rename {incubator => packages}/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample.json (100%) rename {incubator => packages}/opentelemetry-sampler-aws-xray/test/data/get-sampling-targets-response-sample.json (100%) rename {incubator => packages}/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-rules-response-sample.json (100%) rename {incubator => packages}/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-targets-response-sample.json (100%) rename {incubator => packages}/opentelemetry-sampler-aws-xray/test/remote-sampler.test.ts (97%) rename {incubator => packages}/opentelemetry-sampler-aws-xray/test/sampling-rule-applier.test.ts (100%) rename {incubator => packages}/opentelemetry-sampler-aws-xray/test/sampling-rule.test.ts (95%) rename {incubator => packages}/opentelemetry-sampler-aws-xray/test/statistics.test.ts (90%) rename {incubator => packages}/opentelemetry-sampler-aws-xray/tsconfig.esm.json (100%) rename {incubator => packages}/opentelemetry-sampler-aws-xray/tsconfig.json (100%) diff --git a/package-lock.json b/package-lock.json index b13e21fac9..36e2ee11ca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,8 +14,7 @@ "plugins/web/*", "propagators/*", "detectors/node/*", - "metapackages/*", - "incubator/*" + "metapackages/*" ], "devDependencies": { "@typescript-eslint/eslint-plugin": "5.8.1", @@ -394,6 +393,7 @@ "incubator/opentelemetry-sampler-aws-xray": { "name": "@opentelemetry/sampler-aws-xray", "version": "0.34.0", + "extraneous": true, "license": "Apache-2.0", "dependencies": { "@opentelemetry/core": "^1.26.0", @@ -421,30 +421,6 @@ "@opentelemetry/api": "^1.9.0" } }, - "incubator/opentelemetry-sampler-aws-xray/node_modules/@types/node": { - "version": "18.18.14", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.14.tgz", - "integrity": "sha512-iSOeNeXYNYNLLOMDSVPvIFojclvMZ/HDY2dU17kUlcsOsSQETbWIslJbYLZgA+ox8g2XQwSHKTkght1a5X26lQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "incubator/opentelemetry-sampler-aws-xray/node_modules/typescript": { - "version": "4.4.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz", - "integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, "metapackages/auto-configuration-propagators": { "name": "@opentelemetry/auto-configuration-propagators", "version": "0.3.3", @@ -10391,7 +10367,7 @@ } }, "node_modules/@opentelemetry/sampler-aws-xray": { - "resolved": "incubator/opentelemetry-sampler-aws-xray", + "resolved": "packages/opentelemetry-sampler-aws-xray", "link": true }, "node_modules/@opentelemetry/sdk-logs": { @@ -36018,6 +35994,61 @@ "node": ">=4.2.0" } }, + "packages/opentelemetry-sampler-aws-xray": { + "name": "@opentelemetry/sampler-aws-xray", + "version": "0.34.0", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "^1.26.0", + "@opentelemetry/resources": "^1.10.0", + "@opentelemetry/sdk-trace-base": "^1.26.0" + }, + "devDependencies": { + "@opentelemetry/api": "^1.9.0", + "@opentelemetry/sdk-trace-node": "^1.26.0", + "@types/mocha": "10.0.10", + "@types/node": "18.18.14", + "@types/sinon": "17.0.4", + "@typescript-eslint/eslint-plugin": "5.8.1", + "@typescript-eslint/parser": "5.8.1", + "eslint": "8.7.0", + "expect": "29.2.0", + "nock": "13.3.3", + "nyc": "15.1.0", + "sinon": "15.2.0", + "typescript": "4.4.4" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.9.0" + } + }, + "packages/opentelemetry-sampler-aws-xray/node_modules/@types/node": { + "version": "18.18.14", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.14.tgz", + "integrity": "sha512-iSOeNeXYNYNLLOMDSVPvIFojclvMZ/HDY2dU17kUlcsOsSQETbWIslJbYLZgA+ox8g2XQwSHKTkght1a5X26lQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "packages/opentelemetry-sampler-aws-xray/node_modules/typescript": { + "version": "4.4.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz", + "integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, "packages/opentelemetry-sql-common": { "name": "@opentelemetry/sql-common", "version": "0.40.1", @@ -49363,8 +49394,9 @@ } }, "@opentelemetry/sampler-aws-xray": { - "version": "file:incubator/opentelemetry-sampler-aws-xray", + "version": "file:packages/opentelemetry-sampler-aws-xray", "requires": { + "@opentelemetry/api": "^1.9.0", "@opentelemetry/core": "^1.26.0", "@opentelemetry/resources": "^1.10.0", "@opentelemetry/sdk-trace-base": "^1.26.0", diff --git a/package.json b/package.json index b6bf1133bf..591686dc69 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,6 @@ "plugins/web/*", "propagators/*", "detectors/node/*", - "metapackages/*", - "incubator/*" + "metapackages/*" ] } diff --git a/incubator/opentelemetry-sampler-aws-xray/.eslintignore b/packages/opentelemetry-sampler-aws-xray/.eslintignore similarity index 100% rename from incubator/opentelemetry-sampler-aws-xray/.eslintignore rename to packages/opentelemetry-sampler-aws-xray/.eslintignore diff --git a/incubator/opentelemetry-sampler-aws-xray/.eslintrc.js b/packages/opentelemetry-sampler-aws-xray/.eslintrc.js similarity index 100% rename from incubator/opentelemetry-sampler-aws-xray/.eslintrc.js rename to packages/opentelemetry-sampler-aws-xray/.eslintrc.js diff --git a/incubator/opentelemetry-sampler-aws-xray/LICENSE b/packages/opentelemetry-sampler-aws-xray/LICENSE similarity index 100% rename from incubator/opentelemetry-sampler-aws-xray/LICENSE rename to packages/opentelemetry-sampler-aws-xray/LICENSE diff --git a/incubator/opentelemetry-sampler-aws-xray/README.md b/packages/opentelemetry-sampler-aws-xray/README.md similarity index 100% rename from incubator/opentelemetry-sampler-aws-xray/README.md rename to packages/opentelemetry-sampler-aws-xray/README.md diff --git a/incubator/opentelemetry-sampler-aws-xray/package.json b/packages/opentelemetry-sampler-aws-xray/package.json similarity index 98% rename from incubator/opentelemetry-sampler-aws-xray/package.json rename to packages/opentelemetry-sampler-aws-xray/package.json index 9a99bb5044..4e572cdcaf 100644 --- a/incubator/opentelemetry-sampler-aws-xray/package.json +++ b/packages/opentelemetry-sampler-aws-xray/package.json @@ -49,6 +49,7 @@ "@opentelemetry/sdk-trace-base": "^1.26.0" }, "devDependencies": { + "@opentelemetry/api": "^1.9.0", "@opentelemetry/sdk-trace-node": "^1.26.0", "@types/mocha": "10.0.10", "@types/node": "18.18.14", diff --git a/incubator/opentelemetry-sampler-aws-xray/src/aws-xray-sampling-client.ts b/packages/opentelemetry-sampler-aws-xray/src/aws-xray-sampling-client.ts similarity index 96% rename from incubator/opentelemetry-sampler-aws-xray/src/aws-xray-sampling-client.ts rename to packages/opentelemetry-sampler-aws-xray/src/aws-xray-sampling-client.ts index 1634641f44..75c299295b 100644 --- a/incubator/opentelemetry-sampler-aws-xray/src/aws-xray-sampling-client.ts +++ b/packages/opentelemetry-sampler-aws-xray/src/aws-xray-sampling-client.ts @@ -14,6 +14,10 @@ * limitations under the License. */ +// Includes work from: +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + import { DiagLogFunction, DiagLogger, context } from '@opentelemetry/api'; import { suppressTracing } from '@opentelemetry/core'; import * as http from 'http'; diff --git a/incubator/opentelemetry-sampler-aws-xray/src/index.ts b/packages/opentelemetry-sampler-aws-xray/src/index.ts similarity index 100% rename from incubator/opentelemetry-sampler-aws-xray/src/index.ts rename to packages/opentelemetry-sampler-aws-xray/src/index.ts diff --git a/incubator/opentelemetry-sampler-aws-xray/src/remote-sampler.ts b/packages/opentelemetry-sampler-aws-xray/src/remote-sampler.ts similarity index 97% rename from incubator/opentelemetry-sampler-aws-xray/src/remote-sampler.ts rename to packages/opentelemetry-sampler-aws-xray/src/remote-sampler.ts index 55734c8a50..01f4f253bf 100644 --- a/incubator/opentelemetry-sampler-aws-xray/src/remote-sampler.ts +++ b/packages/opentelemetry-sampler-aws-xray/src/remote-sampler.ts @@ -14,6 +14,10 @@ * limitations under the License. */ +// Includes work from: +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + import { Attributes, Context, diff --git a/incubator/opentelemetry-sampler-aws-xray/src/sampling-rule-applier.ts b/packages/opentelemetry-sampler-aws-xray/src/sampling-rule-applier.ts similarity index 88% rename from incubator/opentelemetry-sampler-aws-xray/src/sampling-rule-applier.ts rename to packages/opentelemetry-sampler-aws-xray/src/sampling-rule-applier.ts index e1d0fd0378..92424317ea 100644 --- a/incubator/opentelemetry-sampler-aws-xray/src/sampling-rule-applier.ts +++ b/packages/opentelemetry-sampler-aws-xray/src/sampling-rule-applier.ts @@ -14,6 +14,10 @@ * limitations under the License. */ +// Includes work from: +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + import { ISamplingRule, SamplingTargetDocument } from './types'; import { SamplingRule } from './sampling-rule'; import { Statistics } from './statistics'; diff --git a/incubator/opentelemetry-sampler-aws-xray/src/sampling-rule.ts b/packages/opentelemetry-sampler-aws-xray/src/sampling-rule.ts similarity index 96% rename from incubator/opentelemetry-sampler-aws-xray/src/sampling-rule.ts rename to packages/opentelemetry-sampler-aws-xray/src/sampling-rule.ts index d0c63c9202..fd40e86618 100644 --- a/incubator/opentelemetry-sampler-aws-xray/src/sampling-rule.ts +++ b/packages/opentelemetry-sampler-aws-xray/src/sampling-rule.ts @@ -14,6 +14,10 @@ * limitations under the License. */ +// Includes work from: +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + import { ISamplingRule } from './types'; export class SamplingRule implements ISamplingRule { diff --git a/incubator/opentelemetry-sampler-aws-xray/src/semconv.ts b/packages/opentelemetry-sampler-aws-xray/src/semconv.ts similarity index 100% rename from incubator/opentelemetry-sampler-aws-xray/src/semconv.ts rename to packages/opentelemetry-sampler-aws-xray/src/semconv.ts diff --git a/incubator/opentelemetry-sampler-aws-xray/src/statistics.ts b/packages/opentelemetry-sampler-aws-xray/src/statistics.ts similarity index 90% rename from incubator/opentelemetry-sampler-aws-xray/src/statistics.ts rename to packages/opentelemetry-sampler-aws-xray/src/statistics.ts index fdee6cbbe9..056f01832a 100644 --- a/incubator/opentelemetry-sampler-aws-xray/src/statistics.ts +++ b/packages/opentelemetry-sampler-aws-xray/src/statistics.ts @@ -14,6 +14,10 @@ * limitations under the License. */ +// Includes work from: +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + import { ISamplingStatistics } from './types'; export class Statistics implements ISamplingStatistics { diff --git a/incubator/opentelemetry-sampler-aws-xray/src/types.ts b/packages/opentelemetry-sampler-aws-xray/src/types.ts similarity index 97% rename from incubator/opentelemetry-sampler-aws-xray/src/types.ts rename to packages/opentelemetry-sampler-aws-xray/src/types.ts index 5174588812..3e55819c2c 100644 --- a/incubator/opentelemetry-sampler-aws-xray/src/types.ts +++ b/packages/opentelemetry-sampler-aws-xray/src/types.ts @@ -14,6 +14,10 @@ * limitations under the License. */ +// Includes work from: +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + import { Resource } from '@opentelemetry/resources'; export interface AWSXRayRemoteSamplerConfig { diff --git a/incubator/opentelemetry-sampler-aws-xray/test/aws-xray-sampling-client.test.ts b/packages/opentelemetry-sampler-aws-xray/test/aws-xray-sampling-client.test.ts similarity index 98% rename from incubator/opentelemetry-sampler-aws-xray/test/aws-xray-sampling-client.test.ts rename to packages/opentelemetry-sampler-aws-xray/test/aws-xray-sampling-client.test.ts index e7a20ee692..628b000110 100644 --- a/incubator/opentelemetry-sampler-aws-xray/test/aws-xray-sampling-client.test.ts +++ b/packages/opentelemetry-sampler-aws-xray/test/aws-xray-sampling-client.test.ts @@ -14,6 +14,10 @@ * limitations under the License. */ +// Includes work from: +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + import { expect } from 'expect'; import * as nock from 'nock'; import { DiagConsoleLogger } from '@opentelemetry/api'; diff --git a/incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-2.json b/packages/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-2.json similarity index 100% rename from incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-2.json rename to packages/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-2.json diff --git a/incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-sample-all.json b/packages/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-sample-all.json similarity index 100% rename from incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-sample-all.json rename to packages/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-sample-all.json diff --git a/incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample.json b/packages/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample.json similarity index 100% rename from incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample.json rename to packages/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample.json diff --git a/incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-targets-response-sample.json b/packages/opentelemetry-sampler-aws-xray/test/data/get-sampling-targets-response-sample.json similarity index 100% rename from incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-targets-response-sample.json rename to packages/opentelemetry-sampler-aws-xray/test/data/get-sampling-targets-response-sample.json diff --git a/incubator/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-rules-response-sample.json b/packages/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-rules-response-sample.json similarity index 100% rename from incubator/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-rules-response-sample.json rename to packages/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-rules-response-sample.json diff --git a/incubator/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-targets-response-sample.json b/packages/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-targets-response-sample.json similarity index 100% rename from incubator/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-targets-response-sample.json rename to packages/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-targets-response-sample.json diff --git a/incubator/opentelemetry-sampler-aws-xray/test/remote-sampler.test.ts b/packages/opentelemetry-sampler-aws-xray/test/remote-sampler.test.ts similarity index 97% rename from incubator/opentelemetry-sampler-aws-xray/test/remote-sampler.test.ts rename to packages/opentelemetry-sampler-aws-xray/test/remote-sampler.test.ts index 88861583f8..aca00e75a2 100644 --- a/incubator/opentelemetry-sampler-aws-xray/test/remote-sampler.test.ts +++ b/packages/opentelemetry-sampler-aws-xray/test/remote-sampler.test.ts @@ -14,6 +14,10 @@ * limitations under the License. */ +// Includes work from: +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + import { Resource } from '@opentelemetry/resources'; import { SEMRESATTRS_CLOUD_PLATFORM, diff --git a/incubator/opentelemetry-sampler-aws-xray/test/sampling-rule-applier.test.ts b/packages/opentelemetry-sampler-aws-xray/test/sampling-rule-applier.test.ts similarity index 100% rename from incubator/opentelemetry-sampler-aws-xray/test/sampling-rule-applier.test.ts rename to packages/opentelemetry-sampler-aws-xray/test/sampling-rule-applier.test.ts diff --git a/incubator/opentelemetry-sampler-aws-xray/test/sampling-rule.test.ts b/packages/opentelemetry-sampler-aws-xray/test/sampling-rule.test.ts similarity index 95% rename from incubator/opentelemetry-sampler-aws-xray/test/sampling-rule.test.ts rename to packages/opentelemetry-sampler-aws-xray/test/sampling-rule.test.ts index daea7c378a..b39c17531e 100644 --- a/incubator/opentelemetry-sampler-aws-xray/test/sampling-rule.test.ts +++ b/packages/opentelemetry-sampler-aws-xray/test/sampling-rule.test.ts @@ -14,6 +14,10 @@ * limitations under the License. */ +// Includes work from: +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + import { expect } from 'expect'; import { SamplingRule } from '../src/sampling-rule'; diff --git a/incubator/opentelemetry-sampler-aws-xray/test/statistics.test.ts b/packages/opentelemetry-sampler-aws-xray/test/statistics.test.ts similarity index 90% rename from incubator/opentelemetry-sampler-aws-xray/test/statistics.test.ts rename to packages/opentelemetry-sampler-aws-xray/test/statistics.test.ts index cfb24b3a0c..79ec859807 100644 --- a/incubator/opentelemetry-sampler-aws-xray/test/statistics.test.ts +++ b/packages/opentelemetry-sampler-aws-xray/test/statistics.test.ts @@ -14,6 +14,10 @@ * limitations under the License. */ +// Includes work from: +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + import { expect } from 'expect'; import { Statistics } from '../src/statistics'; diff --git a/incubator/opentelemetry-sampler-aws-xray/tsconfig.esm.json b/packages/opentelemetry-sampler-aws-xray/tsconfig.esm.json similarity index 100% rename from incubator/opentelemetry-sampler-aws-xray/tsconfig.esm.json rename to packages/opentelemetry-sampler-aws-xray/tsconfig.esm.json diff --git a/incubator/opentelemetry-sampler-aws-xray/tsconfig.json b/packages/opentelemetry-sampler-aws-xray/tsconfig.json similarity index 100% rename from incubator/opentelemetry-sampler-aws-xray/tsconfig.json rename to packages/opentelemetry-sampler-aws-xray/tsconfig.json diff --git a/release-please-config.json b/release-please-config.json index b0993722d4..d71178be24 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -21,6 +21,9 @@ "packages/opentelemetry-id-generator-aws-xray": {}, "packages/opentelemetry-propagation-utils": {}, "packages/opentelemetry-redis-common": {}, + "packages/opentelemetry-sampler-aws-xray": { + "skip-github-release": true + }, "packages/opentelemetry-sql-common": {}, "packages/opentelemetry-test-utils": {}, "packages/winston-transport": {}, From 9be79edefd636fb8a58cf40ea167fdb30bdcd6cb Mon Sep 17 00:00:00 2001 From: jjllee Date: Fri, 25 Apr 2025 16:13:38 -0700 Subject: [PATCH 5/6] move xray sampler back to incubator --- .../.eslintignore | 0 .../.eslintrc.js | 0 .../opentelemetry-sampler-aws-xray/LICENSE | 0 .../opentelemetry-sampler-aws-xray/README.md | 0 .../package.json | 2 +- .../src/aws-xray-sampling-client.ts | 0 .../src/index.ts | 0 .../src/remote-sampler.ts | 0 .../src/sampling-rule-applier.ts | 0 .../src/sampling-rule.ts | 0 .../src/semconv.ts | 0 .../src/statistics.ts | 0 .../src/types.ts | 0 .../test/aws-xray-sampling-client.test.ts | 0 .../get-sampling-rules-response-sample-2.json | 0 ...ling-rules-response-sample-sample-all.json | 0 .../get-sampling-rules-response-sample.json | 0 .../get-sampling-targets-response-sample.json | 0 ...ampler_sampling-rules-response-sample.json | 0 ...pler_sampling-targets-response-sample.json | 0 .../test/remote-sampler.test.ts | 0 .../test/sampling-rule-applier.test.ts | 0 .../test/sampling-rule.test.ts | 0 .../test/statistics.test.ts | 0 .../tsconfig.esm.json | 0 .../tsconfig.json | 0 package-lock.json | 298 ++++++++++-------- package.json | 3 +- release-please-config.json | 6 +- 29 files changed, 165 insertions(+), 144 deletions(-) rename {packages => incubator}/opentelemetry-sampler-aws-xray/.eslintignore (100%) rename {packages => incubator}/opentelemetry-sampler-aws-xray/.eslintrc.js (100%) rename {packages => incubator}/opentelemetry-sampler-aws-xray/LICENSE (100%) rename {packages => incubator}/opentelemetry-sampler-aws-xray/README.md (100%) rename {packages => incubator}/opentelemetry-sampler-aws-xray/package.json (98%) rename {packages => incubator}/opentelemetry-sampler-aws-xray/src/aws-xray-sampling-client.ts (100%) rename {packages => incubator}/opentelemetry-sampler-aws-xray/src/index.ts (100%) rename {packages => incubator}/opentelemetry-sampler-aws-xray/src/remote-sampler.ts (100%) rename {packages => incubator}/opentelemetry-sampler-aws-xray/src/sampling-rule-applier.ts (100%) rename {packages => incubator}/opentelemetry-sampler-aws-xray/src/sampling-rule.ts (100%) rename {packages => incubator}/opentelemetry-sampler-aws-xray/src/semconv.ts (100%) rename {packages => incubator}/opentelemetry-sampler-aws-xray/src/statistics.ts (100%) rename {packages => incubator}/opentelemetry-sampler-aws-xray/src/types.ts (100%) rename {packages => incubator}/opentelemetry-sampler-aws-xray/test/aws-xray-sampling-client.test.ts (100%) rename {packages => incubator}/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-2.json (100%) rename {packages => incubator}/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-sample-all.json (100%) rename {packages => incubator}/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample.json (100%) rename {packages => incubator}/opentelemetry-sampler-aws-xray/test/data/get-sampling-targets-response-sample.json (100%) rename {packages => incubator}/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-rules-response-sample.json (100%) rename {packages => incubator}/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-targets-response-sample.json (100%) rename {packages => incubator}/opentelemetry-sampler-aws-xray/test/remote-sampler.test.ts (100%) rename {packages => incubator}/opentelemetry-sampler-aws-xray/test/sampling-rule-applier.test.ts (100%) rename {packages => incubator}/opentelemetry-sampler-aws-xray/test/sampling-rule.test.ts (100%) rename {packages => incubator}/opentelemetry-sampler-aws-xray/test/statistics.test.ts (100%) rename {packages => incubator}/opentelemetry-sampler-aws-xray/tsconfig.esm.json (100%) rename {packages => incubator}/opentelemetry-sampler-aws-xray/tsconfig.json (100%) diff --git a/packages/opentelemetry-sampler-aws-xray/.eslintignore b/incubator/opentelemetry-sampler-aws-xray/.eslintignore similarity index 100% rename from packages/opentelemetry-sampler-aws-xray/.eslintignore rename to incubator/opentelemetry-sampler-aws-xray/.eslintignore diff --git a/packages/opentelemetry-sampler-aws-xray/.eslintrc.js b/incubator/opentelemetry-sampler-aws-xray/.eslintrc.js similarity index 100% rename from packages/opentelemetry-sampler-aws-xray/.eslintrc.js rename to incubator/opentelemetry-sampler-aws-xray/.eslintrc.js diff --git a/packages/opentelemetry-sampler-aws-xray/LICENSE b/incubator/opentelemetry-sampler-aws-xray/LICENSE similarity index 100% rename from packages/opentelemetry-sampler-aws-xray/LICENSE rename to incubator/opentelemetry-sampler-aws-xray/LICENSE diff --git a/packages/opentelemetry-sampler-aws-xray/README.md b/incubator/opentelemetry-sampler-aws-xray/README.md similarity index 100% rename from packages/opentelemetry-sampler-aws-xray/README.md rename to incubator/opentelemetry-sampler-aws-xray/README.md diff --git a/packages/opentelemetry-sampler-aws-xray/package.json b/incubator/opentelemetry-sampler-aws-xray/package.json similarity index 98% rename from packages/opentelemetry-sampler-aws-xray/package.json rename to incubator/opentelemetry-sampler-aws-xray/package.json index cbbc39b51c..802a2503e6 100644 --- a/packages/opentelemetry-sampler-aws-xray/package.json +++ b/incubator/opentelemetry-sampler-aws-xray/package.json @@ -64,6 +64,6 @@ "typescript": "5.0.4" }, "engines": { - "node": ">=14" + "node": "^18.19.0 || >=20.6.0" } } diff --git a/packages/opentelemetry-sampler-aws-xray/src/aws-xray-sampling-client.ts b/incubator/opentelemetry-sampler-aws-xray/src/aws-xray-sampling-client.ts similarity index 100% rename from packages/opentelemetry-sampler-aws-xray/src/aws-xray-sampling-client.ts rename to incubator/opentelemetry-sampler-aws-xray/src/aws-xray-sampling-client.ts diff --git a/packages/opentelemetry-sampler-aws-xray/src/index.ts b/incubator/opentelemetry-sampler-aws-xray/src/index.ts similarity index 100% rename from packages/opentelemetry-sampler-aws-xray/src/index.ts rename to incubator/opentelemetry-sampler-aws-xray/src/index.ts diff --git a/packages/opentelemetry-sampler-aws-xray/src/remote-sampler.ts b/incubator/opentelemetry-sampler-aws-xray/src/remote-sampler.ts similarity index 100% rename from packages/opentelemetry-sampler-aws-xray/src/remote-sampler.ts rename to incubator/opentelemetry-sampler-aws-xray/src/remote-sampler.ts diff --git a/packages/opentelemetry-sampler-aws-xray/src/sampling-rule-applier.ts b/incubator/opentelemetry-sampler-aws-xray/src/sampling-rule-applier.ts similarity index 100% rename from packages/opentelemetry-sampler-aws-xray/src/sampling-rule-applier.ts rename to incubator/opentelemetry-sampler-aws-xray/src/sampling-rule-applier.ts diff --git a/packages/opentelemetry-sampler-aws-xray/src/sampling-rule.ts b/incubator/opentelemetry-sampler-aws-xray/src/sampling-rule.ts similarity index 100% rename from packages/opentelemetry-sampler-aws-xray/src/sampling-rule.ts rename to incubator/opentelemetry-sampler-aws-xray/src/sampling-rule.ts diff --git a/packages/opentelemetry-sampler-aws-xray/src/semconv.ts b/incubator/opentelemetry-sampler-aws-xray/src/semconv.ts similarity index 100% rename from packages/opentelemetry-sampler-aws-xray/src/semconv.ts rename to incubator/opentelemetry-sampler-aws-xray/src/semconv.ts diff --git a/packages/opentelemetry-sampler-aws-xray/src/statistics.ts b/incubator/opentelemetry-sampler-aws-xray/src/statistics.ts similarity index 100% rename from packages/opentelemetry-sampler-aws-xray/src/statistics.ts rename to incubator/opentelemetry-sampler-aws-xray/src/statistics.ts diff --git a/packages/opentelemetry-sampler-aws-xray/src/types.ts b/incubator/opentelemetry-sampler-aws-xray/src/types.ts similarity index 100% rename from packages/opentelemetry-sampler-aws-xray/src/types.ts rename to incubator/opentelemetry-sampler-aws-xray/src/types.ts diff --git a/packages/opentelemetry-sampler-aws-xray/test/aws-xray-sampling-client.test.ts b/incubator/opentelemetry-sampler-aws-xray/test/aws-xray-sampling-client.test.ts similarity index 100% rename from packages/opentelemetry-sampler-aws-xray/test/aws-xray-sampling-client.test.ts rename to incubator/opentelemetry-sampler-aws-xray/test/aws-xray-sampling-client.test.ts diff --git a/packages/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-2.json b/incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-2.json similarity index 100% rename from packages/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-2.json rename to incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-2.json diff --git a/packages/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-sample-all.json b/incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-sample-all.json similarity index 100% rename from packages/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-sample-all.json rename to incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample-sample-all.json diff --git a/packages/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample.json b/incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample.json similarity index 100% rename from packages/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample.json rename to incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-rules-response-sample.json diff --git a/packages/opentelemetry-sampler-aws-xray/test/data/get-sampling-targets-response-sample.json b/incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-targets-response-sample.json similarity index 100% rename from packages/opentelemetry-sampler-aws-xray/test/data/get-sampling-targets-response-sample.json rename to incubator/opentelemetry-sampler-aws-xray/test/data/get-sampling-targets-response-sample.json diff --git a/packages/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-rules-response-sample.json b/incubator/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-rules-response-sample.json similarity index 100% rename from packages/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-rules-response-sample.json rename to incubator/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-rules-response-sample.json diff --git a/packages/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-targets-response-sample.json b/incubator/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-targets-response-sample.json similarity index 100% rename from packages/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-targets-response-sample.json rename to incubator/opentelemetry-sampler-aws-xray/test/data/test-remote-sampler_sampling-targets-response-sample.json diff --git a/packages/opentelemetry-sampler-aws-xray/test/remote-sampler.test.ts b/incubator/opentelemetry-sampler-aws-xray/test/remote-sampler.test.ts similarity index 100% rename from packages/opentelemetry-sampler-aws-xray/test/remote-sampler.test.ts rename to incubator/opentelemetry-sampler-aws-xray/test/remote-sampler.test.ts diff --git a/packages/opentelemetry-sampler-aws-xray/test/sampling-rule-applier.test.ts b/incubator/opentelemetry-sampler-aws-xray/test/sampling-rule-applier.test.ts similarity index 100% rename from packages/opentelemetry-sampler-aws-xray/test/sampling-rule-applier.test.ts rename to incubator/opentelemetry-sampler-aws-xray/test/sampling-rule-applier.test.ts diff --git a/packages/opentelemetry-sampler-aws-xray/test/sampling-rule.test.ts b/incubator/opentelemetry-sampler-aws-xray/test/sampling-rule.test.ts similarity index 100% rename from packages/opentelemetry-sampler-aws-xray/test/sampling-rule.test.ts rename to incubator/opentelemetry-sampler-aws-xray/test/sampling-rule.test.ts diff --git a/packages/opentelemetry-sampler-aws-xray/test/statistics.test.ts b/incubator/opentelemetry-sampler-aws-xray/test/statistics.test.ts similarity index 100% rename from packages/opentelemetry-sampler-aws-xray/test/statistics.test.ts rename to incubator/opentelemetry-sampler-aws-xray/test/statistics.test.ts diff --git a/packages/opentelemetry-sampler-aws-xray/tsconfig.esm.json b/incubator/opentelemetry-sampler-aws-xray/tsconfig.esm.json similarity index 100% rename from packages/opentelemetry-sampler-aws-xray/tsconfig.esm.json rename to incubator/opentelemetry-sampler-aws-xray/tsconfig.esm.json diff --git a/packages/opentelemetry-sampler-aws-xray/tsconfig.json b/incubator/opentelemetry-sampler-aws-xray/tsconfig.json similarity index 100% rename from packages/opentelemetry-sampler-aws-xray/tsconfig.json rename to incubator/opentelemetry-sampler-aws-xray/tsconfig.json diff --git a/package-lock.json b/package-lock.json index 91d372def2..fccc00b169 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,8 @@ "plugins/web/*", "propagators/*", "detectors/node/*", - "metapackages/*" + "metapackages/*", + "incubator/*" ], "devDependencies": { "@typescript-eslint/eslint-plugin": "5.8.1", @@ -308,7 +309,6 @@ "incubator/opentelemetry-sampler-aws-xray": { "name": "@opentelemetry/sampler-aws-xray", "version": "0.34.0", - "extraneous": true, "license": "Apache-2.0", "dependencies": { "@opentelemetry/core": "^1.26.0", @@ -336,6 +336,153 @@ "@opentelemetry/api": "^1.9.0" } }, + "incubator/opentelemetry-sampler-aws-xray/node_modules/@opentelemetry/context-async-hooks": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/context-async-hooks/-/context-async-hooks-1.30.1.tgz", + "integrity": "sha512-s5vvxXPVdjqS3kTLKMeBMvop9hbWkwzBpu+mUO2M7sZtlkyDJGwFe33wRKnbaYDo8ExRVBIIdwIGrqpxHuKttA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "incubator/opentelemetry-sampler-aws-xray/node_modules/@opentelemetry/core": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.30.1.tgz", + "integrity": "sha512-OOCM2C/QIURhJMuKaekP3TRBxBKxG/TWWA0TL2J6nXUtDnuCtccy49LUJF8xPFXMX+0LMcxFpCo8M9cGY1W6rQ==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/semantic-conventions": "1.28.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "incubator/opentelemetry-sampler-aws-xray/node_modules/@opentelemetry/propagator-b3": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-b3/-/propagator-b3-1.30.1.tgz", + "integrity": "sha512-oATwWWDIJzybAZ4pO76ATN5N6FFbOA1otibAVlS8v90B4S1wClnhRUk7K+2CHAwN1JKYuj4jh/lpCEG5BAqFuQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "1.30.1" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "incubator/opentelemetry-sampler-aws-xray/node_modules/@opentelemetry/propagator-jaeger": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-jaeger/-/propagator-jaeger-1.30.1.tgz", + "integrity": "sha512-Pj/BfnYEKIOImirH76M4hDaBSx6HyZ2CXUqk+Kj02m6BB80c/yo4BdWkn/1gDFfU+YPY+bPR2U0DKBfdxCKwmg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "1.30.1" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "incubator/opentelemetry-sampler-aws-xray/node_modules/@opentelemetry/resources": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.30.1.tgz", + "integrity": "sha512-5UxZqiAgLYGFjS4s9qm5mBVo433u+dSPUFWVWXmLAD4wB65oMCoXaJP1KJa9DIYYMeHu3z4BZcStG3LC593cWA==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "1.30.1", + "@opentelemetry/semantic-conventions": "1.28.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "incubator/opentelemetry-sampler-aws-xray/node_modules/@opentelemetry/sdk-trace-base": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.30.1.tgz", + "integrity": "sha512-jVPgBbH1gCy2Lb7X0AVQ8XAfgg0pJ4nvl8/IiQA6nxOsPvS+0zMJaFSs2ltXe0J6C8dqjcnpyqINDJmU30+uOg==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "1.30.1", + "@opentelemetry/resources": "1.30.1", + "@opentelemetry/semantic-conventions": "1.28.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "incubator/opentelemetry-sampler-aws-xray/node_modules/@opentelemetry/sdk-trace-node": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-node/-/sdk-trace-node-1.30.1.tgz", + "integrity": "sha512-cBjYOINt1JxXdpw1e5MlHmFRc5fgj4GW/86vsKFxJCJ8AL4PdVtYH41gWwl4qd4uQjqEL1oJVrXkSy5cnduAnQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/context-async-hooks": "1.30.1", + "@opentelemetry/core": "1.30.1", + "@opentelemetry/propagator-b3": "1.30.1", + "@opentelemetry/propagator-jaeger": "1.30.1", + "@opentelemetry/sdk-trace-base": "1.30.1", + "semver": "^7.5.2" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "incubator/opentelemetry-sampler-aws-xray/node_modules/@opentelemetry/semantic-conventions": { + "version": "1.28.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.28.0.tgz", + "integrity": "sha512-lp4qAiMTD4sNWW4DbKLBkfiMZ4jbAboJIGOQr5DvciMRI494OapieI9qiODpOt0XBr1LjIDy1xAGAnVs5supTA==", + "license": "Apache-2.0", + "engines": { + "node": ">=14" + } + }, + "incubator/opentelemetry-sampler-aws-xray/node_modules/@types/node": { + "version": "18.18.14", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.14.tgz", + "integrity": "sha512-iSOeNeXYNYNLLOMDSVPvIFojclvMZ/HDY2dU17kUlcsOsSQETbWIslJbYLZgA+ox8g2XQwSHKTkght1a5X26lQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "incubator/opentelemetry-sampler-aws-xray/node_modules/typescript": { + "version": "4.4.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz", + "integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, "metapackages/auto-configuration-propagators": { "name": "@opentelemetry/auto-configuration-propagators", "version": "0.4.0", @@ -9529,7 +9676,7 @@ } }, "node_modules/@opentelemetry/sampler-aws-xray": { - "resolved": "packages/opentelemetry-sampler-aws-xray", + "resolved": "incubator/opentelemetry-sampler-aws-xray", "link": true }, "node_modules/@opentelemetry/sdk-logs": { @@ -35098,6 +35245,7 @@ "packages/opentelemetry-sampler-aws-xray": { "name": "@opentelemetry/sampler-aws-xray", "version": "0.34.0", + "extraneous": true, "license": "Apache-2.0", "dependencies": { "@opentelemetry/core": "^1.26.0", @@ -35126,139 +35274,6 @@ "@opentelemetry/api": "^1.9.0" } }, - "packages/opentelemetry-sampler-aws-xray/node_modules/@opentelemetry/context-async-hooks": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/context-async-hooks/-/context-async-hooks-1.30.1.tgz", - "integrity": "sha512-s5vvxXPVdjqS3kTLKMeBMvop9hbWkwzBpu+mUO2M7sZtlkyDJGwFe33wRKnbaYDo8ExRVBIIdwIGrqpxHuKttA==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.10.0" - } - }, - "packages/opentelemetry-sampler-aws-xray/node_modules/@opentelemetry/core": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.30.1.tgz", - "integrity": "sha512-OOCM2C/QIURhJMuKaekP3TRBxBKxG/TWWA0TL2J6nXUtDnuCtccy49LUJF8xPFXMX+0LMcxFpCo8M9cGY1W6rQ==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/semantic-conventions": "1.28.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.10.0" - } - }, - "packages/opentelemetry-sampler-aws-xray/node_modules/@opentelemetry/propagator-b3": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-b3/-/propagator-b3-1.30.1.tgz", - "integrity": "sha512-oATwWWDIJzybAZ4pO76ATN5N6FFbOA1otibAVlS8v90B4S1wClnhRUk7K+2CHAwN1JKYuj4jh/lpCEG5BAqFuQ==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/core": "1.30.1" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.10.0" - } - }, - "packages/opentelemetry-sampler-aws-xray/node_modules/@opentelemetry/propagator-jaeger": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-jaeger/-/propagator-jaeger-1.30.1.tgz", - "integrity": "sha512-Pj/BfnYEKIOImirH76M4hDaBSx6HyZ2CXUqk+Kj02m6BB80c/yo4BdWkn/1gDFfU+YPY+bPR2U0DKBfdxCKwmg==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/core": "1.30.1" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.10.0" - } - }, - "packages/opentelemetry-sampler-aws-xray/node_modules/@opentelemetry/resources": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.30.1.tgz", - "integrity": "sha512-5UxZqiAgLYGFjS4s9qm5mBVo433u+dSPUFWVWXmLAD4wB65oMCoXaJP1KJa9DIYYMeHu3z4BZcStG3LC593cWA==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/core": "1.30.1", - "@opentelemetry/semantic-conventions": "1.28.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.10.0" - } - }, - "packages/opentelemetry-sampler-aws-xray/node_modules/@opentelemetry/sdk-trace-base": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.30.1.tgz", - "integrity": "sha512-jVPgBbH1gCy2Lb7X0AVQ8XAfgg0pJ4nvl8/IiQA6nxOsPvS+0zMJaFSs2ltXe0J6C8dqjcnpyqINDJmU30+uOg==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/core": "1.30.1", - "@opentelemetry/resources": "1.30.1", - "@opentelemetry/semantic-conventions": "1.28.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.10.0" - } - }, - "packages/opentelemetry-sampler-aws-xray/node_modules/@opentelemetry/sdk-trace-node": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-node/-/sdk-trace-node-1.30.1.tgz", - "integrity": "sha512-cBjYOINt1JxXdpw1e5MlHmFRc5fgj4GW/86vsKFxJCJ8AL4PdVtYH41gWwl4qd4uQjqEL1oJVrXkSy5cnduAnQ==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/context-async-hooks": "1.30.1", - "@opentelemetry/core": "1.30.1", - "@opentelemetry/propagator-b3": "1.30.1", - "@opentelemetry/propagator-jaeger": "1.30.1", - "@opentelemetry/sdk-trace-base": "1.30.1", - "semver": "^7.5.2" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.10.0" - } - }, - "packages/opentelemetry-sampler-aws-xray/node_modules/@opentelemetry/semantic-conventions": { - "version": "1.28.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.28.0.tgz", - "integrity": "sha512-lp4qAiMTD4sNWW4DbKLBkfiMZ4jbAboJIGOQr5DvciMRI494OapieI9qiODpOt0XBr1LjIDy1xAGAnVs5supTA==", - "license": "Apache-2.0", - "engines": { - "node": ">=14" - } - }, - "packages/opentelemetry-sampler-aws-xray/node_modules/@types/node": { - "version": "18.18.14", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.14.tgz", - "integrity": "sha512-iSOeNeXYNYNLLOMDSVPvIFojclvMZ/HDY2dU17kUlcsOsSQETbWIslJbYLZgA+ox8g2XQwSHKTkght1a5X26lQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~5.26.4" - } - }, "packages/opentelemetry-sql-common": { "name": "@opentelemetry/sql-common", "version": "0.41.0", @@ -48052,9 +48067,8 @@ } }, "@opentelemetry/sampler-aws-xray": { - "version": "file:packages/opentelemetry-sampler-aws-xray", + "version": "file:incubator/opentelemetry-sampler-aws-xray", "requires": { - "@opentelemetry/api": "^1.9.0", "@opentelemetry/core": "^1.26.0", "@opentelemetry/resources": "^1.10.0", "@opentelemetry/sdk-trace-base": "^1.26.0", @@ -48069,7 +48083,7 @@ "nock": "13.3.3", "nyc": "15.1.0", "sinon": "15.2.0", - "typescript": "5.0.4" + "typescript": "4.4.4" }, "dependencies": { "@opentelemetry/context-async-hooks": { @@ -48151,6 +48165,12 @@ "requires": { "undici-types": "~5.26.4" } + }, + "typescript": { + "version": "4.4.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz", + "integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==", + "dev": true } } }, diff --git a/package.json b/package.json index 8bcf010575..1044995d86 100644 --- a/package.json +++ b/package.json @@ -83,6 +83,7 @@ "plugins/web/*", "propagators/*", "detectors/node/*", - "metapackages/*" + "metapackages/*", + "incubator/*" ] } diff --git a/release-please-config.json b/release-please-config.json index 7213f4aaf2..94c624df8b 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -13,6 +13,9 @@ "detectors/node/opentelemetry-resource-detector-gcp": {}, "detectors/node/opentelemetry-resource-detector-github": {}, "detectors/node/opentelemetry-resource-detector-instana": {}, + "incubator/opentelemetry-sampler-aws-xray": { + "skip-github-release": true + }, "metapackages/auto-configuration-propagators": {}, "metapackages/auto-instrumentations-node": {}, "metapackages/auto-instrumentations-web": {}, @@ -22,9 +25,6 @@ "packages/opentelemetry-id-generator-aws-xray": {}, "packages/opentelemetry-propagation-utils": {}, "packages/opentelemetry-redis-common": {}, - "packages/opentelemetry-sampler-aws-xray": { - "skip-github-release": true - }, "packages/opentelemetry-sql-common": {}, "packages/opentelemetry-test-utils": {}, "packages/winston-transport": {}, From 82e7236eb556c504b213fd928205a6179cdab263 Mon Sep 17 00:00:00 2001 From: jjllee Date: Fri, 25 Apr 2025 17:06:11 -0700 Subject: [PATCH 6/6] upgrade to otel sdk v2, cleanup --- .../package.json | 9 +- .../test/remote-sampler.test.ts | 14 +- package-lock.json | 277 +----------------- package.json | 3 +- release-please-config.json | 3 - 5 files changed, 23 insertions(+), 283 deletions(-) diff --git a/incubator/opentelemetry-sampler-aws-xray/package.json b/incubator/opentelemetry-sampler-aws-xray/package.json index 802a2503e6..2b2b74e955 100644 --- a/incubator/opentelemetry-sampler-aws-xray/package.json +++ b/incubator/opentelemetry-sampler-aws-xray/package.json @@ -44,13 +44,14 @@ "@opentelemetry/api": "^1.9.0" }, "dependencies": { - "@opentelemetry/core": "^1.26.0", - "@opentelemetry/resources": "^1.10.0", - "@opentelemetry/sdk-trace-base": "^1.26.0" + "@opentelemetry/core": "^2.0.0", + "@opentelemetry/resources": "^2.0.0", + "@opentelemetry/sdk-trace-base": "^2.0.0", + "@opentelemetry/semantic-conventions": "^1.27.0" }, "devDependencies": { "@opentelemetry/api": "^1.9.0", - "@opentelemetry/sdk-trace-node": "^1.26.0", + "@opentelemetry/sdk-trace-node": "^2.0.0", "@types/mocha": "10.0.10", "@types/node": "18.18.14", "@types/sinon": "17.0.4", diff --git a/incubator/opentelemetry-sampler-aws-xray/test/remote-sampler.test.ts b/incubator/opentelemetry-sampler-aws-xray/test/remote-sampler.test.ts index aca00e75a2..bd45697e94 100644 --- a/incubator/opentelemetry-sampler-aws-xray/test/remote-sampler.test.ts +++ b/incubator/opentelemetry-sampler-aws-xray/test/remote-sampler.test.ts @@ -18,7 +18,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import { Resource } from '@opentelemetry/resources'; +import { resourceFromAttributes, emptyResource } from '@opentelemetry/resources'; import { SEMRESATTRS_CLOUD_PLATFORM, ATTR_SERVICE_NAME, @@ -42,7 +42,7 @@ describe('AWSXRayRemoteSampler', () => { it('testCreateRemoteSamplerWithEmptyResource', () => { sampler = new AWSXRayRemoteSampler({ - resource: Resource.EMPTY, + resource: emptyResource(), }); expect((sampler as any)._root._root.rulePoller).not.toBeFalsy(); @@ -53,7 +53,7 @@ describe('AWSXRayRemoteSampler', () => { }); it('testCreateRemoteSamplerWithPopulatedResource', () => { - const resource = new Resource({ + const resource = resourceFromAttributes({ [ATTR_SERVICE_NAME]: 'test-service-name', [SEMRESATTRS_CLOUD_PLATFORM]: 'test-cloud-platform', }); @@ -67,7 +67,7 @@ describe('AWSXRayRemoteSampler', () => { }); it('testCreateRemoteSamplerWithAllFieldsPopulated', () => { - const resource = new Resource({ + const resource = resourceFromAttributes({ [ATTR_SERVICE_NAME]: 'test-service-name', [SEMRESATTRS_CLOUD_PLATFORM]: 'test-cloud-platform', }); @@ -89,7 +89,7 @@ describe('AWSXRayRemoteSampler', () => { it('toString()', () => { expect( - new AWSXRayRemoteSampler({ resource: Resource.EMPTY }).toString() + new AWSXRayRemoteSampler({ resource: emptyResource() }).toString() ).toEqual( 'AWSXRayRemoteSampler{root=ParentBased{root=_AWSXRayRemoteSampler{awsProxyEndpoint=http://localhost:2000, rulePollingIntervalMillis=300000}, remoteParentSampled=AlwaysOnSampler, remoteParentNotSampled=AlwaysOffSampler, localParentSampled=AlwaysOnSampler, localParentNotSampled=AlwaysOffSampler}' ); @@ -117,7 +117,7 @@ describe('_AWSXRayRemoteSampler', () => { it('should make a POST request to the /GetSamplingRules endpoint upon initialization', async () => { sampler = new _AWSXRayRemoteSampler({ - resource: Resource.EMPTY, + resource: emptyResource(), pollingInterval: pollingInterval, }); sinon.assert.calledOnce(xrayClientSpy); @@ -125,7 +125,7 @@ describe('_AWSXRayRemoteSampler', () => { it('should make 3 POST requests to the /GetSamplingRules endpoint after 3 intervals have passed', async () => { sampler = new _AWSXRayRemoteSampler({ - resource: Resource.EMPTY, + resource: emptyResource(), pollingInterval: pollingInterval, }); clock.tick(pollingInterval * 1000 + 5000); diff --git a/package-lock.json b/package-lock.json index fccc00b169..c2f682f55a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,8 +14,7 @@ "plugins/web/*", "propagators/*", "detectors/node/*", - "metapackages/*", - "incubator/*" + "metapackages/*" ], "devDependencies": { "@typescript-eslint/eslint-plugin": "5.8.1", @@ -309,14 +308,17 @@ "incubator/opentelemetry-sampler-aws-xray": { "name": "@opentelemetry/sampler-aws-xray", "version": "0.34.0", + "extraneous": true, "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "^1.26.0", - "@opentelemetry/resources": "^1.10.0", - "@opentelemetry/sdk-trace-base": "^1.26.0" + "@opentelemetry/core": "^2.0.0", + "@opentelemetry/resources": "^2.0.0", + "@opentelemetry/sdk-trace-base": "^2.0.0", + "@opentelemetry/semantic-conventions": "^1.27.0" }, "devDependencies": { - "@opentelemetry/sdk-trace-node": "^1.26.0", + "@opentelemetry/api": "^1.9.0", + "@opentelemetry/sdk-trace-node": "^2.0.0", "@types/mocha": "10.0.10", "@types/node": "18.18.14", "@types/sinon": "17.0.4", @@ -327,162 +329,15 @@ "nock": "13.3.3", "nyc": "15.1.0", "sinon": "15.2.0", - "typescript": "4.4.4" + "typescript": "5.0.4" }, "engines": { - "node": ">=14" + "node": "^18.19.0 || >=20.6.0" }, "peerDependencies": { "@opentelemetry/api": "^1.9.0" } }, - "incubator/opentelemetry-sampler-aws-xray/node_modules/@opentelemetry/context-async-hooks": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/context-async-hooks/-/context-async-hooks-1.30.1.tgz", - "integrity": "sha512-s5vvxXPVdjqS3kTLKMeBMvop9hbWkwzBpu+mUO2M7sZtlkyDJGwFe33wRKnbaYDo8ExRVBIIdwIGrqpxHuKttA==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.10.0" - } - }, - "incubator/opentelemetry-sampler-aws-xray/node_modules/@opentelemetry/core": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.30.1.tgz", - "integrity": "sha512-OOCM2C/QIURhJMuKaekP3TRBxBKxG/TWWA0TL2J6nXUtDnuCtccy49LUJF8xPFXMX+0LMcxFpCo8M9cGY1W6rQ==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/semantic-conventions": "1.28.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.10.0" - } - }, - "incubator/opentelemetry-sampler-aws-xray/node_modules/@opentelemetry/propagator-b3": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-b3/-/propagator-b3-1.30.1.tgz", - "integrity": "sha512-oATwWWDIJzybAZ4pO76ATN5N6FFbOA1otibAVlS8v90B4S1wClnhRUk7K+2CHAwN1JKYuj4jh/lpCEG5BAqFuQ==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/core": "1.30.1" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.10.0" - } - }, - "incubator/opentelemetry-sampler-aws-xray/node_modules/@opentelemetry/propagator-jaeger": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-jaeger/-/propagator-jaeger-1.30.1.tgz", - "integrity": "sha512-Pj/BfnYEKIOImirH76M4hDaBSx6HyZ2CXUqk+Kj02m6BB80c/yo4BdWkn/1gDFfU+YPY+bPR2U0DKBfdxCKwmg==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/core": "1.30.1" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.10.0" - } - }, - "incubator/opentelemetry-sampler-aws-xray/node_modules/@opentelemetry/resources": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.30.1.tgz", - "integrity": "sha512-5UxZqiAgLYGFjS4s9qm5mBVo433u+dSPUFWVWXmLAD4wB65oMCoXaJP1KJa9DIYYMeHu3z4BZcStG3LC593cWA==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/core": "1.30.1", - "@opentelemetry/semantic-conventions": "1.28.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.10.0" - } - }, - "incubator/opentelemetry-sampler-aws-xray/node_modules/@opentelemetry/sdk-trace-base": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.30.1.tgz", - "integrity": "sha512-jVPgBbH1gCy2Lb7X0AVQ8XAfgg0pJ4nvl8/IiQA6nxOsPvS+0zMJaFSs2ltXe0J6C8dqjcnpyqINDJmU30+uOg==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/core": "1.30.1", - "@opentelemetry/resources": "1.30.1", - "@opentelemetry/semantic-conventions": "1.28.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.10.0" - } - }, - "incubator/opentelemetry-sampler-aws-xray/node_modules/@opentelemetry/sdk-trace-node": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-node/-/sdk-trace-node-1.30.1.tgz", - "integrity": "sha512-cBjYOINt1JxXdpw1e5MlHmFRc5fgj4GW/86vsKFxJCJ8AL4PdVtYH41gWwl4qd4uQjqEL1oJVrXkSy5cnduAnQ==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/context-async-hooks": "1.30.1", - "@opentelemetry/core": "1.30.1", - "@opentelemetry/propagator-b3": "1.30.1", - "@opentelemetry/propagator-jaeger": "1.30.1", - "@opentelemetry/sdk-trace-base": "1.30.1", - "semver": "^7.5.2" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.10.0" - } - }, - "incubator/opentelemetry-sampler-aws-xray/node_modules/@opentelemetry/semantic-conventions": { - "version": "1.28.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.28.0.tgz", - "integrity": "sha512-lp4qAiMTD4sNWW4DbKLBkfiMZ4jbAboJIGOQr5DvciMRI494OapieI9qiODpOt0XBr1LjIDy1xAGAnVs5supTA==", - "license": "Apache-2.0", - "engines": { - "node": ">=14" - } - }, - "incubator/opentelemetry-sampler-aws-xray/node_modules/@types/node": { - "version": "18.18.14", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.14.tgz", - "integrity": "sha512-iSOeNeXYNYNLLOMDSVPvIFojclvMZ/HDY2dU17kUlcsOsSQETbWIslJbYLZgA+ox8g2XQwSHKTkght1a5X26lQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "incubator/opentelemetry-sampler-aws-xray/node_modules/typescript": { - "version": "4.4.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz", - "integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, "metapackages/auto-configuration-propagators": { "name": "@opentelemetry/auto-configuration-propagators", "version": "0.4.0", @@ -9675,10 +9530,6 @@ "@opentelemetry/api": ">=1.3.0 <1.10.0" } }, - "node_modules/@opentelemetry/sampler-aws-xray": { - "resolved": "incubator/opentelemetry-sampler-aws-xray", - "link": true - }, "node_modules/@opentelemetry/sdk-logs": { "version": "0.200.0", "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-logs/-/sdk-logs-0.200.0.tgz", @@ -48066,114 +47917,6 @@ "@opentelemetry/semantic-conventions": "^1.29.0" } }, - "@opentelemetry/sampler-aws-xray": { - "version": "file:incubator/opentelemetry-sampler-aws-xray", - "requires": { - "@opentelemetry/core": "^1.26.0", - "@opentelemetry/resources": "^1.10.0", - "@opentelemetry/sdk-trace-base": "^1.26.0", - "@opentelemetry/sdk-trace-node": "^1.26.0", - "@types/mocha": "10.0.10", - "@types/node": "18.18.14", - "@types/sinon": "17.0.4", - "@typescript-eslint/eslint-plugin": "5.8.1", - "@typescript-eslint/parser": "5.8.1", - "eslint": "8.7.0", - "expect": "29.2.0", - "nock": "13.3.3", - "nyc": "15.1.0", - "sinon": "15.2.0", - "typescript": "4.4.4" - }, - "dependencies": { - "@opentelemetry/context-async-hooks": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/context-async-hooks/-/context-async-hooks-1.30.1.tgz", - "integrity": "sha512-s5vvxXPVdjqS3kTLKMeBMvop9hbWkwzBpu+mUO2M7sZtlkyDJGwFe33wRKnbaYDo8ExRVBIIdwIGrqpxHuKttA==", - "dev": true, - "requires": {} - }, - "@opentelemetry/core": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.30.1.tgz", - "integrity": "sha512-OOCM2C/QIURhJMuKaekP3TRBxBKxG/TWWA0TL2J6nXUtDnuCtccy49LUJF8xPFXMX+0LMcxFpCo8M9cGY1W6rQ==", - "requires": { - "@opentelemetry/semantic-conventions": "1.28.0" - } - }, - "@opentelemetry/propagator-b3": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-b3/-/propagator-b3-1.30.1.tgz", - "integrity": "sha512-oATwWWDIJzybAZ4pO76ATN5N6FFbOA1otibAVlS8v90B4S1wClnhRUk7K+2CHAwN1JKYuj4jh/lpCEG5BAqFuQ==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.30.1" - } - }, - "@opentelemetry/propagator-jaeger": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-jaeger/-/propagator-jaeger-1.30.1.tgz", - "integrity": "sha512-Pj/BfnYEKIOImirH76M4hDaBSx6HyZ2CXUqk+Kj02m6BB80c/yo4BdWkn/1gDFfU+YPY+bPR2U0DKBfdxCKwmg==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.30.1" - } - }, - "@opentelemetry/resources": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.30.1.tgz", - "integrity": "sha512-5UxZqiAgLYGFjS4s9qm5mBVo433u+dSPUFWVWXmLAD4wB65oMCoXaJP1KJa9DIYYMeHu3z4BZcStG3LC593cWA==", - "requires": { - "@opentelemetry/core": "1.30.1", - "@opentelemetry/semantic-conventions": "1.28.0" - } - }, - "@opentelemetry/sdk-trace-base": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.30.1.tgz", - "integrity": "sha512-jVPgBbH1gCy2Lb7X0AVQ8XAfgg0pJ4nvl8/IiQA6nxOsPvS+0zMJaFSs2ltXe0J6C8dqjcnpyqINDJmU30+uOg==", - "requires": { - "@opentelemetry/core": "1.30.1", - "@opentelemetry/resources": "1.30.1", - "@opentelemetry/semantic-conventions": "1.28.0" - } - }, - "@opentelemetry/sdk-trace-node": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-node/-/sdk-trace-node-1.30.1.tgz", - "integrity": "sha512-cBjYOINt1JxXdpw1e5MlHmFRc5fgj4GW/86vsKFxJCJ8AL4PdVtYH41gWwl4qd4uQjqEL1oJVrXkSy5cnduAnQ==", - "dev": true, - "requires": { - "@opentelemetry/context-async-hooks": "1.30.1", - "@opentelemetry/core": "1.30.1", - "@opentelemetry/propagator-b3": "1.30.1", - "@opentelemetry/propagator-jaeger": "1.30.1", - "@opentelemetry/sdk-trace-base": "1.30.1", - "semver": "^7.5.2" - } - }, - "@opentelemetry/semantic-conventions": { - "version": "1.28.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.28.0.tgz", - "integrity": "sha512-lp4qAiMTD4sNWW4DbKLBkfiMZ4jbAboJIGOQr5DvciMRI494OapieI9qiODpOt0XBr1LjIDy1xAGAnVs5supTA==" - }, - "@types/node": { - "version": "18.18.14", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.14.tgz", - "integrity": "sha512-iSOeNeXYNYNLLOMDSVPvIFojclvMZ/HDY2dU17kUlcsOsSQETbWIslJbYLZgA+ox8g2XQwSHKTkght1a5X26lQ==", - "dev": true, - "requires": { - "undici-types": "~5.26.4" - } - }, - "typescript": { - "version": "4.4.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz", - "integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==", - "dev": true - } - } - }, "@opentelemetry/sdk-logs": { "version": "0.200.0", "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-logs/-/sdk-logs-0.200.0.tgz", diff --git a/package.json b/package.json index 1044995d86..8bcf010575 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,6 @@ "plugins/web/*", "propagators/*", "detectors/node/*", - "metapackages/*", - "incubator/*" + "metapackages/*" ] } diff --git a/release-please-config.json b/release-please-config.json index 94c624df8b..a55d06f9ec 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -13,9 +13,6 @@ "detectors/node/opentelemetry-resource-detector-gcp": {}, "detectors/node/opentelemetry-resource-detector-github": {}, "detectors/node/opentelemetry-resource-detector-instana": {}, - "incubator/opentelemetry-sampler-aws-xray": { - "skip-github-release": true - }, "metapackages/auto-configuration-propagators": {}, "metapackages/auto-instrumentations-node": {}, "metapackages/auto-instrumentations-web": {},