Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(otlp-exporter): move code that will be removed to legacy directory #4449

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
* limitations under the License.
*/

export * from './OTLPMetricExporter';
// Legacy exporter kept for compatibility, scheduled for removal in 2.0
export { OTLPMetricExporter } from './legacy/OTLPMetricExporter';
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
createExportMetricsServiceRequest,
IExportMetricsServiceRequest,
} from '@opentelemetry/otlp-transformer';
import { VERSION } from './version';
import { VERSION } from '../version';

const DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/metrics';
const DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
Expand Down
8 changes: 4 additions & 4 deletions experimental/packages/otlp-exporter-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"browser": {
"./src/platform/index.ts": "./src/platform/browser/index.ts",
"./build/esm/platform/index.js": "./build/esm/platform/browser/index.js",
"./build/esnext/platform/index.js": "./build/esnext/platform/browser/index.js",
"./build/src/platform/index.js": "./build/src/platform/browser/index.js"
"./src/legacy/platform/index.ts": "./src/legacy/platform/browser/index.ts",
"./build/esm/legacy/platform/index.js": "./build/esm/legacy/platform/browser/index.js",
"./build/esnext/legacy/platform/index.js": "./build/esnext/legacy/platform/browser/index.js",
"./build/src/legacy/platform/index.js": "./build/src/legacy/platform/browser/index.js"
},
"scripts": {
"prepublishOnly": "npm run compile",
Expand Down
17 changes: 3 additions & 14 deletions experimental/packages/otlp-exporter-base/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './platform';
export { OTLPExporterBase } from './OTLPExporterBase';
export {
OTLPExporterError,
OTLPExporterConfigBase,
ExportServiceError,
} from './types';
export {
parseHeaders,
appendResourcePathToUrl,
appendRootPathToUrlIfNeeded,
configureExporterTimeout,
invalidTimeout,
} from './util';

// Legacy exports scheduled for removal.
export * from './legacy';
31 changes: 31 additions & 0 deletions experimental/packages/otlp-exporter-base/src/legacy/index.ts
Original file line number Diff line number Diff line change
@@ -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.
*/

// Legacy
export * from './platform';
export { OTLPExporterBase } from './OTLPExporterBase';
export {
OTLPExporterError,
OTLPExporterConfigBase,
ExportServiceError,
} from './types';
export {
parseHeaders,
appendResourcePathToUrl,
appendRootPathToUrlIfNeeded,
configureExporterTimeout,
invalidTimeout,
} from './util';
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/

import * as sinon from 'sinon';
import { sendWithXhr } from '../../src/platform/browser/util';
import { sendWithXhr } from '../../src';
import { nextTick } from 'process';
import { ensureHeadersContain } from '../testHelper';
import { ensureHeadersContain } from '../common/legacy/testHelper';

describe('util - browser', () => {
let server: any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
import { ExportResultCode } from '@opentelemetry/core';
import * as assert from 'assert';
import * as sinon from 'sinon';
import { OTLPExporterBase } from '../../src/OTLPExporterBase';
import { OTLPExporterConfigBase } from '../../src/types';
import { ComplexTestObject, mockedComplexTestObject } from '../testHelper';
import * as otlpTypes from '../../src/types';
import { OTLPExporterBase } from '../../../src';
import { OTLPExporterConfigBase } from '../../../src';
import { ComplexTestObject, mockedComplexTestObject } from './testHelper';
import * as otlpTypes from '../../../src/legacy/types';

interface ExportRequest {
resourceSpans: object[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
appendResourcePathToUrl,
appendRootPathToUrlIfNeeded,
parseRetryAfterToMills,
} from '../../src/util';
} from '../../../src/legacy/util';

describe('utils', () => {
afterEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,19 @@
*/

import * as assert from 'assert';
import { configureExporterTimeout, invalidTimeout } from '../../src/util';
import { sendWithHttp } from '../../src/platform/node/util';
import { CompressionAlgorithm } from '../../src/platform/node/types';
import { configureCompression } from '../../src/platform/node/util';
import {
configureExporterTimeout,
invalidTimeout,
sendWithHttp,
CompressionAlgorithm,
configureCompression,
OTLPExporterNodeBase,
OTLPExporterNodeConfigBase,
OTLPExporterError,
} from '../../../src';
import { diag } from '@opentelemetry/api';
import * as sinon from 'sinon';

import { OTLPExporterNodeBase } from '../../src/platform/node/OTLPExporterNodeBase';
import { OTLPExporterNodeConfigBase } from '../../src/platform/node/types';
import { OTLPExporterError } from '../../src/types';
import { PassThrough } from 'stream';
import * as http from 'http';
import * as zlib from 'zlib';
Expand Down
8 changes: 4 additions & 4 deletions experimental/packages/otlp-proto-exporter-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"browser": {
"./src/platform/index.ts": "./src/platform/browser/index.ts",
"./build/esm/platform/index.js": "./build/esm/platform/browser/index.js",
"./build/esnext/platform/index.js": "./build/esnext/platform/browser/index.js",
"./build/src/platform/index.js": "./build/src/platform/browser/index.js"
"./src/legacy/platform/index.ts": "./src/legacy/platform/browser/index.ts",
"./build/esm/legacy/platform/index.js": "./build/esm/legacy/platform/browser/index.js",
"./build/esnext/legacy/platform/index.js": "./build/esnext/legacy/platform/browser/index.js",
"./build/src/legacy/platform/index.js": "./build/src/legacy/platform/browser/index.js"
},
"scripts": {
"prepublishOnly": "npm run compile",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './platform';
export * from './legacy/platform';
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import * as root from '../generated/root';
import * as root from '../../generated/root';
import { ServiceClientType } from './types';
import type * as protobuf from 'protobufjs';

Expand Down
Loading