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

feat(experimental-packages): Update packages to latest SDK Version. #2871

Merged
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
08208e3
feature(otlp-metrics-exporter): begin exporter update.
pichlermarc Mar 28, 2022
1c66ce2
feature(exporter): continue exporter update.
pichlermarc Mar 28, 2022
85a8b53
feat(otlp-http-exporter): update common tests.
pichlermarc Mar 28, 2022
a5cb790
feat(otlp-http-exporter): update node tests.
pichlermarc Mar 28, 2022
59c146c
feat(otlp-grpc-exporter): prelimiary test update.
pichlermarc Mar 28, 2022
780c77d
feat(otlp-grpc-exporter): update tests.
pichlermarc Mar 29, 2022
99b001b
chore: updating submodule for opentelemetry-proto
pichlermarc Mar 29, 2022
91b1289
chore: updating submodule for opentelemetry-proto
pichlermarc Mar 29, 2022
b27ce50
feat(otlp-proto-exporter): update tests.
pichlermarc Mar 29, 2022
f2f4449
feat(otlp-http-exporter): update browser tests.
pichlermarc Mar 29, 2022
fc09a82
feat(otlp-http-exporter): update tranformation tests.
pichlermarc Mar 29, 2022
be3e8f5
feat(otlp-http-exporter): fix browser tests.
pichlermarc Mar 29, 2022
55cbf70
feat(otlp-http-exporter): update browser tests.
pichlermarc Mar 29, 2022
55ce9b8
fix(trace-exporter): revert accidental changes.
pichlermarc Mar 29, 2022
dddbec1
feat(otlp-exporter): use 1.1.1
pichlermarc Mar 30, 2022
a85f283
feat(otlp-exporter): cleanup.
pichlermarc Mar 30, 2022
4babc95
feat(otlp-exporter): cleanup.
pichlermarc Mar 30, 2022
cad66e1
chore: update api version in experimental packages.
pichlermarc Mar 30, 2022
f58b731
chore: update dependencies to stable packages in experimental, remove…
pichlermarc Mar 31, 2022
8de8cd8
feat(otlp-transformer): update otlp transformer.
pichlermarc Mar 31, 2022
cc8655c
feat(opentelemetry-sdk-node): update metrics-sdk configuration.
pichlermarc Mar 31, 2022
c953b2a
chore: update missed dependencies in experimental.
pichlermarc Mar 31, 2022
837aa89
fix(otlp-exporter): update HistogramAggregation to ExplicitBucketHist…
pichlermarc Apr 1, 2022
e320236
fix(ci): ignore api-metrics in peer api check.
pichlermarc Apr 1, 2022
f6d0b0f
fix(instrumentation-fetch): parse url with previous approach as parse…
pichlermarc Apr 4, 2022
c7612b4
fix(instrumentation-xml-http-request): use previous parseUrl approach…
pichlermarc Apr 4, 2022
c9c621d
fix(experimental): relax dependencies.
pichlermarc Apr 4, 2022
202de97
fix(changelog): add changelog entry.
pichlermarc Apr 4, 2022
7357bc9
fix(metrics-example): reset dependencies to original state.
pichlermarc Apr 5, 2022
bdfc0c6
fix(otlp-transformer): use ^1.1.0 for api and ~0.27.0 for metrics-api…
pichlermarc Apr 5, 2022
a192be4
fix(otlp-transformer): remove unnecessary use of Array.from()
pichlermarc Apr 5, 2022
dea3327
fix(otlp-transformer): use else if in singular data point conversion.
pichlermarc Apr 5, 2022
ecc38bc
fix(changelog): update changelog to include a longer PR description.
pichlermarc Apr 6, 2022
cc1af71
fix(metrics-exporter): fix test grouping.
pichlermarc Apr 6, 2022
e1a5f88
Merge branch 'main' into update-otlp-metric-exporter
pichlermarc Apr 6, 2022
e376768
fix(sdk-node): remove metricInterval.
pichlermarc Apr 6, 2022
fcffd62
fix(metrics-exporter): use index accessor for private properties.
pichlermarc Apr 7, 2022
ab80dba
fix(changelog): update changelog entry to #2889 format, move entry to…
pichlermarc Apr 7, 2022
68f0fef
Merge branch 'main' into update-otlp-metric-exporter
dyladan Apr 7, 2022
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
4 changes: 2 additions & 2 deletions .github/workflows/peer-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Install lerna
run: npm install -g lerna

- name: Install semver
- name: Install semver
run: npm install semver

- name: Check API dependency semantics (stable)
Expand All @@ -27,4 +27,4 @@ jobs:

- name: Check API dependency semantics (experimental)
working-directory: experimental
run: lerna exec --ignore propagation-validation-server --ignore @opentelemetry/selenium-tests --ignore @opentelemetry/api-metrics-wip --ignore @opentelemetry/otlp-transformer "node ../../../scripts/peer-api-check.js"
run: lerna exec --ignore propagation-validation-server --ignore @opentelemetry/selenium-tests --ignore @opentelemetry/api-metrics --ignore @opentelemetry/otlp-transformer "node ../../../scripts/peer-api-check.js"
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[submodule "packages/exporter-trace-otlp-proto/protos"]
[submodule "experimental/packages/exporter-trace-otlp-proto/protos"]
path = experimental/packages/exporter-trace-otlp-proto/protos
url = https://github.com/open-telemetry/opentelemetry-proto.git
[submodule "packages/exporter-trace-otlp-grpc/protos"]
[submodule "experimental/packages/exporter-trace-otlp-grpc/protos"]
path = experimental/packages/exporter-trace-otlp-grpc/protos
url = https://github.com/open-telemetry/opentelemetry-proto.git
[submodule "experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/protos"]
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ All notable changes to this project will be documented in this file.

### :rocket: (Enhancement)

* [#2871](https://github.com/open-telemetry/opentelemetry-js/pull/2871) feat(experimental-packages): Update packages to latest SDK Version. ([@pichlermarc](https://github.com/pichlermarc))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add sub-bullet points to this? This PR handles a lot more work than what is implied by this title.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can shorten this entry to be like:

Suggested change
* [#2871](https://github.com/open-telemetry/opentelemetry-js/pull/2871) feat(experimental-packages): Update packages to latest SDK Version. ([@pichlermarc](https://github.com/pichlermarc))
* feat(experimental-packages): Update packages to latest SDK Version. #2871 @pichlermarc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dyladan Good idea, I added sub-bullet points. in ecc38bc.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've submitted #2889 to discuss the verbose format.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@legendecas yes, this seems way more concise, good idea. 🙂 I updated the entry to #2889 format in ab80dba, and moved the entry to the experimental changelog. However, this format does not work for anyone viewing the changelog file locally.


### :bug: (Bug Fix)

### :books: (Refine Doc)
Expand Down
2 changes: 1 addition & 1 deletion experimental/backwards-compatability/node10/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"dependencies": {
"@opentelemetry/sdk-node": "0.27.0",
"@opentelemetry/sdk-trace-base": "1.0.1"
"@opentelemetry/sdk-trace-base": "1.1.1"
},
"devDependencies": {
"@types/node": "10.17.60",
Expand Down
2 changes: 1 addition & 1 deletion experimental/backwards-compatability/node12/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"dependencies": {
"@opentelemetry/sdk-node": "0.27.0",
"@opentelemetry/sdk-trace-base": "1.0.1"
"@opentelemetry/sdk-trace-base": "1.1.1"
},
"devDependencies": {
"@types/node": "12.20.37",
Expand Down
2 changes: 1 addition & 1 deletion experimental/backwards-compatability/node8/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"dependencies": {
"@opentelemetry/sdk-node": "0.27.0",
"@opentelemetry/sdk-trace-base": "1.0.1"
"@opentelemetry/sdk-trace-base": "1.1.1"
},
"devDependencies": {
"@types/node": "8.10.66",
Expand Down
4 changes: 2 additions & 2 deletions experimental/packages/exporter-trace-otlp-grpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
},
"devDependencies": {
"@babel/core": "7.16.0",
"@opentelemetry/api": "^1.0.3",
"@opentelemetry/api": "^1.1.0",
"@types/mocha": "8.2.3",
"@types/node": "14.17.33",
"@types/sinon": "10.0.6",
Expand All @@ -64,7 +64,7 @@
"typescript": "4.4.4"
},
"peerDependencies": {
"@opentelemetry/api": "^1.0.3"
"@opentelemetry/api": "^1.1.0"
rauno56 marked this conversation as resolved.
Show resolved Hide resolved
},
"dependencies": {
"@opentelemetry/core": "1.1.1",
Expand Down
4 changes: 2 additions & 2 deletions experimental/packages/exporter-trace-otlp-http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
},
"devDependencies": {
"@babel/core": "7.16.0",
"@opentelemetry/api": "^1.0.3",
"@opentelemetry/api": "^1.1.0",
"@types/mocha": "8.2.3",
"@types/node": "14.17.33",
"@types/sinon": "10.0.6",
Expand All @@ -89,7 +89,7 @@
"webpack-merge": "5.8.0"
},
"peerDependencies": {
"@opentelemetry/api": "^1.0.3"
"@opentelemetry/api": "^1.1.0"
},
"dependencies": {
"@opentelemetry/core": "1.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
},
"devDependencies": {
"@babel/core": "7.16.0",
"@opentelemetry/api": "^1.0.3",
"@opentelemetry/api": "^1.1.0",
"@types/mocha": "8.2.3",
"@types/node": "14.17.33",
"@types/sinon": "10.0.6",
Expand All @@ -64,7 +64,7 @@
"typescript": "4.4.4"
},
"peerDependencies": {
"@opentelemetry/api": "^1.0.3"
"@opentelemetry/api": "^1.1.0"
},
"dependencies": {
"@opentelemetry/core": "1.1.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@opentelemetry/api-metrics-wip",
"name": "@opentelemetry/api-metrics",
"version": "0.27.0",
"private": true,
"description": "Public metrics API for OpenTelemetry",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@
"typescript": "4.4.4"
},
"peerDependencies": {
"@opentelemetry/api": "^1.0.3"
"@opentelemetry/api": "^1.1.0"
},
"dependencies": {
"@grpc/grpc-js": "^1.5.9",
"@grpc/proto-loader": "^0.6.9",
"@opentelemetry/core": "1.0.1",
"@opentelemetry/core": "1.1.1",
"@opentelemetry/exporter-metrics-otlp-http": "0.27.0",
"@opentelemetry/exporter-trace-otlp-grpc": "0.27.0",
"@opentelemetry/exporter-trace-otlp-http": "0.27.0",
"@opentelemetry/resources": "1.0.1",
"@opentelemetry/resources": "1.1.1",
"@opentelemetry/sdk-metrics-base": "0.27.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@
*/

import { otlpTypes } from '@opentelemetry/exporter-trace-otlp-http';
import { toOTLPExportMetricServiceRequest } from '@opentelemetry/exporter-metrics-otlp-http';
import { MetricRecord, MetricExporter } from '@opentelemetry/sdk-metrics-base';
import {
defaultExporterTemporality,
defaultOptions,
OTLPMetricExporterBase, OTLPMetricExporterOptions,
toOTLPExportMetricServiceRequest
} from '@opentelemetry/exporter-metrics-otlp-http';
import { AggregationTemporality, ResourceMetrics } from '@opentelemetry/sdk-metrics-base';
import {
OTLPExporterConfigNode,
OTLPExporterNodeBase,
Expand All @@ -28,52 +33,53 @@ import { Metadata } from '@grpc/grpc-js';

const DEFAULT_COLLECTOR_URL = 'localhost:4317';

/**
* OTLP Metric Exporter for Node
*/
export class OTLPMetricExporter
extends OTLPExporterNodeBase<
MetricRecord,
otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest
>
implements MetricExporter {
// Converts time to nanoseconds
protected readonly _startTime = new Date().getTime() * 1000000;

constructor(config: OTLPExporterConfigNode = {}) {
class OTLPMetricExporterProxy extends OTLPExporterNodeBase<ResourceMetrics,
otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest> {
protected readonly _aggregationTemporality: AggregationTemporality;

constructor(config: OTLPExporterConfigNode & OTLPMetricExporterOptions= defaultOptions) {
super(config);
const headers = baggageUtils.parseKeyPairsIntoRecord(getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS);
this.metadata ||= new Metadata();
const headers = baggageUtils.parseKeyPairsIntoRecord(getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS);
for (const [k, v] of Object.entries(headers)) {
this.metadata.set(k, v);
}
this._aggregationTemporality = config.aggregationTemporality ?? defaultExporterTemporality;
}

convert(
metrics: MetricRecord[]
): otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest {
return toOTLPExportMetricServiceRequest(
metrics,
this._startTime,
this
);
getServiceProtoPath(): string {
return 'opentelemetry/proto/collector/metrics/v1/metrics_service.proto';
}

getServiceClientType(): ServiceClientType {
return ServiceClientType.METRICS;
}

getDefaultUrl(config: OTLPExporterConfigNode): string {
return typeof config.url === 'string'
? validateAndNormalizeUrl(config.url)
: getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0
? validateAndNormalizeUrl(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT)
: getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0
? validateAndNormalizeUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT)
: DEFAULT_COLLECTOR_URL;
? validateAndNormalizeUrl(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT)
: getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0
? validateAndNormalizeUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT)
: DEFAULT_COLLECTOR_URL;
}

getServiceClientType(): ServiceClientType {
return ServiceClientType.METRICS;
convert(metrics: ResourceMetrics[]): otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest {
return toOTLPExportMetricServiceRequest(
metrics[0],
this._aggregationTemporality,
this
);
}
}

getServiceProtoPath(): string {
return 'opentelemetry/proto/collector/metrics/v1/metrics_service.proto';
/**
* OTLP-gRPC metric exporter
*/
export class OTLPMetricExporter extends OTLPMetricExporterBase<OTLPMetricExporterProxy>{
constructor(config: OTLPExporterConfigNode & OTLPMetricExporterOptions = defaultOptions) {
super(new OTLPMetricExporterProxy(config), config);
}
}
Loading