@opentelemetry/exporter-metrics-otlp-grpc 0.29.2 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,8 +3,8 @@
3
3
  [![NPM Published Version][npm-img]][npm-url]
4
4
  [![Apache License][license-image]][license-image]
5
5
 
6
- This module provides exporter for web and node to be used with [opentelemetry-collector][opentelemetry-collector-url].
7
- Compatible with [opentelemetry-collector][opentelemetry-collector-url] versions `>=0.16 <=0.50`.
6
+ This module provides exporter for node to be used with OTLP (`grpc`) compatible receivers.
7
+ Compatible with [opentelemetry-collector][opentelemetry-collector-url] versions `>=0.16 <=0.53`.
8
8
 
9
9
  ## Installation
10
10
 
@@ -8,6 +8,7 @@ declare class OTLPMetricExporterProxy extends OTLPGRPCExporterNodeBase<ResourceM
8
8
  getServiceClientType(): ServiceClientType;
9
9
  getDefaultUrl(config: OTLPGRPCExporterConfigNode): string;
10
10
  convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest;
11
+ getUrlFromConfig(config: OTLPGRPCExporterConfigNode): string;
11
12
  }
12
13
  /**
13
14
  * OTLP-gRPC metric exporter
@@ -37,17 +37,19 @@ class OTLPMetricExporterProxy extends otlp_grpc_exporter_base_1.OTLPGRPCExporter
37
37
  return otlp_grpc_exporter_base_1.ServiceClientType.METRICS;
38
38
  }
39
39
  getDefaultUrl(config) {
40
- return typeof config.url === 'string'
41
- ? (0, otlp_grpc_exporter_base_1.validateAndNormalizeUrl)(config.url)
42
- : (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0
43
- ? (0, otlp_grpc_exporter_base_1.validateAndNormalizeUrl)((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT)
44
- : (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0
45
- ? (0, otlp_grpc_exporter_base_1.validateAndNormalizeUrl)((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT)
46
- : (0, otlp_grpc_exporter_base_1.validateAndNormalizeUrl)(otlp_grpc_exporter_base_1.DEFAULT_COLLECTOR_URL);
40
+ return (0, otlp_grpc_exporter_base_1.validateAndNormalizeUrl)(this.getUrlFromConfig(config));
47
41
  }
48
42
  convert(metrics) {
49
43
  return (0, otlp_transformer_1.createExportMetricsServiceRequest)(metrics);
50
44
  }
45
+ getUrlFromConfig(config) {
46
+ if (typeof config.url === 'string') {
47
+ return config.url;
48
+ }
49
+ return (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT ||
50
+ (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT ||
51
+ otlp_grpc_exporter_base_1.DEFAULT_COLLECTOR_URL;
52
+ }
51
53
  }
52
54
  /**
53
55
  * OTLP-gRPC metric exporter
@@ -1 +1 @@
1
- {"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../src/OTLPMetricExporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,0FAImD;AAEnD,oFAMgD;AAChD,8CAA2D;AAC3D,2CAAyC;AACzC,sEAAkH;AAElH,MAAM,uBAAwB,SAAQ,kDAAuE;IAE3G,YAAY,SAAgE,2CAAc;QACxF,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,MAAM,OAAO,GAAG,mBAAY,CAAC,uBAAuB,CAAC,IAAA,aAAM,GAAE,CAAC,kCAAkC,CAAC,CAAC;QAClG,IAAI,CAAC,QAAQ,KAAb,IAAI,CAAC,QAAQ,GAAK,IAAI,kBAAQ,EAAE,EAAC;QACjC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YAC5C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACzB;IACH,CAAC;IAED,mBAAmB;QACjB,OAAO,gEAAgE,CAAC;IAC1E,CAAC;IAED,oBAAoB;QAClB,OAAO,2CAAiB,CAAC,OAAO,CAAC;IACnC,CAAC;IAED,aAAa,CAAC,MAAkC;QAC9C,OAAO,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ;YACnC,CAAC,CAAC,IAAA,iDAAuB,EAAC,MAAM,CAAC,GAAG,CAAC;YACrC,CAAC,CAAC,IAAA,aAAM,GAAE,CAAC,mCAAmC,CAAC,MAAM,GAAG,CAAC;gBACvD,CAAC,CAAC,IAAA,iDAAuB,EAAC,IAAA,aAAM,GAAE,CAAC,mCAAmC,CAAC;gBACvE,CAAC,CAAC,IAAA,aAAM,GAAE,CAAC,2BAA2B,CAAC,MAAM,GAAG,CAAC;oBAC/C,CAAC,CAAC,IAAA,iDAAuB,EAAC,IAAA,aAAM,GAAE,CAAC,2BAA2B,CAAC;oBAC/D,CAAC,CAAC,IAAA,iDAAuB,EAAC,+CAAqB,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,CAAC,OAA0B;QAChC,OAAO,IAAA,oDAAiC,EAAC,OAAO,CAAC,CAAC;IACpD,CAAC;CACF;AAED;;GAEG;AACH,MAAa,kBAAmB,SAAQ,mDAA+C;IACrF,YAAY,SAAiE,2CAAc;QACzF,KAAK,CAAC,IAAI,uBAAuB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IACrD,CAAC;CACF;AAJD,gDAIC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n defaultOptions,\n OTLPMetricExporterBase,\n OTLPMetricExporterOptions\n} from '@opentelemetry/exporter-metrics-otlp-http';\nimport { ResourceMetrics } from '@opentelemetry/sdk-metrics-base';\nimport {\n OTLPGRPCExporterConfigNode,\n OTLPGRPCExporterNodeBase,\n ServiceClientType,\n validateAndNormalizeUrl,\n DEFAULT_COLLECTOR_URL\n} from '@opentelemetry/otlp-grpc-exporter-base';\nimport { baggageUtils, getEnv } from '@opentelemetry/core';\nimport { Metadata } from '@grpc/grpc-js';\nimport { createExportMetricsServiceRequest, IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';\n\nclass OTLPMetricExporterProxy extends OTLPGRPCExporterNodeBase<ResourceMetrics, IExportMetricsServiceRequest> {\n\n constructor(config: OTLPGRPCExporterConfigNode & OTLPMetricExporterOptions= defaultOptions) {\n super(config);\n const headers = baggageUtils.parseKeyPairsIntoRecord(getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS);\n this.metadata ||= new Metadata();\n for (const [k, v] of Object.entries(headers)) {\n this.metadata.set(k, v);\n }\n }\n\n getServiceProtoPath(): string {\n return 'opentelemetry/proto/collector/metrics/v1/metrics_service.proto';\n }\n\n getServiceClientType(): ServiceClientType {\n return ServiceClientType.METRICS;\n }\n\n getDefaultUrl(config: OTLPGRPCExporterConfigNode): string {\n return typeof config.url === 'string'\n ? validateAndNormalizeUrl(config.url)\n : getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0\n ? validateAndNormalizeUrl(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT)\n : getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0\n ? validateAndNormalizeUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT)\n : validateAndNormalizeUrl(DEFAULT_COLLECTOR_URL);\n }\n\n convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest {\n return createExportMetricsServiceRequest(metrics);\n }\n}\n\n/**\n * OTLP-gRPC metric exporter\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase<OTLPMetricExporterProxy>{\n constructor(config: OTLPGRPCExporterConfigNode & OTLPMetricExporterOptions = defaultOptions) {\n super(new OTLPMetricExporterProxy(config), config);\n }\n}\n"]}
1
+ {"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../src/OTLPMetricExporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,0FAImD;AAEnD,oFAMgD;AAChD,8CAA2D;AAC3D,2CAAyC;AACzC,sEAAkH;AAElH,MAAM,uBAAwB,SAAQ,kDAAuE;IAE3G,YAAY,SAAgE,2CAAc;QACxF,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,MAAM,OAAO,GAAG,mBAAY,CAAC,uBAAuB,CAAC,IAAA,aAAM,GAAE,CAAC,kCAAkC,CAAC,CAAC;QAClG,IAAI,CAAC,QAAQ,KAAb,IAAI,CAAC,QAAQ,GAAK,IAAI,kBAAQ,EAAE,EAAC;QACjC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YAC5C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACzB;IACH,CAAC;IAED,mBAAmB;QACjB,OAAO,gEAAgE,CAAC;IAC1E,CAAC;IAED,oBAAoB;QAClB,OAAO,2CAAiB,CAAC,OAAO,CAAC;IACnC,CAAC;IAED,aAAa,CAAC,MAAkC;QAC9C,OAAO,IAAA,iDAAuB,EAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,CAAC,OAA0B;QAChC,OAAO,IAAA,oDAAiC,EAAC,OAAO,CAAC,CAAC;IACpD,CAAC;IAED,gBAAgB,CAAC,MAAkC;QACjD,IAAI,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ,EAAE;YAClC,OAAO,MAAM,CAAC,GAAG,CAAC;SACnB;QAED,OAAO,IAAA,aAAM,GAAE,CAAC,mCAAmC;YACjD,IAAA,aAAM,GAAE,CAAC,2BAA2B;YACpC,+CAAqB,CAAC;IAC1B,CAAC;CACF;AAED;;GAEG;AACH,MAAa,kBAAmB,SAAQ,mDAA+C;IACrF,YAAY,SAAiE,2CAAc;QACzF,KAAK,CAAC,IAAI,uBAAuB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IACrD,CAAC;CACF;AAJD,gDAIC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n defaultOptions,\n OTLPMetricExporterBase,\n OTLPMetricExporterOptions\n} from '@opentelemetry/exporter-metrics-otlp-http';\nimport { ResourceMetrics } from '@opentelemetry/sdk-metrics-base';\nimport {\n OTLPGRPCExporterConfigNode,\n OTLPGRPCExporterNodeBase,\n ServiceClientType,\n validateAndNormalizeUrl,\n DEFAULT_COLLECTOR_URL\n} from '@opentelemetry/otlp-grpc-exporter-base';\nimport { baggageUtils, getEnv } from '@opentelemetry/core';\nimport { Metadata } from '@grpc/grpc-js';\nimport { createExportMetricsServiceRequest, IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer';\n\nclass OTLPMetricExporterProxy extends OTLPGRPCExporterNodeBase<ResourceMetrics, IExportMetricsServiceRequest> {\n\n constructor(config: OTLPGRPCExporterConfigNode & OTLPMetricExporterOptions= defaultOptions) {\n super(config);\n const headers = baggageUtils.parseKeyPairsIntoRecord(getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS);\n this.metadata ||= new Metadata();\n for (const [k, v] of Object.entries(headers)) {\n this.metadata.set(k, v);\n }\n }\n\n getServiceProtoPath(): string {\n return 'opentelemetry/proto/collector/metrics/v1/metrics_service.proto';\n }\n\n getServiceClientType(): ServiceClientType {\n return ServiceClientType.METRICS;\n }\n\n getDefaultUrl(config: OTLPGRPCExporterConfigNode): string {\n return validateAndNormalizeUrl(this.getUrlFromConfig(config));\n }\n\n convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest {\n return createExportMetricsServiceRequest(metrics);\n }\n\n getUrlFromConfig(config: OTLPGRPCExporterConfigNode): string {\n if (typeof config.url === 'string') {\n return config.url;\n }\n\n return getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT ||\n getEnv().OTEL_EXPORTER_OTLP_ENDPOINT ||\n DEFAULT_COLLECTOR_URL;\n }\n}\n\n/**\n * OTLP-gRPC metric exporter\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase<OTLPMetricExporterProxy>{\n constructor(config: OTLPGRPCExporterConfigNode & OTLPMetricExporterOptions = defaultOptions) {\n super(new OTLPMetricExporterProxy(config), config);\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.29.2";
1
+ export declare const VERSION = "0.30.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -17,5 +17,5 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.VERSION = void 0;
19
19
  // this is autogenerated file, see scripts/version-update.js
20
- exports.VERSION = '0.29.2';
20
+ exports.VERSION = '0.30.0';
21
21
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.29.2';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.30.0';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentelemetry/exporter-metrics-otlp-grpc",
3
- "version": "0.29.2",
3
+ "version": "0.30.0",
4
4
  "description": "OpenTelemetry Collector Metrics Exporter allows user to send collected metrics to the OpenTelemetry Collector",
5
5
  "main": "build/src/index.js",
6
6
  "types": "build/src/index.d.ts",
@@ -32,7 +32,7 @@
32
32
  "author": "OpenTelemetry Authors",
33
33
  "license": "Apache-2.0",
34
34
  "engines": {
35
- "node": ">=8.12.0"
35
+ "node": ">=14"
36
36
  },
37
37
  "files": [
38
38
  "build/src/**/*.js",
