diff --git a/experimental/CHANGELOG.md b/experimental/CHANGELOG.md
index a703efc970b..f4be95baa3e 100644
--- a/experimental/CHANGELOG.md
+++ b/experimental/CHANGELOG.md
@@ -14,6 +14,7 @@ All notable changes to experimental packages in this project will be documented
* feat(exporters): update proto version and use otlp-transformer #2929 @pichlermarc
* fix(sdk-metrics-base): misbehaving aggregation temporality selector tolerance #2958 @legendecas
* feat(sdk-metrics-base): async instruments callback timeout #2742 @legendecas
+* feat(otlp-transformer): split otlp-transformer into multiple packages #2968 @pichlermarc
### :bug: (Bug Fix)
diff --git a/experimental/packages/exporter-trace-otlp-grpc/package.json b/experimental/packages/exporter-trace-otlp-grpc/package.json
index fcc3bd3eff3..9f9d634c985 100644
--- a/experimental/packages/exporter-trace-otlp-grpc/package.json
+++ b/experimental/packages/exporter-trace-otlp-grpc/package.json
@@ -61,7 +61,8 @@
"sinon": "12.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "9.0.2",
- "typescript": "4.4.4"
+ "typescript": "4.4.4",
+ "@opentelemetry/otlp-transformer-base": "0.28.0"
},
"peerDependencies": {
"@opentelemetry/api": "^1.0.0"
@@ -70,7 +71,7 @@
"@opentelemetry/core": "1.2.0",
"@grpc/grpc-js": "^1.5.9",
"@grpc/proto-loader": "^0.6.9",
- "@opentelemetry/otlp-transformer": "0.28.0",
+ "@opentelemetry/otlp-transformer-trace": "0.28.0",
"@opentelemetry/otlp-grpc-exporter-base": "0.28.0",
"@opentelemetry/resources": "1.2.0",
"@opentelemetry/sdk-trace-base": "1.2.0"
diff --git a/experimental/packages/exporter-trace-otlp-grpc/src/OTLPTraceExporter.ts b/experimental/packages/exporter-trace-otlp-grpc/src/OTLPTraceExporter.ts
index 5ea0829dc59..03b4b671d65 100644
--- a/experimental/packages/exporter-trace-otlp-grpc/src/OTLPTraceExporter.ts
+++ b/experimental/packages/exporter-trace-otlp-grpc/src/OTLPTraceExporter.ts
@@ -23,7 +23,10 @@ import {
ServiceClientType,
validateAndNormalizeUrl
} from '@opentelemetry/otlp-grpc-exporter-base';
-import { createExportTraceServiceRequest, IExportTraceServiceRequest } from '@opentelemetry/otlp-transformer';
+import {
+ createExportTraceServiceRequest,
+ IExportTraceServiceRequest
+} from '@opentelemetry/otlp-transformer-trace';
const DEFAULT_COLLECTOR_URL = 'localhost:4317';
diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/OTLPTraceExporter.test.ts b/experimental/packages/exporter-trace-otlp-grpc/test/OTLPTraceExporter.test.ts
index 03e8be4c6eb..3897fd87839 100644
--- a/experimental/packages/exporter-trace-otlp-grpc/test/OTLPTraceExporter.test.ts
+++ b/experimental/packages/exporter-trace-otlp-grpc/test/OTLPTraceExporter.test.ts
@@ -37,7 +37,7 @@ import {
import * as core from '@opentelemetry/core';
import { CompressionAlgorithm } from '@opentelemetry/otlp-exporter-base';
import { GrpcCompressionAlgorithm } from '@opentelemetry/otlp-grpc-exporter-base';
-import { IExportTraceServiceRequest, IResourceSpans } from '@opentelemetry/otlp-transformer';
+import { IExportTraceServiceRequest, IResourceSpans } from '@opentelemetry/otlp-transformer-trace';
const traceServiceProtoPath =
'opentelemetry/proto/collector/trace/v1/trace_service.proto';
diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/traceHelper.ts b/experimental/packages/exporter-trace-otlp-grpc/test/traceHelper.ts
index 5b0d0444a19..a5dcde46545 100644
--- a/experimental/packages/exporter-trace-otlp-grpc/test/traceHelper.ts
+++ b/experimental/packages/exporter-trace-otlp-grpc/test/traceHelper.ts
@@ -20,7 +20,9 @@ import { ReadableSpan } from '@opentelemetry/sdk-trace-base';
import * as assert from 'assert';
import * as grpc from '@grpc/grpc-js';
import { VERSION } from '@opentelemetry/core';
-import { IEvent, IKeyValue, ILink, IResource, ISpan } from '@opentelemetry/otlp-transformer';
+import { IKeyValue, IResource } from '@opentelemetry/otlp-transformer-base';
+import { IEvent, ILink, ISpan } from '@opentelemetry/otlp-transformer-trace';
+
const traceIdArr = [
31,
diff --git a/experimental/packages/exporter-trace-otlp-grpc/tsconfig.json b/experimental/packages/exporter-trace-otlp-grpc/tsconfig.json
index 94d47b6e191..e6c274f99b8 100644
--- a/experimental/packages/exporter-trace-otlp-grpc/tsconfig.json
+++ b/experimental/packages/exporter-trace-otlp-grpc/tsconfig.json
@@ -25,7 +25,10 @@
"path": "../otlp-grpc-exporter-base"
},
{
- "path": "../otlp-transformer"
+ "path": "../otlp-transformer-base"
+ },
+ {
+ "path": "../otlp-transformer-trace"
}
]
}
diff --git a/experimental/packages/exporter-trace-otlp-http/package.json b/experimental/packages/exporter-trace-otlp-http/package.json
index f973ae4b43d..f09e909c7b2 100644
--- a/experimental/packages/exporter-trace-otlp-http/package.json
+++ b/experimental/packages/exporter-trace-otlp-http/package.json
@@ -88,7 +88,8 @@
"typescript": "4.4.4",
"webpack": "4.46.0",
"webpack-cli": "4.9.1",
- "webpack-merge": "5.8.0"
+ "webpack-merge": "5.8.0",
+ "@opentelemetry/otlp-transformer-base": "0.28.0"
},
"peerDependencies": {
"@opentelemetry/api": "^1.0.0"
@@ -98,6 +99,6 @@
"@opentelemetry/resources": "1.2.0",
"@opentelemetry/sdk-trace-base": "1.2.0",
"@opentelemetry/otlp-exporter-base": "0.28.0",
- "@opentelemetry/otlp-transformer": "0.28.0"
+ "@opentelemetry/otlp-transformer-trace": "0.28.0"
}
}
diff --git a/experimental/packages/exporter-trace-otlp-http/src/platform/browser/OTLPTraceExporter.ts b/experimental/packages/exporter-trace-otlp-http/src/platform/browser/OTLPTraceExporter.ts
index 21c78e83680..4528c1a16d4 100644
--- a/experimental/packages/exporter-trace-otlp-http/src/platform/browser/OTLPTraceExporter.ts
+++ b/experimental/packages/exporter-trace-otlp-http/src/platform/browser/OTLPTraceExporter.ts
@@ -18,7 +18,10 @@ import { appendResourcePathToUrlIfNotPresent, OTLPExporterBrowserBase } from '@o
import { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base';
import { getEnv, baggageUtils } from '@opentelemetry/core';
import { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';
-import { createExportTraceServiceRequest, IExportTraceServiceRequest } from '@opentelemetry/otlp-transformer';
+import {
+ createExportTraceServiceRequest,
+ IExportTraceServiceRequest
+} from '@opentelemetry/otlp-transformer-trace';
const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/traces';
const DEFAULT_COLLECTOR_URL=`http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
diff --git a/experimental/packages/exporter-trace-otlp-http/src/platform/node/OTLPTraceExporter.ts b/experimental/packages/exporter-trace-otlp-http/src/platform/node/OTLPTraceExporter.ts
index 517148717d1..890691fe0af 100644
--- a/experimental/packages/exporter-trace-otlp-http/src/platform/node/OTLPTraceExporter.ts
+++ b/experimental/packages/exporter-trace-otlp-http/src/platform/node/OTLPTraceExporter.ts
@@ -21,7 +21,10 @@ import {
OTLPExporterNodeConfigBase,
appendResourcePathToUrlIfNotPresent
} from '@opentelemetry/otlp-exporter-base';
-import { createExportTraceServiceRequest, IExportTraceServiceRequest } from '@opentelemetry/otlp-transformer';
+import {
+ createExportTraceServiceRequest,
+ IExportTraceServiceRequest
+} from '@opentelemetry/otlp-transformer-trace';
const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/traces';
const DEFAULT_COLLECTOR_URL = `http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
diff --git a/experimental/packages/exporter-trace-otlp-http/test/browser/CollectorTraceExporter.test.ts b/experimental/packages/exporter-trace-otlp-http/test/browser/CollectorTraceExporter.test.ts
index 7970005c083..0af693645b9 100644
--- a/experimental/packages/exporter-trace-otlp-http/test/browser/CollectorTraceExporter.test.ts
+++ b/experimental/packages/exporter-trace-otlp-http/test/browser/CollectorTraceExporter.test.ts
@@ -29,7 +29,7 @@ import {
mockedReadableSpan,
} from '../traceHelper';
import { OTLPExporterConfigBase, OTLPExporterError } from '@opentelemetry/otlp-exporter-base';
-import { IExportTraceServiceRequest } from '@opentelemetry/otlp-transformer';
+import { IExportTraceServiceRequest } from '@opentelemetry/otlp-transformer-trace';
describe('OTLPTraceExporter - web', () => {
let collectorTraceExporter: OTLPTraceExporter;
diff --git a/experimental/packages/exporter-trace-otlp-http/test/node/CollectorTraceExporter.test.ts b/experimental/packages/exporter-trace-otlp-http/test/node/CollectorTraceExporter.test.ts
index 3e9da9370ea..69baeb21d1a 100644
--- a/experimental/packages/exporter-trace-otlp-http/test/node/CollectorTraceExporter.test.ts
+++ b/experimental/packages/exporter-trace-otlp-http/test/node/CollectorTraceExporter.test.ts
@@ -37,7 +37,7 @@ import {
} from '../traceHelper';
import { nextTick } from 'process';
import { MockedResponse } from './nodeHelpers';
-import { IExportTraceServiceRequest } from '@opentelemetry/otlp-transformer';
+import { IExportTraceServiceRequest } from '@opentelemetry/otlp-transformer-trace';
let fakeRequest: PassThrough;
diff --git a/experimental/packages/exporter-trace-otlp-http/test/traceHelper.ts b/experimental/packages/exporter-trace-otlp-http/test/traceHelper.ts
index e5415fcf6a2..9d4e2408bc5 100644
--- a/experimental/packages/exporter-trace-otlp-http/test/traceHelper.ts
+++ b/experimental/packages/exporter-trace-otlp-http/test/traceHelper.ts
@@ -20,14 +20,10 @@ import { Resource } from '@opentelemetry/resources';
import { ReadableSpan } from '@opentelemetry/sdk-trace-base';
import * as assert from 'assert';
import {
- ESpanKind,
- IEvent,
- IExportTraceServiceRequest,
IKeyValue,
- ILink,
- IResource,
- ISpan
-} from '@opentelemetry/otlp-transformer';
+ IResource
+} from '@opentelemetry/otlp-transformer-base';
+import { ESpanKind, IEvent, IExportTraceServiceRequest, ILink, ISpan } from '@opentelemetry/otlp-transformer-trace';
if (typeof Buffer === 'undefined') {
(window as any).Buffer = {
diff --git a/experimental/packages/exporter-trace-otlp-http/tsconfig.json b/experimental/packages/exporter-trace-otlp-http/tsconfig.json
index 087c804079c..2a34485beab 100644
--- a/experimental/packages/exporter-trace-otlp-http/tsconfig.json
+++ b/experimental/packages/exporter-trace-otlp-http/tsconfig.json
@@ -22,7 +22,10 @@
"path": "../otlp-exporter-base"
},
{
- "path": "../otlp-transformer"
+ "path": "../otlp-transformer-base"
+ },
+ {
+ "path": "../otlp-transformer-trace"
}
]
}
diff --git a/experimental/packages/exporter-trace-otlp-proto/package.json b/experimental/packages/exporter-trace-otlp-proto/package.json
index c0a652e8696..9d0febd110c 100644
--- a/experimental/packages/exporter-trace-otlp-proto/package.json
+++ b/experimental/packages/exporter-trace-otlp-proto/package.json
@@ -60,7 +60,8 @@
"sinon": "12.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "9.0.2",
- "typescript": "4.4.4"
+ "typescript": "4.4.4",
+ "@opentelemetry/otlp-transformer-base": "0.28.0"
},
"peerDependencies": {
"@opentelemetry/api": "^1.0.0"
@@ -73,6 +74,6 @@
"@opentelemetry/otlp-exporter-base": "0.28.0",
"@opentelemetry/otlp-proto-exporter-base": "0.28.0",
"protobufjs": "^6.9.0",
- "@opentelemetry/otlp-transformer": "0.28.0"
+ "@opentelemetry/otlp-transformer-trace": "0.28.0"
}
}
diff --git a/experimental/packages/exporter-trace-otlp-proto/src/OTLPTraceExporter.ts b/experimental/packages/exporter-trace-otlp-proto/src/OTLPTraceExporter.ts
index 9fcc7f5a3fe..f54cf031917 100644
--- a/experimental/packages/exporter-trace-otlp-proto/src/OTLPTraceExporter.ts
+++ b/experimental/packages/exporter-trace-otlp-proto/src/OTLPTraceExporter.ts
@@ -18,7 +18,10 @@ import { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base';
import { getEnv, baggageUtils } from '@opentelemetry/core';
import { appendResourcePathToUrlIfNotPresent, OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base';
import { OTLPProtoExporterNodeBase, ServiceClientType } from '@opentelemetry/otlp-proto-exporter-base';
-import { createExportTraceServiceRequest, IExportTraceServiceRequest } from '@opentelemetry/otlp-transformer';
+import {
+ createExportTraceServiceRequest,
+ IExportTraceServiceRequest
+} from '@opentelemetry/otlp-transformer-trace';
const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/traces';
const DEFAULT_COLLECTOR_URL=`http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
diff --git a/experimental/packages/exporter-trace-otlp-proto/test/OTLPTraceExporter.test.ts b/experimental/packages/exporter-trace-otlp-proto/test/OTLPTraceExporter.test.ts
index e68a02e762b..d1bad46e047 100644
--- a/experimental/packages/exporter-trace-otlp-proto/test/OTLPTraceExporter.test.ts
+++ b/experimental/packages/exporter-trace-otlp-proto/test/OTLPTraceExporter.test.ts
@@ -31,7 +31,7 @@ import {
} from './traceHelper';
import { CompressionAlgorithm, OTLPExporterNodeConfigBase, OTLPExporterError } from '@opentelemetry/otlp-exporter-base';
import { getExportRequestProto } from '@opentelemetry/otlp-proto-exporter-base';
-import { IExportTraceServiceRequest } from '@opentelemetry/otlp-transformer';
+import { IExportTraceServiceRequest } from '@opentelemetry/otlp-transformer-trace';
let fakeRequest: PassThrough;
diff --git a/experimental/packages/exporter-trace-otlp-proto/test/traceHelper.ts b/experimental/packages/exporter-trace-otlp-proto/test/traceHelper.ts
index 10a07654585..63a51d0f368 100644
--- a/experimental/packages/exporter-trace-otlp-proto/test/traceHelper.ts
+++ b/experimental/packages/exporter-trace-otlp-proto/test/traceHelper.ts
@@ -20,7 +20,13 @@ import { Resource } from '@opentelemetry/resources';
import { ReadableSpan } from '@opentelemetry/sdk-trace-base';
import * as assert from 'assert';
import { Stream } from 'stream';
-import { IEvent, IExportTraceServiceRequest, IKeyValue, ILink, ISpan } from '@opentelemetry/otlp-transformer';
+import { IKeyValue } from '@opentelemetry/otlp-transformer-base';
+import {
+ IEvent,
+ IExportTraceServiceRequest,
+ ILink,
+ ISpan
+} from '@opentelemetry/otlp-transformer-trace';
const traceIdHex = '1f1008dc8e270e85c40a0d7c3939b278';
const spanIdHex = '5e107261f64fa53e';
diff --git a/experimental/packages/exporter-trace-otlp-proto/tsconfig.json b/experimental/packages/exporter-trace-otlp-proto/tsconfig.json
index 3324a8a5298..b29e78fe157 100644
--- a/experimental/packages/exporter-trace-otlp-proto/tsconfig.json
+++ b/experimental/packages/exporter-trace-otlp-proto/tsconfig.json
@@ -25,7 +25,10 @@
"path": "../otlp-proto-exporter-base"
},
{
- "path": "../otlp-transformer"
+ "path": "../otlp-transformer-base"
+ },
+ {
+ "path": "../otlp-transformer-trace"
}
]
}
diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json
index 0b143e0cf1d..499107bb56d 100644
--- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json
+++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json
@@ -61,7 +61,8 @@
"sinon": "12.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "9.0.2",
- "typescript": "4.4.4"
+ "typescript": "4.4.4",
+ "@opentelemetry/otlp-transformer-base": "0.28.0"
},
"peerDependencies": {
"@opentelemetry/api": "^1.0.0"
@@ -72,7 +73,7 @@
"@opentelemetry/core": "1.2.0",
"@opentelemetry/exporter-metrics-otlp-http": "0.28.0",
"@opentelemetry/otlp-grpc-exporter-base": "0.28.0",
- "@opentelemetry/otlp-transformer": "0.28.0",
+ "@opentelemetry/otlp-transformer-metrics": "0.28.0",
"@opentelemetry/resources": "1.2.0",
"@opentelemetry/sdk-metrics-base": "0.28.0"
}
diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/src/OTLPMetricExporter.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/src/OTLPMetricExporter.ts
index f7f45114be6..f9ff023c43f 100644
--- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/src/OTLPMetricExporter.ts
+++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/src/OTLPMetricExporter.ts
@@ -28,7 +28,7 @@ import {
} from '@opentelemetry/otlp-grpc-exporter-base';
import { baggageUtils, getEnv } from '@opentelemetry/core';
import { Metadata } from '@grpc/grpc-js';
-import { createExportMetricsServiceRequest, IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';
+import { createExportMetricsServiceRequest, IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer-metrics';
const DEFAULT_COLLECTOR_URL = 'localhost:4317';
diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/OTLPMetricExporter.test.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/OTLPMetricExporter.test.ts
index b03a6124365..f86d1c99ddc 100644
--- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/OTLPMetricExporter.test.ts
+++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/OTLPMetricExporter.test.ts
@@ -34,7 +34,7 @@ import {
mockObservableGauge, setUp, shutdown,
} from './metricsHelper';
import { AggregationTemporality, ResourceMetrics } from '@opentelemetry/sdk-metrics-base';
-import { IExportMetricsServiceRequest, IResourceMetrics } from '@opentelemetry/otlp-transformer';
+import { IExportMetricsServiceRequest, IResourceMetrics } from '@opentelemetry/otlp-transformer-metrics';
const metricsServiceProtoPath =
'opentelemetry/proto/collector/metrics/v1/metrics_service.proto';
diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/metricsHelper.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/metricsHelper.ts
index 54bd6ee553d..dfe2e88f6e4 100644
--- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/metricsHelper.ts
+++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/metricsHelper.ts
@@ -25,7 +25,8 @@ import {
MeterProvider,
MetricReader,
} from '@opentelemetry/sdk-metrics-base';
-import { IKeyValue, IMetric, IResource } from '@opentelemetry/otlp-transformer';
+import { IKeyValue, IResource } from '@opentelemetry/otlp-transformer-base';
+import { IMetric } from '@opentelemetry/otlp-transformer-metrics';
class TestMetricReader extends MetricReader {
selectAggregationTemporality() {
diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/tsconfig.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/tsconfig.json
index 77f463edd10..15b218133fd 100644
--- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/tsconfig.json
+++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/tsconfig.json
@@ -28,7 +28,10 @@
"path": "../otlp-grpc-exporter-base"
},
{
- "path": "../otlp-transformer"
+ "path": "../otlp-transformer-base"
+ },
+ {
+ "path": "../otlp-transformer-metrics"
}
]
}
diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json
index fa25fe07078..8170aa6a68c 100644
--- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json
+++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json
@@ -88,7 +88,8 @@
"typescript": "4.4.4",
"webpack": "4.46.0",
"webpack-cli": "4.9.1",
- "webpack-merge": "5.8.0"
+ "webpack-merge": "5.8.0",
+ "@opentelemetry/otlp-transformer-base": "0.28.0"
},
"peerDependencies": {
"@opentelemetry/api": "^1.0.0"
@@ -96,7 +97,7 @@
"dependencies": {
"@opentelemetry/api-metrics": "0.28.0",
"@opentelemetry/core": "1.2.0",
- "@opentelemetry/otlp-transformer": "0.28.0",
+ "@opentelemetry/otlp-transformer-metrics": "0.28.0",
"@opentelemetry/otlp-exporter-base": "0.28.0",
"@opentelemetry/resources": "1.2.0",
"@opentelemetry/sdk-metrics-base": "0.28.0"
diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterBase.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterBase.ts
index 059d44eeca6..f58ec0e7008 100644
--- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterBase.ts
+++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterBase.ts
@@ -24,7 +24,7 @@ import {
} from '@opentelemetry/sdk-metrics-base';
import { defaultOptions, OTLPMetricExporterOptions } from './OTLPMetricExporterOptions';
import { OTLPExporterBase } from '@opentelemetry/otlp-exporter-base';
-import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';
+import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer-metrics';
export const CumulativeTemporalitySelector: AggregationTemporalitySelector = () => AggregationTemporality.CUMULATIVE;
diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/browser/OTLPMetricExporter.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/browser/OTLPMetricExporter.ts
index 16dfd998bf9..cdc5595bbde 100644
--- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/browser/OTLPMetricExporter.ts
+++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/browser/OTLPMetricExporter.ts
@@ -23,7 +23,10 @@ import {
OTLPExporterBrowserBase,
OTLPExporterConfigBase
} from '@opentelemetry/otlp-exporter-base';
-import { createExportMetricsServiceRequest, IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';
+import {
+ createExportMetricsServiceRequest,
+ IExportMetricsServiceRequest
+} from '@opentelemetry/otlp-transformer-metrics';
const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics';
const DEFAULT_COLLECTOR_URL = `http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/node/OTLPMetricExporter.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/node/OTLPMetricExporter.ts
index 10de31aa532..b1e217f0ac1 100644
--- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/node/OTLPMetricExporter.ts
+++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/node/OTLPMetricExporter.ts
@@ -15,7 +15,7 @@
*/
import { ResourceMetrics } from '@opentelemetry/sdk-metrics-base';
-import { getEnv, baggageUtils} from '@opentelemetry/core';
+import { getEnv, baggageUtils } from '@opentelemetry/core';
import { defaultOptions, OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions';
import { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase';
import {
@@ -23,7 +23,10 @@ import {
OTLPExporterNodeBase,
OTLPExporterNodeConfigBase
} from '@opentelemetry/otlp-exporter-base';
-import { createExportMetricsServiceRequest, IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';
+import {
+ createExportMetricsServiceRequest,
+ IExportMetricsServiceRequest
+} from '@opentelemetry/otlp-transformer-metrics';
const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics';
const DEFAULT_COLLECTOR_URL = `http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/browser/CollectorMetricExporter.test.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/browser/CollectorMetricExporter.test.ts
index 18deb1e16d5..ee447a8bece 100644
--- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/browser/CollectorMetricExporter.test.ts
+++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/browser/CollectorMetricExporter.test.ts
@@ -36,7 +36,7 @@ import {
} from '../metricsHelper';
import { OTLPMetricExporterOptions } from '../../src';
import { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';
-import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';
+import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer-metrics';
describe('OTLPMetricExporter - web', () => {
let collectorExporter: OTLPMetricExporter;
diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/common/CollectorMetricExporter.test.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/common/CollectorMetricExporter.test.ts
index a7ff5413327..4eaa53bceb7 100644
--- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/common/CollectorMetricExporter.test.ts
+++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/common/CollectorMetricExporter.test.ts
@@ -22,7 +22,7 @@ import * as assert from 'assert';
import * as sinon from 'sinon';
import { collect, mockCounter, mockObservableGauge, setUp, shutdown } from '../metricsHelper';
import { OTLPExporterBase, OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';
-import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';
+import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer-metrics';
type CollectorExporterConfig = OTLPExporterConfigBase;
class OTLPMetricExporter extends OTLPExporterBase<
diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/metricsHelper.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/metricsHelper.ts
index 9b801c51a4f..92ff7a0f95e 100644
--- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/metricsHelper.ts
+++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/metricsHelper.ts
@@ -30,11 +30,10 @@ import {
MetricReader
} from '@opentelemetry/sdk-metrics-base';
import {
- IExportMetricsServiceRequest,
IKeyValue,
- IMetric,
IResource
-} from '@opentelemetry/otlp-transformer';
+} from '@opentelemetry/otlp-transformer-base';
+import { IExportMetricsServiceRequest, IMetric } from '@opentelemetry/otlp-transformer-metrics';
if (typeof Buffer === 'undefined') {
(window as any).Buffer = {
diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/node/CollectorMetricExporter.test.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/node/CollectorMetricExporter.test.ts
index a9076abafb7..d60cf7a9fd8 100644
--- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/node/CollectorMetricExporter.test.ts
+++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/node/CollectorMetricExporter.test.ts
@@ -41,7 +41,7 @@ import { MockedResponse } from './nodeHelpers';
import { AggregationTemporality, ResourceMetrics } from '@opentelemetry/sdk-metrics-base';
import { Stream, PassThrough } from 'stream';
import { OTLPExporterError, OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base';
-import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';
+import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer-metrics';
let fakeRequest: PassThrough;
diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/tsconfig.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/tsconfig.json
index 69019ed4090..41060ece178 100644
--- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/tsconfig.json
+++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/tsconfig.json
@@ -25,7 +25,10 @@
"path": "../otlp-exporter-base"
},
{
- "path": "../otlp-transformer"
+ "path": "../otlp-transformer-base"
+ },
+ {
+ "path": "../otlp-transformer-metrics"
}
]
}
diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json
index dafcc23c943..b125b5c4ad9 100644
--- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json
+++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json
@@ -61,7 +61,8 @@
"sinon": "12.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "9.0.2",
- "typescript": "4.4.4"
+ "typescript": "4.4.4",
+ "@opentelemetry/otlp-transformer-base": "0.28.0"
},
"peerDependencies": {
"@opentelemetry/api": "^1.0.0"
@@ -72,7 +73,7 @@
"@opentelemetry/exporter-metrics-otlp-http": "0.28.0",
"@opentelemetry/otlp-proto-exporter-base": "0.28.0",
"@opentelemetry/otlp-exporter-base": "0.28.0",
- "@opentelemetry/otlp-transformer": "0.28.0",
+ "@opentelemetry/otlp-transformer-metrics": "0.28.0",
"@opentelemetry/resources": "1.2.0",
"@opentelemetry/sdk-metrics-base": "0.28.0",
"protobufjs": "^6.9.0"
diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/src/OTLPMetricExporter.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/src/OTLPMetricExporter.ts
index ffcbede0418..a1476a309a5 100644
--- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/src/OTLPMetricExporter.ts
+++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/src/OTLPMetricExporter.ts
@@ -22,7 +22,7 @@ import { getEnv, baggageUtils} from '@opentelemetry/core';
import { ResourceMetrics} from '@opentelemetry/sdk-metrics-base';
import { OTLPMetricExporterBase } from '@opentelemetry/exporter-metrics-otlp-http';
import { appendResourcePathToUrlIfNotPresent, OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base';
-import { createExportMetricsServiceRequest, IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';
+import { createExportMetricsServiceRequest, IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer-metrics';
const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics';
const DEFAULT_COLLECTOR_URL = `http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/OTLPMetricExporter.test.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/OTLPMetricExporter.test.ts
index 086c829ae1d..bf591320a04 100644
--- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/OTLPMetricExporter.test.ts
+++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/OTLPMetricExporter.test.ts
@@ -36,7 +36,7 @@ import { AggregationTemporality, ResourceMetrics } from '@opentelemetry/sdk-metr
import { OTLPMetricExporterOptions } from '@opentelemetry/exporter-metrics-otlp-http';
import { Stream, PassThrough } from 'stream';
import { OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base';
-import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';
+import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer-metrics';
let fakeRequest: PassThrough;
diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/metricsHelper.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/metricsHelper.ts
index 80d38bd1641..19e96017882 100644
--- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/metricsHelper.ts
+++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/metricsHelper.ts
@@ -28,8 +28,9 @@ import {
MeterProvider,
MetricReader
} from '@opentelemetry/sdk-metrics-base';
-import { IExportMetricsServiceRequest, IKeyValue, IMetric } from '@opentelemetry/otlp-transformer';
+import { IKeyValue } from '@opentelemetry/otlp-transformer-base';
import { Stream } from 'stream';
+import { IExportMetricsServiceRequest, IMetric } from '@opentelemetry/otlp-transformer-metrics';
export class TestMetricReader extends MetricReader {
selectAggregationTemporality() {
diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/tsconfig.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/tsconfig.json
index 1023f08037d..8564aea34a6 100644
--- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/tsconfig.json
+++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/tsconfig.json
@@ -31,7 +31,10 @@
"path": "../otlp-proto-exporter-base"
},
{
- "path": "../otlp-transformer"
+ "path": "../otlp-transformer-base"
+ },
+ {
+ "path": "../otlp-transformer-metrics"
}
]
}
diff --git a/experimental/packages/otlp-grpc-exporter-base/package.json b/experimental/packages/otlp-grpc-exporter-base/package.json
index 26486d265c3..f0137735b5e 100644
--- a/experimental/packages/otlp-grpc-exporter-base/package.json
+++ b/experimental/packages/otlp-grpc-exporter-base/package.json
@@ -64,7 +64,8 @@
"ts-mocha": "9.0.2",
"typescript": "4.4.4",
"@opentelemetry/sdk-trace-base": "1.2.0",
- "@opentelemetry/otlp-transformer": "0.28.0",
+ "@opentelemetry/otlp-transformer-trace": "0.28.0",
+ "@opentelemetry/otlp-transformer-base": "0.28.0",
"@opentelemetry/resources": "1.2.0"
},
"peerDependencies": {
diff --git a/experimental/packages/otlp-grpc-exporter-base/test/traceHelper.ts b/experimental/packages/otlp-grpc-exporter-base/test/traceHelper.ts
index e8b0204d616..56c9ec22e6d 100644
--- a/experimental/packages/otlp-grpc-exporter-base/test/traceHelper.ts
+++ b/experimental/packages/otlp-grpc-exporter-base/test/traceHelper.ts
@@ -20,7 +20,8 @@ import { ReadableSpan } from '@opentelemetry/sdk-trace-base';
import * as assert from 'assert';
import * as grpc from '@grpc/grpc-js';
import { VERSION } from '@opentelemetry/core';
-import { IEvent, IKeyValue, ILink, IResource, ISpan } from '@opentelemetry/otlp-transformer';
+import { IKeyValue, IResource } from '@opentelemetry/otlp-transformer-base';
+import { IEvent, ILink, ISpan } from '@opentelemetry/otlp-transformer-trace';
const traceIdArr = [
31,
diff --git a/experimental/packages/otlp-grpc-exporter-base/tsconfig.json b/experimental/packages/otlp-grpc-exporter-base/tsconfig.json
index 087c804079c..2a34485beab 100644
--- a/experimental/packages/otlp-grpc-exporter-base/tsconfig.json
+++ b/experimental/packages/otlp-grpc-exporter-base/tsconfig.json
@@ -22,7 +22,10 @@
"path": "../otlp-exporter-base"
},
{
- "path": "../otlp-transformer"
+ "path": "../otlp-transformer-base"
+ },
+ {
+ "path": "../otlp-transformer-trace"
}
]
}
diff --git a/experimental/packages/otlp-transformer/.eslintignore b/experimental/packages/otlp-transformer-base/.eslintignore
similarity index 100%
rename from experimental/packages/otlp-transformer/.eslintignore
rename to experimental/packages/otlp-transformer-base/.eslintignore
diff --git a/experimental/packages/otlp-transformer/.eslintrc.js b/experimental/packages/otlp-transformer-base/.eslintrc.js
similarity index 100%
rename from experimental/packages/otlp-transformer/.eslintrc.js
rename to experimental/packages/otlp-transformer-base/.eslintrc.js
diff --git a/experimental/packages/otlp-transformer/.gitignore b/experimental/packages/otlp-transformer-base/.gitignore
similarity index 100%
rename from experimental/packages/otlp-transformer/.gitignore
rename to experimental/packages/otlp-transformer-base/.gitignore
diff --git a/experimental/packages/otlp-transformer-base/README.md b/experimental/packages/otlp-transformer-base/README.md
new file mode 100644
index 00000000000..c8eb39a70ee
--- /dev/null
+++ b/experimental/packages/otlp-transformer-base/README.md
@@ -0,0 +1,44 @@
+# OpenTelemetry Protocol
+
+[![NPM Published Version][npm-img]][npm-url]
+[![Apache License][license-image]][license-image]
+
+**NOTE: This package is intended for internal use only.**
+
+This package provides everything needed to serialize [OpenTelemetry SDK][sdk] structures that are shared between signals
+to [OpenTelemetry Protocol][otlp] format using [protocol buffers][protobuf] or JSON.
+
+## Quick Start
+
+To get started you will need to install a compatible OpenTelemetry API.
+
+### Install Peer Dependencies
+
+```sh
+npm install @opentelemetry/api
+ ```
+
+## Useful links
+
+- For more information on OpenTelemetry, visit:
+- For more about OpenTelemetry JavaScript:
+- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]
+
+## License
+
+Apache 2.0 - See [LICENSE][license-url] for more information.
+
+[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
+[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/LICENSE
+[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
+[npm-url]: https://www.npmjs.com/package/@opentelemetry/otlp-transformer
+[npm-img]: https://badge.fury.io/js/%40opentelemetry%otlp-transformer.svg
+
+[sdk]: https://github.com/open-telemetry/opentelemetry-js
+[otlp]: https://github.com/open-telemetry/opentelemetry-proto
+
+[protobuf]: https://developers.google.com/protocol-buffers
+[grpc]: https://grpc.io/
+
+[protobufjs]: https://www.npmjs.com/package/protobufjs
+[grpc-js]: https://www.npmjs.com/package/@grpc/grpc-js
diff --git a/experimental/packages/otlp-transformer/karma.conf.js b/experimental/packages/otlp-transformer-base/karma.conf.js
similarity index 100%
rename from experimental/packages/otlp-transformer/karma.conf.js
rename to experimental/packages/otlp-transformer-base/karma.conf.js
diff --git a/experimental/packages/otlp-transformer-base/package.json b/experimental/packages/otlp-transformer-base/package.json
new file mode 100644
index 00000000000..f0ca2dce9ce
--- /dev/null
+++ b/experimental/packages/otlp-transformer-base/package.json
@@ -0,0 +1,77 @@
+{
+ "name": "@opentelemetry/otlp-transformer-base",
+ "private": false,
+ "publishConfig": {
+ "access": "public"
+ },
+ "version": "0.28.0",
+ "description": "Transform OpenTelemetry SDK data into OTLP",
+ "module": "build/esm/index.js",
+ "esnext": "build/esnext/index.js",
+ "types": "build/src/index.d.ts",
+ "main": "build/src/index.js",
+ "repository": "open-telemetry/opentelemetry-js",
+ "scripts": {
+ "compile": "tsc --build tsconfig.all.json",
+ "clean": "tsc --build --clean tsconfig.all.json",
+ "lint": "eslint . --ext .ts",
+ "lint:fix": "eslint . --ext .ts --fix",
+ "tdd": "npm run test -- --watch-extensions ts --watch",
+ "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
+ "test:browser": "nyc karma start --single-run",
+ "watch": "tsc --build -w tsconfig.all.json",
+ "peer-api-check": "node ../../../scripts/peer-api-check.js",
+ "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../"
+ },
+ "keywords": [
+ "opentelemetry",
+ "nodejs",
+ "grpc",
+ "protobuf",
+ "otlp",
+ "tracing",
+ "metrics"
+ ],
+ "author": "OpenTelemetry Authors",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=8.12.0"
+ },
+ "files": [
+ "build/esm/**/*.js",
+ "build/esm/**/*.js.map",
+ "build/esm/**/*.d.ts",
+ "build/esnext/**/*.js",
+ "build/esnext/**/*.js.map",
+ "build/esnext/**/*.d.ts",
+ "build/src/**/*.js",
+ "build/src/**/*.js.map",
+ "build/src/**/*.d.ts",
+ "LICENSE",
+ "README.md"
+ ],
+ "peerDependencies": {
+ "@opentelemetry/api": ">=1.0.0 <1.2.0"
+ },
+ "devDependencies": {
+ "@opentelemetry/api": ">=1.0.0 <1.2.0",
+ "@types/mocha": "8.2.3",
+ "@types/webpack-env": "1.16.3",
+ "codecov": "3.8.3",
+ "istanbul-instrumenter-loader": "3.0.1",
+ "karma": "6.3.16",
+ "karma-chrome-launcher": "3.1.0",
+ "karma-coverage-istanbul-reporter": "3.0.3",
+ "karma-mocha": "2.0.1",
+ "karma-spec-reporter": "0.0.32",
+ "karma-webpack": "4.0.2",
+ "mkdirp": "1.0.4",
+ "mocha": "7.2.0",
+ "nyc": "15.1.0",
+ "rimraf": "3.0.2",
+ "ts-loader": "8.3.0",
+ "ts-mocha": "9.0.2",
+ "typescript": "4.4.4",
+ "webpack": "4.46.0"
+ }
+}
diff --git a/experimental/packages/otlp-transformer-base/src/common/index.ts b/experimental/packages/otlp-transformer-base/src/common/index.ts
new file mode 100644
index 00000000000..01d50cd92b2
--- /dev/null
+++ b/experimental/packages/otlp-transformer-base/src/common/index.ts
@@ -0,0 +1,24 @@
+/*
+ * 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 { SpanAttributes } from '@opentelemetry/api';
+import { IKeyValue } from './types';
+import { toKeyValue } from './internal';
+
+export function toAttributes(
+ attributes: SpanAttributes
+): IKeyValue[] {
+ return Object.keys(attributes).map(key => toKeyValue(key, attributes[key]));
+}
diff --git a/experimental/packages/otlp-transformer/src/common/internal.ts b/experimental/packages/otlp-transformer-base/src/common/internal.ts
similarity index 89%
rename from experimental/packages/otlp-transformer/src/common/internal.ts
rename to experimental/packages/otlp-transformer-base/src/common/internal.ts
index 7221f4dce68..517642ae845 100644
--- a/experimental/packages/otlp-transformer/src/common/internal.ts
+++ b/experimental/packages/otlp-transformer-base/src/common/internal.ts
@@ -13,15 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import type { SpanAttributes } from '@opentelemetry/api';
import { IAnyValue, IKeyValue } from './types';
-export function toAttributes(
- attributes: SpanAttributes
-): IKeyValue[] {
- return Object.keys(attributes).map(key => toKeyValue(key, attributes[key]));
-}
-
export function toKeyValue(
key: string,
value: unknown
diff --git a/experimental/packages/otlp-transformer/src/common/types.ts b/experimental/packages/otlp-transformer-base/src/common/types.ts
similarity index 100%
rename from experimental/packages/otlp-transformer/src/common/types.ts
rename to experimental/packages/otlp-transformer-base/src/common/types.ts
diff --git a/experimental/packages/otlp-transformer-base/src/index.ts b/experimental/packages/otlp-transformer-base/src/index.ts
new file mode 100644
index 00000000000..118e63520a3
--- /dev/null
+++ b/experimental/packages/otlp-transformer-base/src/index.ts
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+export * from './common/types';
+export * from './resource/types';
+
+export { toAttributes } from './common';
diff --git a/experimental/packages/otlp-transformer/src/resource/types.ts b/experimental/packages/otlp-transformer-base/src/resource/types.ts
similarity index 100%
rename from experimental/packages/otlp-transformer/src/resource/types.ts
rename to experimental/packages/otlp-transformer-base/src/resource/types.ts
diff --git a/experimental/packages/otlp-transformer/test/common.test.ts b/experimental/packages/otlp-transformer-base/test/common.test.ts
similarity index 100%
rename from experimental/packages/otlp-transformer/test/common.test.ts
rename to experimental/packages/otlp-transformer-base/test/common.test.ts
diff --git a/experimental/packages/otlp-transformer/test/index-webpack.ts b/experimental/packages/otlp-transformer-base/test/index-webpack.ts
similarity index 100%
rename from experimental/packages/otlp-transformer/test/index-webpack.ts
rename to experimental/packages/otlp-transformer-base/test/index-webpack.ts
diff --git a/experimental/packages/otlp-transformer/tsconfig.all.json b/experimental/packages/otlp-transformer-base/tsconfig.all.json
similarity index 100%
rename from experimental/packages/otlp-transformer/tsconfig.all.json
rename to experimental/packages/otlp-transformer-base/tsconfig.all.json
diff --git a/experimental/packages/otlp-transformer/tsconfig.esm.json b/experimental/packages/otlp-transformer-base/tsconfig.esm.json
similarity index 100%
rename from experimental/packages/otlp-transformer/tsconfig.esm.json
rename to experimental/packages/otlp-transformer-base/tsconfig.esm.json
diff --git a/experimental/packages/otlp-transformer/tsconfig.esnext.json b/experimental/packages/otlp-transformer-base/tsconfig.esnext.json
similarity index 100%
rename from experimental/packages/otlp-transformer/tsconfig.esnext.json
rename to experimental/packages/otlp-transformer-base/tsconfig.esnext.json
diff --git a/experimental/packages/otlp-transformer-base/tsconfig.json b/experimental/packages/otlp-transformer-base/tsconfig.json
new file mode 100644
index 00000000000..ed9d0830bdd
--- /dev/null
+++ b/experimental/packages/otlp-transformer-base/tsconfig.json
@@ -0,0 +1,11 @@
+{
+ "extends": "../../../tsconfig.base.json",
+ "compilerOptions": {
+ "rootDir": ".",
+ "outDir": "build"
+ },
+ "include": [
+ "src/**/*.ts",
+ "test/**/*.ts"
+ ]
+}
diff --git a/experimental/packages/otlp-transformer-metrics/.eslintignore b/experimental/packages/otlp-transformer-metrics/.eslintignore
new file mode 100644
index 00000000000..345f1a599ed
--- /dev/null
+++ b/experimental/packages/otlp-transformer-metrics/.eslintignore
@@ -0,0 +1,2 @@
+build
+src/generated
diff --git a/experimental/packages/otlp-transformer-metrics/.eslintrc.js b/experimental/packages/otlp-transformer-metrics/.eslintrc.js
new file mode 100644
index 00000000000..b9004d20258
--- /dev/null
+++ b/experimental/packages/otlp-transformer-metrics/.eslintrc.js
@@ -0,0 +1,8 @@
+module.exports = {
+ "env": {
+ "mocha": true,
+ "commonjs": true,
+ "shared-node-browser": true
+ },
+ ...require('../../../eslint.config.js')
+}
diff --git a/experimental/packages/otlp-transformer-metrics/.gitignore b/experimental/packages/otlp-transformer-metrics/.gitignore
new file mode 100644
index 00000000000..c83f90a2b01
--- /dev/null
+++ b/experimental/packages/otlp-transformer-metrics/.gitignore
@@ -0,0 +1 @@
+src/generated
diff --git a/experimental/packages/otlp-transformer-metrics/README.md b/experimental/packages/otlp-transformer-metrics/README.md
new file mode 100644
index 00000000000..27ea6d33fe3
--- /dev/null
+++ b/experimental/packages/otlp-transformer-metrics/README.md
@@ -0,0 +1,40 @@
+# OpenTelemetry Protocol
+
+[![NPM Published Version][npm-img]][npm-url]
+[![Apache License][license-image]][license-image]
+
+**NOTE: This package is intended for internal use only.**
+
+This package provides everything needed to serialize [OpenTelemetry SDK][sdk] metrics to [OpenTelemetry Protocol][otlp]
+format using [protocol buffers][protobuf] or JSON.
+
+## Quick Start
+
+To get started you will need to install a compatible OpenTelemetry API.
+
+### Install Peer Dependencies
+
+```sh
+npm install @opentelemetry/api
+ ```
+
+## Useful links
+
+- For more information on OpenTelemetry, visit:
+- For more about OpenTelemetry JavaScript:
+- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]
+
+## License
+
+Apache 2.0 - See [LICENSE][license-url] for more information.
+
+[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
+[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/LICENSE
+[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
+[npm-url]: https://www.npmjs.com/package/@opentelemetry/otlp-transformer
+[npm-img]: https://badge.fury.io/js/%40opentelemetry%otlp-transformer.svg
+
+[sdk]: https://github.com/open-telemetry/opentelemetry-js
+[otlp]: https://github.com/open-telemetry/opentelemetry-proto
+
+[protobuf]: https://developers.google.com/protocol-buffers
diff --git a/experimental/packages/otlp-transformer-metrics/karma.conf.js b/experimental/packages/otlp-transformer-metrics/karma.conf.js
new file mode 100644
index 00000000000..6174839d651
--- /dev/null
+++ b/experimental/packages/otlp-transformer-metrics/karma.conf.js
@@ -0,0 +1,24 @@
+/*!
+ * 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
+ *
+ * http://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.
+ */
+
+const karmaWebpackConfig = require('../../../karma.webpack');
+const karmaBaseConfig = require('../../../karma.base');
+
+module.exports = (config) => {
+ config.set(Object.assign({}, karmaBaseConfig, {
+ webpack: karmaWebpackConfig
+ }))
+};
diff --git a/experimental/packages/otlp-transformer-metrics/package.json b/experimental/packages/otlp-transformer-metrics/package.json
new file mode 100644
index 00000000000..4da97781cf7
--- /dev/null
+++ b/experimental/packages/otlp-transformer-metrics/package.json
@@ -0,0 +1,83 @@
+{
+ "name": "@opentelemetry/otlp-transformer-metrics",
+ "private": false,
+ "publishConfig": {
+ "access": "public"
+ },
+ "version": "0.28.0",
+ "description": "Transform OpenTelemetry Metrics SDK data into OTLP",
+ "module": "build/esm/index.js",
+ "esnext": "build/esnext/index.js",
+ "types": "build/src/index.d.ts",
+ "main": "build/src/index.js",
+ "repository": "open-telemetry/opentelemetry-js",
+ "scripts": {
+ "compile": "tsc --build tsconfig.all.json",
+ "clean": "tsc --build --clean tsconfig.all.json",
+ "lint": "eslint . --ext .ts",
+ "lint:fix": "eslint . --ext .ts --fix",
+ "tdd": "npm run test -- --watch-extensions ts --watch",
+ "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
+ "test:browser": "nyc karma start --single-run",
+ "watch": "tsc --build -w tsconfig.all.json",
+ "peer-api-check": "node ../../../scripts/peer-api-check.js",
+ "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../"
+ },
+ "keywords": [
+ "opentelemetry",
+ "nodejs",
+ "grpc",
+ "protobuf",
+ "otlp",
+ "tracing",
+ "metrics"
+ ],
+ "author": "OpenTelemetry Authors",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=8.12.0"
+ },
+ "files": [
+ "build/esm/**/*.js",
+ "build/esm/**/*.js.map",
+ "build/esm/**/*.d.ts",
+ "build/esnext/**/*.js",
+ "build/esnext/**/*.js.map",
+ "build/esnext/**/*.d.ts",
+ "build/src/**/*.js",
+ "build/src/**/*.js.map",
+ "build/src/**/*.d.ts",
+ "LICENSE",
+ "README.md"
+ ],
+ "peerDependencies": {
+ "@opentelemetry/api": ">=1.0.0 <1.2.0"
+ },
+ "devDependencies": {
+ "@opentelemetry/api": ">=1.0.0 <1.2.0",
+ "@types/mocha": "8.2.3",
+ "@types/webpack-env": "1.16.3",
+ "codecov": "3.8.3",
+ "istanbul-instrumenter-loader": "3.0.1",
+ "karma": "6.3.16",
+ "karma-chrome-launcher": "3.1.0",
+ "karma-coverage-istanbul-reporter": "3.0.3",
+ "karma-mocha": "2.0.1",
+ "karma-spec-reporter": "0.0.32",
+ "karma-webpack": "4.0.2",
+ "mkdirp": "1.0.4",
+ "mocha": "7.2.0",
+ "nyc": "15.1.0",
+ "rimraf": "3.0.2",
+ "ts-loader": "8.3.0",
+ "ts-mocha": "9.0.2",
+ "typescript": "4.4.4",
+ "webpack": "4.46.0"
+ },
+ "dependencies": {
+ "@opentelemetry/api-metrics": "0.28.0",
+ "@opentelemetry/core": "1.2.0",
+ "@opentelemetry/sdk-metrics-base": "0.28.0",
+ "@opentelemetry/otlp-transformer-base": "0.28.0"
+ }
+}
diff --git a/experimental/packages/otlp-transformer/src/index.ts b/experimental/packages/otlp-transformer-metrics/src/index.ts
similarity index 81%
rename from experimental/packages/otlp-transformer/src/index.ts
rename to experimental/packages/otlp-transformer-metrics/src/index.ts
index 51408c10d87..4b5f599bbed 100644
--- a/experimental/packages/otlp-transformer/src/index.ts
+++ b/experimental/packages/otlp-transformer-metrics/src/index.ts
@@ -14,10 +14,6 @@
* limitations under the License.
*/
-export * from './common/types';
export * from './metrics/types';
-export * from './resource/types';
-export * from './trace/types';
-export { createExportTraceServiceRequest } from './trace';
export { createExportMetricsServiceRequest } from './metrics';
diff --git a/experimental/packages/otlp-transformer/src/metrics/index.ts b/experimental/packages/otlp-transformer-metrics/src/metrics/index.ts
similarity index 100%
rename from experimental/packages/otlp-transformer/src/metrics/index.ts
rename to experimental/packages/otlp-transformer-metrics/src/metrics/index.ts
diff --git a/experimental/packages/otlp-transformer/src/metrics/internal.ts b/experimental/packages/otlp-transformer-metrics/src/metrics/internal.ts
similarity index 97%
rename from experimental/packages/otlp-transformer/src/metrics/internal.ts
rename to experimental/packages/otlp-transformer-metrics/src/metrics/internal.ts
index bd2e67b35b3..44e3d0e71b5 100644
--- a/experimental/packages/otlp-transformer/src/metrics/internal.ts
+++ b/experimental/packages/otlp-transformer-metrics/src/metrics/internal.ts
@@ -25,7 +25,6 @@ import {
MetricData,
ResourceMetrics
} from '@opentelemetry/sdk-metrics-base';
-import { toAttributes } from '../common/internal';
import {
EAggregationTemporality,
IHistogramDataPoint,
@@ -34,6 +33,7 @@ import {
IResourceMetrics,
IScopeMetrics
} from './types';
+import { toAttributes } from '@opentelemetry/otlp-transformer-base';
export function toResourceMetrics(resourceMetrics: ResourceMetrics): IResourceMetrics {
return {
@@ -46,9 +46,9 @@ export function toResourceMetrics(resourceMetrics: ResourceMetrics): IResourceMe
};
}
-export function toScopeMetrics(scopeMetrics: ScopeMetrics[]): IScopeMetrics[]{
+export function toScopeMetrics(scopeMetrics: ScopeMetrics[]): IScopeMetrics[] {
return Array.from(scopeMetrics.map(metrics => {
- const scopeMetrics : IScopeMetrics = {
+ const scopeMetrics: IScopeMetrics = {
scope: {
name: metrics.scope.name,
version: metrics.scope.version,
diff --git a/experimental/packages/otlp-transformer/src/metrics/types.ts b/experimental/packages/otlp-transformer-metrics/src/metrics/types.ts
similarity index 98%
rename from experimental/packages/otlp-transformer/src/metrics/types.ts
rename to experimental/packages/otlp-transformer-metrics/src/metrics/types.ts
index 0e98ff2a25c..4992e5786dc 100644
--- a/experimental/packages/otlp-transformer/src/metrics/types.ts
+++ b/experimental/packages/otlp-transformer-metrics/src/metrics/types.ts
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import { IInstrumentationScope, IKeyValue } from '../common/types';
-import { IResource } from '../resource/types';
+
+import { IInstrumentationScope, IKeyValue, IResource } from '@opentelemetry/otlp-transformer-base';
/** Properties of an ExportMetricsServiceRequest. */
export interface IExportMetricsServiceRequest {
diff --git a/experimental/packages/otlp-transformer-metrics/test/index-webpack.ts b/experimental/packages/otlp-transformer-metrics/test/index-webpack.ts
new file mode 100644
index 00000000000..061a48ccfa7
--- /dev/null
+++ b/experimental/packages/otlp-transformer-metrics/test/index-webpack.ts
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+const testsContext = require.context('.', true, /test$/);
+testsContext.keys().forEach(testsContext);
+
+const srcContext = require.context('.', true, /src$/);
+srcContext.keys().forEach(srcContext);
diff --git a/experimental/packages/otlp-transformer/test/metrics.test.ts b/experimental/packages/otlp-transformer-metrics/test/metrics.test.ts
similarity index 100%
rename from experimental/packages/otlp-transformer/test/metrics.test.ts
rename to experimental/packages/otlp-transformer-metrics/test/metrics.test.ts
diff --git a/experimental/packages/otlp-transformer-metrics/tsconfig.all.json b/experimental/packages/otlp-transformer-metrics/tsconfig.all.json
new file mode 100644
index 00000000000..06c54913342
--- /dev/null
+++ b/experimental/packages/otlp-transformer-metrics/tsconfig.all.json
@@ -0,0 +1,9 @@
+{
+ "extends": "../../../tsconfig.base.json",
+ "files": [],
+ "references": [
+ { "path": "./tsconfig.json" },
+ { "path": "./tsconfig.esm.json" },
+ { "path": "./tsconfig.esnext.json" }
+ ]
+}
diff --git a/experimental/packages/otlp-transformer-metrics/tsconfig.esm.json b/experimental/packages/otlp-transformer-metrics/tsconfig.esm.json
new file mode 100644
index 00000000000..379f547a469
--- /dev/null
+++ b/experimental/packages/otlp-transformer-metrics/tsconfig.esm.json
@@ -0,0 +1,11 @@
+{
+ "extends": "../../../tsconfig.base.esm.json",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "build/esm",
+ "tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo"
+ },
+ "include": [
+ "src/**/*.ts"
+ ]
+}
diff --git a/experimental/packages/otlp-transformer-metrics/tsconfig.esnext.json b/experimental/packages/otlp-transformer-metrics/tsconfig.esnext.json
new file mode 100644
index 00000000000..cb78dd6ff39
--- /dev/null
+++ b/experimental/packages/otlp-transformer-metrics/tsconfig.esnext.json
@@ -0,0 +1,11 @@
+{
+ "extends": "../../../tsconfig.base.esnext.json",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "build/esnext",
+ "tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo"
+ },
+ "include": [
+ "src/**/*.ts"
+ ]
+}
diff --git a/experimental/packages/otlp-transformer-metrics/tsconfig.json b/experimental/packages/otlp-transformer-metrics/tsconfig.json
new file mode 100644
index 00000000000..63266350407
--- /dev/null
+++ b/experimental/packages/otlp-transformer-metrics/tsconfig.json
@@ -0,0 +1,25 @@
+{
+ "extends": "../../../tsconfig.base.json",
+ "compilerOptions": {
+ "rootDir": ".",
+ "outDir": "build"
+ },
+ "include": [
+ "src/**/*.ts",
+ "test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../../../packages/opentelemetry-core"
+ },
+ {
+ "path": "../opentelemetry-api-metrics"
+ },
+ {
+ "path": "../opentelemetry-sdk-metrics-base"
+ },
+ {
+ "path": "../otlp-transformer-base"
+ }
+ ]
+}
diff --git a/experimental/packages/otlp-transformer-trace/.eslintignore b/experimental/packages/otlp-transformer-trace/.eslintignore
new file mode 100644
index 00000000000..345f1a599ed
--- /dev/null
+++ b/experimental/packages/otlp-transformer-trace/.eslintignore
@@ -0,0 +1,2 @@
+build
+src/generated
diff --git a/experimental/packages/otlp-transformer-trace/.eslintrc.js b/experimental/packages/otlp-transformer-trace/.eslintrc.js
new file mode 100644
index 00000000000..b9004d20258
--- /dev/null
+++ b/experimental/packages/otlp-transformer-trace/.eslintrc.js
@@ -0,0 +1,8 @@
+module.exports = {
+ "env": {
+ "mocha": true,
+ "commonjs": true,
+ "shared-node-browser": true
+ },
+ ...require('../../../eslint.config.js')
+}
diff --git a/experimental/packages/otlp-transformer-trace/.gitignore b/experimental/packages/otlp-transformer-trace/.gitignore
new file mode 100644
index 00000000000..c83f90a2b01
--- /dev/null
+++ b/experimental/packages/otlp-transformer-trace/.gitignore
@@ -0,0 +1 @@
+src/generated
diff --git a/experimental/packages/otlp-transformer-trace/README.md b/experimental/packages/otlp-transformer-trace/README.md
new file mode 100644
index 00000000000..27ea6d33fe3
--- /dev/null
+++ b/experimental/packages/otlp-transformer-trace/README.md
@@ -0,0 +1,40 @@
+# OpenTelemetry Protocol
+
+[![NPM Published Version][npm-img]][npm-url]
+[![Apache License][license-image]][license-image]
+
+**NOTE: This package is intended for internal use only.**
+
+This package provides everything needed to serialize [OpenTelemetry SDK][sdk] metrics to [OpenTelemetry Protocol][otlp]
+format using [protocol buffers][protobuf] or JSON.
+
+## Quick Start
+
+To get started you will need to install a compatible OpenTelemetry API.
+
+### Install Peer Dependencies
+
+```sh
+npm install @opentelemetry/api
+ ```
+
+## Useful links
+
+- For more information on OpenTelemetry, visit:
+- For more about OpenTelemetry JavaScript:
+- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]
+
+## License
+
+Apache 2.0 - See [LICENSE][license-url] for more information.
+
+[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
+[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/LICENSE
+[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
+[npm-url]: https://www.npmjs.com/package/@opentelemetry/otlp-transformer
+[npm-img]: https://badge.fury.io/js/%40opentelemetry%otlp-transformer.svg
+
+[sdk]: https://github.com/open-telemetry/opentelemetry-js
+[otlp]: https://github.com/open-telemetry/opentelemetry-proto
+
+[protobuf]: https://developers.google.com/protocol-buffers
diff --git a/experimental/packages/otlp-transformer-trace/karma.conf.js b/experimental/packages/otlp-transformer-trace/karma.conf.js
new file mode 100644
index 00000000000..6174839d651
--- /dev/null
+++ b/experimental/packages/otlp-transformer-trace/karma.conf.js
@@ -0,0 +1,24 @@
+/*!
+ * 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
+ *
+ * http://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.
+ */
+
+const karmaWebpackConfig = require('../../../karma.webpack');
+const karmaBaseConfig = require('../../../karma.base');
+
+module.exports = (config) => {
+ config.set(Object.assign({}, karmaBaseConfig, {
+ webpack: karmaWebpackConfig
+ }))
+};
diff --git a/experimental/packages/otlp-transformer/package.json b/experimental/packages/otlp-transformer-trace/package.json
similarity index 86%
rename from experimental/packages/otlp-transformer/package.json
rename to experimental/packages/otlp-transformer-trace/package.json
index 540c5af84f0..d79a9d58118 100644
--- a/experimental/packages/otlp-transformer/package.json
+++ b/experimental/packages/otlp-transformer-trace/package.json
@@ -1,5 +1,5 @@
{
- "name": "@opentelemetry/otlp-transformer",
+ "name": "@opentelemetry/otlp-transformer-trace",
"private": false,
"publishConfig": {
"access": "public"
@@ -38,6 +38,12 @@
"node": ">=8.12.0"
},
"files": [
+ "build/esm/**/*.js",
+ "build/esm/**/*.js.map",
+ "build/esm/**/*.d.ts",
+ "build/esnext/**/*.js",
+ "build/esnext/**/*.js.map",
+ "build/esnext/**/*.d.ts",
"build/src/**/*.js",
"build/src/**/*.js.map",
"build/src/**/*.d.ts",
@@ -62,7 +68,6 @@
"mkdirp": "1.0.4",
"mocha": "7.2.0",
"nyc": "15.1.0",
- "protobufjs": "6.11.2",
"rimraf": "3.0.2",
"ts-loader": "8.3.0",
"ts-mocha": "9.0.2",
@@ -70,10 +75,9 @@
"webpack": "4.46.0"
},
"dependencies": {
- "@opentelemetry/api-metrics": "0.28.0",
"@opentelemetry/core": "1.2.0",
+ "@opentelemetry/sdk-trace-base": "1.2.0",
"@opentelemetry/resources": "1.2.0",
- "@opentelemetry/sdk-metrics-base": "0.28.0",
- "@opentelemetry/sdk-trace-base": "1.2.0"
+ "@opentelemetry/otlp-transformer-base": "0.28.0"
}
}
diff --git a/experimental/packages/otlp-transformer-trace/src/index.ts b/experimental/packages/otlp-transformer-trace/src/index.ts
new file mode 100644
index 00000000000..5ddbe14830e
--- /dev/null
+++ b/experimental/packages/otlp-transformer-trace/src/index.ts
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+
+export * from './trace/types';
+
+export { createExportTraceServiceRequest } from './trace';
diff --git a/experimental/packages/otlp-transformer/src/trace/index.ts b/experimental/packages/otlp-transformer-trace/src/trace/index.ts
similarity index 97%
rename from experimental/packages/otlp-transformer/src/trace/index.ts
rename to experimental/packages/otlp-transformer-trace/src/trace/index.ts
index 0601f017a9f..23f4255a420 100644
--- a/experimental/packages/otlp-transformer/src/trace/index.ts
+++ b/experimental/packages/otlp-transformer-trace/src/trace/index.ts
@@ -15,9 +15,9 @@
*/
import type { Resource } from '@opentelemetry/resources';
import type { ReadableSpan } from '@opentelemetry/sdk-trace-base';
-import { toAttributes } from '../common/internal';
import { sdkSpanToOtlpSpan } from './internal';
import { IExportTraceServiceRequest, IResourceSpans, IScopeSpans } from './types';
+import { toAttributes } from '@opentelemetry/otlp-transformer-base';
export function createExportTraceServiceRequest(spans: ReadableSpan[], useHex?: boolean): IExportTraceServiceRequest {
return {
diff --git a/experimental/packages/otlp-transformer/src/trace/internal.ts b/experimental/packages/otlp-transformer-trace/src/trace/internal.ts
similarity index 97%
rename from experimental/packages/otlp-transformer/src/trace/internal.ts
rename to experimental/packages/otlp-transformer-trace/src/trace/internal.ts
index 87a8182c3f5..81ead70210c 100644
--- a/experimental/packages/otlp-transformer/src/trace/internal.ts
+++ b/experimental/packages/otlp-transformer-trace/src/trace/internal.ts
@@ -16,9 +16,9 @@
import type { Link } from '@opentelemetry/api';
import { hrTimeToNanoseconds } from '@opentelemetry/core';
import type { ReadableSpan, TimedEvent } from '@opentelemetry/sdk-trace-base';
-import { toAttributes } from '../common/internal';
import { EStatusCode, IEvent, ILink, ISpan } from './types';
import * as core from '@opentelemetry/core';
+import { toAttributes } from '@opentelemetry/otlp-transformer-base';
export function sdkSpanToOtlpSpan(
span: ReadableSpan,
diff --git a/experimental/packages/otlp-transformer/src/trace/types.ts b/experimental/packages/otlp-transformer-trace/src/trace/types.ts
similarity index 85%
rename from experimental/packages/otlp-transformer/src/trace/types.ts
rename to experimental/packages/otlp-transformer-trace/src/trace/types.ts
index a12260c7e43..edfd830ab5c 100644
--- a/experimental/packages/otlp-transformer/src/trace/types.ts
+++ b/experimental/packages/otlp-transformer-trace/src/trace/types.ts
@@ -14,8 +14,11 @@
* limitations under the License.
*/
-import { IInstrumentationScope, IKeyValue } from '../common/types';
-import { IResource } from '../resource/types';
+import {
+ IInstrumentationScope,
+ IKeyValue,
+ IResource
+} from '@opentelemetry/otlp-transformer-base';
/** Properties of an ExportTraceServiceRequest. */
export interface IExportTraceServiceRequest {
@@ -107,30 +110,30 @@ export enum ESpanKind {
SPAN_KIND_UNSPECIFIED = 0,
/** Indicates that the span represents an internal operation within an application,
- * as opposed to an operation happening at the boundaries. Default value.
- */
+ * as opposed to an operation happening at the boundaries. Default value.
+ */
SPAN_KIND_INTERNAL = 1,
/** Indicates that the span covers server-side handling of an RPC or other
- * remote network request.
- */
+ * remote network request.
+ */
SPAN_KIND_SERVER = 2,
/** Indicates that the span describes a request to some remote service.
- */
+ */
SPAN_KIND_CLIENT = 3,
/** Indicates that the span describes a producer sending a message to a broker.
- * Unlike CLIENT and SERVER, there is often no direct critical path latency relationship
- * between producer and consumer spans. A PRODUCER span ends when the message was accepted
- * by the broker while the logical processing of the message might span a much longer time.
- */
+ * Unlike CLIENT and SERVER, there is often no direct critical path latency relationship
+ * between producer and consumer spans. A PRODUCER span ends when the message was accepted
+ * by the broker while the logical processing of the message might span a much longer time.
+ */
SPAN_KIND_PRODUCER = 4,
/** Indicates that the span describes consumer receiving a message from a broker.
- * Like the PRODUCER kind, there is often no direct critical path latency relationship
- * between producer and consumer spans.
- */
+ * Like the PRODUCER kind, there is often no direct critical path latency relationship
+ * between producer and consumer spans.
+ */
SPAN_KIND_CONSUMER = 5,
}
diff --git a/experimental/packages/otlp-transformer-trace/test/index-webpack.ts b/experimental/packages/otlp-transformer-trace/test/index-webpack.ts
new file mode 100644
index 00000000000..061a48ccfa7
--- /dev/null
+++ b/experimental/packages/otlp-transformer-trace/test/index-webpack.ts
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+const testsContext = require.context('.', true, /test$/);
+testsContext.keys().forEach(testsContext);
+
+const srcContext = require.context('.', true, /src$/);
+srcContext.keys().forEach(srcContext);
diff --git a/experimental/packages/otlp-transformer/test/trace.test.ts b/experimental/packages/otlp-transformer-trace/test/trace.test.ts
similarity index 100%
rename from experimental/packages/otlp-transformer/test/trace.test.ts
rename to experimental/packages/otlp-transformer-trace/test/trace.test.ts
diff --git a/experimental/packages/otlp-transformer-trace/tsconfig.all.json b/experimental/packages/otlp-transformer-trace/tsconfig.all.json
new file mode 100644
index 00000000000..06c54913342
--- /dev/null
+++ b/experimental/packages/otlp-transformer-trace/tsconfig.all.json
@@ -0,0 +1,9 @@
+{
+ "extends": "../../../tsconfig.base.json",
+ "files": [],
+ "references": [
+ { "path": "./tsconfig.json" },
+ { "path": "./tsconfig.esm.json" },
+ { "path": "./tsconfig.esnext.json" }
+ ]
+}
diff --git a/experimental/packages/otlp-transformer-trace/tsconfig.esm.json b/experimental/packages/otlp-transformer-trace/tsconfig.esm.json
new file mode 100644
index 00000000000..379f547a469
--- /dev/null
+++ b/experimental/packages/otlp-transformer-trace/tsconfig.esm.json
@@ -0,0 +1,11 @@
+{
+ "extends": "../../../tsconfig.base.esm.json",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "build/esm",
+ "tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo"
+ },
+ "include": [
+ "src/**/*.ts"
+ ]
+}
diff --git a/experimental/packages/otlp-transformer-trace/tsconfig.esnext.json b/experimental/packages/otlp-transformer-trace/tsconfig.esnext.json
new file mode 100644
index 00000000000..cb78dd6ff39
--- /dev/null
+++ b/experimental/packages/otlp-transformer-trace/tsconfig.esnext.json
@@ -0,0 +1,11 @@
+{
+ "extends": "../../../tsconfig.base.esnext.json",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "build/esnext",
+ "tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo"
+ },
+ "include": [
+ "src/**/*.ts"
+ ]
+}
diff --git a/experimental/packages/otlp-transformer/tsconfig.json b/experimental/packages/otlp-transformer-trace/tsconfig.json
similarity index 79%
rename from experimental/packages/otlp-transformer/tsconfig.json
rename to experimental/packages/otlp-transformer-trace/tsconfig.json
index 89cb53e4dea..f8209962904 100644
--- a/experimental/packages/otlp-transformer/tsconfig.json
+++ b/experimental/packages/otlp-transformer-trace/tsconfig.json
@@ -19,10 +19,7 @@
"path": "../../../packages/opentelemetry-sdk-trace-base"
},
{
- "path": "../opentelemetry-api-metrics"
- },
- {
- "path": "../opentelemetry-sdk-metrics-base"
+ "path": "../otlp-transformer-base"
}
]
}
diff --git a/experimental/packages/otlp-transformer/README.md b/experimental/packages/otlp-transformer/README.md
deleted file mode 100644
index 2c53ce82cac..00000000000
--- a/experimental/packages/otlp-transformer/README.md
+++ /dev/null
@@ -1,115 +0,0 @@
-# OpenTelemetry Protocol
-
-[![NPM Published Version][npm-img]][npm-url]
-[![Apache License][license-image]][license-image]
-
-This package provides everything needed to serialize [OpenTelemetry SDK][sdk] traces and metrics into the [OpenTelemetry Protocol][otlp] format using [protocol buffers][protobuf] or JSON.
-It also contains service clients for exporting traces and metrics to the OpenTelemetry Collector or a compatible receiver using using OTLP over [gRPC][grpc].
-This module uses [`protobufjs`][protobufjs] for serialization and is compatible with [`@grpc/grpc-js`][grpc-js].
-
-## Quick Start
-
-To get started you will need to install a compatible OpenTelemetry API.
-
-### Install Peer Dependencies
-
-```sh
-npm install \
- @opentelemetry/api \
- @grpc/grpc-js # only required if you are using gRPC
-```
-
-### Serialize Traces and Metrics
-
-This module exports functions to serialize traces and metrics from the OpenTelemetry SDK into protocol buffers which can be sent over HTTP to the OpenTelemetry collector or a compatible receiver.
-
-```typescript
-import { createExportTraceServiceRequest, createExportMetricsServiceRequest } from "@opentelemetry/otlp-transformer";
-
-const serializedSpans = createExportTraceServiceRequest(readableSpans);
-const serializedMetrics = createExportMetricsServiceRequest(readableMetrics);
-```
-
-### Create gRPC Service Clients
-
-This module also contains gRPC service clients for exporting traces and metrics to an OpenTelemetry collector or compatible receiver over gRPC.
-In order to avoid bundling a gRPC module with this module, it is required to construct an RPC implementation to pass to the constructor of the service clients.
-Any RPC implementation compatible with `grpc` or `@grpc/grpc-js` may be used, but `@grpc/grpc-js` is recommended.
-
-```typescript
-import type { RPCImpl } from 'protobufjs';
-import { makeGenericClientConstructor, credentials } from '@gprc/grpc-js';
-import { MetricServiceClient, TraceServiceClient } from "@opentelemetry/otlp-transformer";
-
-// Construct a RPC Implementation according to protobufjs docs
-const GrpcClientConstructor = makeGenericClientConstructor({});
-
-const metricGRPCClient = new GrpcClientConstructor(
- "http://localhost:4317/v1/metrics", // default collector metrics endpoint
- credentials.createInsecure(),
-);
-
-const traceGRPCClient = new GrpcClientConstructor(
- "http://localhost:4317/v1/traces", // default collector traces endpoint
- credentials.createInsecure(),
-);
-
-const metricRpc: RPCImpl = function(method, requestData, callback) {
- metricGRPCClient.makeUnaryRequest(
- method.name,
- arg => arg,
- arg => arg,
- requestData,
- callback
- );
-}
-
-const traceRpc: RPCImpl = function(method, requestData, callback) {
- traceGRPCClient.makeUnaryRequest(
- method.name,
- arg => arg,
- arg => arg,
- requestData,
- callback
- );
-}
-
-// Construct service clients to use RPC Implementations
-const metricServiceClient = new MetricServiceClient({
- rpcImpl: metricRpc,
- startTime: Date.now(), // exporter start time in milliseconds
-});
-
-const traceServiceClient = new TraceServiceClient({
- rpcImpl: traceRpc,
-});
-
-// Export ReadableSpan[] and ReadableMetric[] over gRPC
-await metricServiceClient.export(readableMetrics);
-await traceServiceClient.export(readableSpans);
-```
-
-## Useful links
-
-- For more information on OpenTelemetry, visit:
-- For more about OpenTelemetry JavaScript:
-- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]
-
-## License
-
-Apache 2.0 - See [LICENSE][license-url] for more information.
-
-[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
-[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/LICENSE
-[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
-[npm-url]: https://www.npmjs.com/package/@opentelemetry/otlp-transformer
-[npm-img]: https://badge.fury.io/js/%40opentelemetry%otlp-transformer.svg
-
-[sdk]: https://github.com/open-telemetry/opentelemetry-js
-[otlp]: https://github.com/open-telemetry/opentelemetry-proto
-
-[protobuf]: https://developers.google.com/protocol-buffers
-[grpc]: https://grpc.io/
-
-[protobufjs]: https://www.npmjs.com/package/protobufjs
-[grpc-js]: https://www.npmjs.com/package/@grpc/grpc-js
diff --git a/tsconfig.json b/tsconfig.json
index 7b24699251c..d5e2711e6c2 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -143,7 +143,13 @@
"path": "experimental/packages/otlp-proto-exporter-base"
},
{
- "path": "experimental/packages/otlp-transformer"
+ "path": "experimental/packages/otlp-transformer-base"
+ },
+ {
+ "path": "experimental/packages/otlp-transformer-metrics"
+ },
+ {
+ "path": "experimental/packages/otlp-transformer-trace"
},
{
"path": "experimental/backwards-compatability/node10"