@opentelemetry/exporter-metrics-otlp-grpc 0.212.0 → 0.214.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
@@ -55,6 +55,50 @@ const counter = meter.createCounter('metric_name');
55
55
  counter.add(10, { 'key': 'value' });
56
56
  ```
57
57
 
58
+ By default, the exporter creates a secure (TLS) connection. When connecting to a local development collector without TLS, you can use an insecure connection by specifying the `http://` scheme in the URL:
59
+
60
+ ```js
61
+ const { MeterProvider, PeriodicExportingMetricReader } = require('@opentelemetry/sdk-metrics');
62
+ const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-grpc');
63
+
64
+ const collectorOptions = {
65
+ url: 'http://localhost:4317', // http:// creates an insecure connection
66
+ };
67
+
68
+ const metricExporter = new OTLPMetricExporter(collectorOptions);
69
+ const meterProvider = new MeterProvider({
70
+ readers: [
71
+ new PeriodicExportingMetricReader({
72
+ exporter: metricExporter,
73
+ exportIntervalMillis: 1000,
74
+ }),
75
+ ],
76
+ });
77
+ ```
78
+
79
+ Alternatively, you can explicitly configure insecure credentials:
80
+
81
+ ```js
82
+ const grpc = require('@grpc/grpc-js');
83
+ const { MeterProvider, PeriodicExportingMetricReader } = require('@opentelemetry/sdk-metrics');
84
+ const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-grpc');
85
+
86
+ const collectorOptions = {
87
+ url: 'localhost:4317',
88
+ credentials: grpc.credentials.createInsecure(),
89
+ };
90
+
91
+ const metricExporter = new OTLPMetricExporter(collectorOptions);
92
+ const meterProvider = new MeterProvider({
93
+ readers: [
94
+ new PeriodicExportingMetricReader({
95
+ exporter: metricExporter,
96
+ exportIntervalMillis: 1000,
97
+ }),
98
+ ],
99
+ });
100
+ ```
101
+
58
102
  ## Environment Variable Configuration
59
103
 
60
104
  In addition to settings passed to the constructor, the exporter also supports configuration via environment variables:
@@ -1,5 +1,6 @@
1
- import { OTLPMetricExporterBase, OTLPMetricExporterOptions } from '@opentelemetry/exporter-metrics-otlp-http';
2
- import { OTLPGRPCExporterConfigNode } from '@opentelemetry/otlp-grpc-exporter-base';
1
+ import type { OTLPMetricExporterOptions } from '@opentelemetry/exporter-metrics-otlp-http';
2
+ import { OTLPMetricExporterBase } from '@opentelemetry/exporter-metrics-otlp-http';
3
+ import type { OTLPGRPCExporterConfigNode } from '@opentelemetry/otlp-grpc-exporter-base';
3
4
  /**
4
5
  * OTLP-gRPC metric exporter
5
6
  */
@@ -1,18 +1,7 @@
1
1
  "use strict";
2
2
  /*
3
3
  * Copyright The OpenTelemetry Authors
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * https://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
4
+ * SPDX-License-Identifier: Apache-2.0
16
5
  */
17
6
  Object.defineProperty(exports, "__esModule", { value: true });
18
7
  exports.OTLPMetricExporter = void 0;