@@ -49,7 +49,7 @@
49
49
  "devDependencies": {
50
50
  "@babel/core": "7.16.0",
51
51
  "@opentelemetry/api": "^1.0.0",
52
- "@opentelemetry/api-metrics": "0.29.2",
52
+ "@opentelemetry/api-metrics": "0.30.0",
53
53
  "@types/mocha": "8.2.3",
54
54
  "@types/node": "14.17.33",
55
55
  "@types/sinon": "10.0.6",
@@ -69,12 +69,12 @@
69
69
  "dependencies": {
70
70
  "@grpc/grpc-js": "^1.5.9",
71
71
  "@grpc/proto-loader": "^0.6.9",
72
- "@opentelemetry/core": "1.3.1",
73
- "@opentelemetry/exporter-metrics-otlp-http": "0.29.2",
74
- "@opentelemetry/otlp-grpc-exporter-base": "0.29.2",
75
- "@opentelemetry/otlp-transformer": "0.29.2",
76
- "@opentelemetry/resources": "1.3.1",
77
- "@opentelemetry/sdk-metrics-base": "0.29.2"
72
+ "@opentelemetry/core": "1.4.0",
73
+ "@opentelemetry/exporter-metrics-otlp-http": "0.30.0",
74
+ "@opentelemetry/otlp-grpc-exporter-base": "0.30.0",
75
+ "@opentelemetry/otlp-transformer": "0.30.0",
76
+ "@opentelemetry/resources": "1.4.0",
77
+ "@opentelemetry/sdk-metrics-base": "0.30.0"
78
78
  },
79
- "gitHead": "51afd54bd63e46d5d530266761144c7be2f6b3a7"
79
+ "gitHead": "e39ab883b18636238ef0fd741df4ce5ed53e8d04"
80
80
  }