@@ -1 +1 @@
1
- {"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../src/OTLPMetricExporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,0FAGmD;AACnD,oFAIgD;AAChD,sEAA4E;AAE5E;;GAEG;AACH,MAAa,kBAAmB,SAAQ,mDAAsB;IAC5D,YAAY,MAA+D;QACzE,KAAK,CACH,IAAA,sDAA4B,EAC1B,IAAA,sDAA4B,EAAC,MAAM,IAAI,EAAE,EAAE,SAAS,CAAC,EACrD,4CAAyB,EACzB,sBAAsB,EACtB,iEAAiE,CAClE,EACD,MAAM,CACP,CAAC;IACJ,CAAC;CACF;AAZD,gDAYC","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 OTLPMetricExporterBase,\n OTLPMetricExporterOptions,\n} from '@opentelemetry/exporter-metrics-otlp-http';\nimport {\n convertLegacyOtlpGrpcOptions,\n createOtlpGrpcExportDelegate,\n OTLPGRPCExporterConfigNode,\n} from '@opentelemetry/otlp-grpc-exporter-base';\nimport { ProtobufMetricsSerializer } from '@opentelemetry/otlp-transformer';\n\n/**\n * OTLP-gRPC metric exporter\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase {\n constructor(config?: OTLPGRPCExporterConfigNode & OTLPMetricExporterOptions) {\n super(\n createOtlpGrpcExportDelegate(\n convertLegacyOtlpGrpcOptions(config ?? {}, 'METRICS'),\n ProtobufMetricsSerializer,\n 'MetricsExportService',\n '/opentelemetry.proto.collector.metrics.v1.MetricsService/Export'\n ),\n config\n );\n }\n}\n"]}
1
+ {"version":3,"file":"OTLPMetricExporter.js","sourceRoot":"","sources":["../../src/OTLPMetricExporter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,0FAAmF;AAEnF,oFAGgD;AAChD,sEAA4E;AAE5E;;GAEG;AACH,MAAa,kBAAmB,SAAQ,mDAAsB;IAC5D,YAAY,MAA+D;QACzE,KAAK,CACH,IAAA,sDAA4B,EAC1B,IAAA,sDAA4B,EAAC,MAAM,IAAI,EAAE,EAAE,SAAS,CAAC,EACrD,4CAAyB,EACzB,sBAAsB,EACtB,iEAAiE,CAClE,EACD,MAAM,CACP,CAAC;IACJ,CAAC;CACF;AAZD,gDAYC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { OTLPMetricExporterOptions } from '@opentelemetry/exporter-metrics-otlp-http';\nimport { OTLPMetricExporterBase } from '@opentelemetry/exporter-metrics-otlp-http';\nimport type { OTLPGRPCExporterConfigNode } from '@opentelemetry/otlp-grpc-exporter-base';\nimport {\n convertLegacyOtlpGrpcOptions,\n createOtlpGrpcExportDelegate,\n} from '@opentelemetry/otlp-grpc-exporter-base';\nimport { ProtobufMetricsSerializer } from '@opentelemetry/otlp-transformer';\n\n/**\n * OTLP-gRPC metric exporter\n */\nexport class OTLPMetricExporter extends OTLPMetricExporterBase {\n constructor(config?: OTLPGRPCExporterConfigNode & OTLPMetricExporterOptions) {\n super(\n createOtlpGrpcExportDelegate(\n convertLegacyOtlpGrpcOptions(config ?? {}, 'METRICS'),\n ProtobufMetricsSerializer,\n 'MetricsExportService',\n '/opentelemetry.proto.collector.metrics.v1.MetricsService/Export'\n ),\n config\n );\n }\n}\n"]}
@@ -1,18 +1,7 @@
1
1
  "use strict";
2
2
  /*
3
3
  * Copyright The OpenTelemetry Authors
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * https://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
4
+ * SPDX-License-Identifier: Apache-2.0
16
5
  */
17
6
  Object.defineProperty(exports, "__esModule", { value: true });
18
7
  exports.OTLPMetricExporter = void 0;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,2DAA0D;AAAjD,wHAAA,kBAAkB,OAAA","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\nexport { OTLPMetricExporter } from './OTLPMetricExporter';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAA0D;AAAjD,wHAAA,kBAAkB,OAAA","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport { OTLPMetricExporter } from './OTLPMetricExporter';\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.212.0";
1
+ export declare const VERSION = "0.214.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,21 +1,10 @@
1
1
  "use strict";
2
2
  /*
3
3
  * Copyright The OpenTelemetry Authors
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * https://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
4
+ * SPDX-License-Identifier: Apache-2.0
16
5
  */
17
6
  Object.defineProperty(exports, "__esModule", { value: true });
18
7
  exports.VERSION = void 0;
19
8
  // this is autogenerated file, see scripts/version-update.js
20
- exports.VERSION = '0.212.0';
9
+ exports.VERSION = '0.214.0';
21
10
  //# 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,SAAS,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.212.0';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,SAAS,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.214.0';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentelemetry/exporter-metrics-otlp-grpc",
3
- "version": "0.212.0",
3
+ "version": "0.214.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",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "devDependencies": {
49
49
  "@grpc/proto-loader": "^0.7.10",
50
- "@opentelemetry/api": "1.9.0",
50
+ "@opentelemetry/api": "1.9.1",
51
51
  "@types/mocha": "10.0.10",
52
52
  "@types/node": "18.19.130",
53
53
  "@types/sinon": "17.0.4",
@@ -62,15 +62,15 @@
62
62
  },
63
63
  "dependencies": {
64
64
  "@grpc/grpc-js": "^1.14.3",
65
- "@opentelemetry/core": "2.5.1",
66
- "@opentelemetry/exporter-metrics-otlp-http": "0.212.0",
67
- "@opentelemetry/otlp-exporter-base": "0.212.0",
68
- "@opentelemetry/otlp-grpc-exporter-base": "0.212.0",
69
- "@opentelemetry/otlp-transformer": "0.212.0",
70
- "@opentelemetry/resources": "2.5.1",
71
- "@opentelemetry/sdk-metrics": "2.5.1"
65
+ "@opentelemetry/core": "2.6.1",
66
+ "@opentelemetry/exporter-metrics-otlp-http": "0.214.0",
67
+ "@opentelemetry/otlp-exporter-base": "0.214.0",
68
+ "@opentelemetry/otlp-grpc-exporter-base": "0.214.0",
69
+ "@opentelemetry/otlp-transformer": "0.214.0",
70
+ "@opentelemetry/resources": "2.6.1",
71
+ "@opentelemetry/sdk-metrics": "2.6.1"
72
72
  },
73
73
  "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc",
74
74
  "sideEffects": false,
75
- "gitHead": "ad92be4c2c1094745a85b0b7eeff1444a11b1b4a"
75
+ "gitHead": "7e74509a4d848e94b2970bb5262dd3e8efeed0a2"
76
76
  }