diff --git a/experimental/CHANGELOG.md b/experimental/CHANGELOG.md index 3363d30f8d5..9127b7bd710 100644 --- a/experimental/CHANGELOG.md +++ b/experimental/CHANGELOG.md @@ -32,6 +32,7 @@ All notable changes to experimental packages in this project will be documented ### :house: (Internal) +* chore(otlp-exporter-\*-grpc): clean up tests [#5196](https://github.com/open-telemetry/opentelemetry-js/pull/5196) @pichlermarc * chore(otlp-exporter-\*-http): clean up tests [#5196](https://github.com/open-telemetry/opentelemetry-js/pull/5198) @pichlermarc * chore(otlp-exporter-\*-proto): clean up tests [#5196](https://github.com/open-telemetry/opentelemetry-js/pull/5199) @pichlermarc diff --git a/experimental/packages/exporter-logs-otlp-grpc/package.json b/experimental/packages/exporter-logs-otlp-grpc/package.json index 2dc7564ac67..42c2e566579 100644 --- a/experimental/packages/exporter-logs-otlp-grpc/package.json +++ b/experimental/packages/exporter-logs-otlp-grpc/package.json @@ -18,8 +18,7 @@ "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js", - "align-api-deps": "node ../../../scripts/align-api-deps.js", - "maint:regenerate-test-certs": "cd test/certs && ./regenerate.sh" + "align-api-deps": "node ../../../scripts/align-api-deps.js" }, "keywords": [ "opentelemetry", diff --git a/experimental/packages/exporter-logs-otlp-grpc/test/OTLPLogExporter.test.ts b/experimental/packages/exporter-logs-otlp-grpc/test/OTLPLogExporter.test.ts index 996b5180acf..6218f750368 100644 --- a/experimental/packages/exporter-logs-otlp-grpc/test/OTLPLogExporter.test.ts +++ b/experimental/packages/exporter-logs-otlp-grpc/test/OTLPLogExporter.test.ts @@ -14,290 +14,86 @@ * limitations under the License. */ -import * as protoLoader from '@grpc/proto-loader'; -import { diag } from '@opentelemetry/api'; - -import * as assert from 'assert'; -import * as crypto from 'crypto'; -import * as fs from 'fs'; -import * as grpc from '@grpc/grpc-js'; -import * as path from 'path'; -import * as sinon from 'sinon'; -import { OTLPLogExporter } from '../src'; - -import { - ensureExportedLogRecordIsCorrect, - ensureMetadataIsCorrect, - ensureResourceIsCorrect, - mockedReadableLogRecord, -} from './logsHelper'; -import * as core from '@opentelemetry/core'; -import { CompressionAlgorithm } from '@opentelemetry/otlp-exporter-base'; import { - IExportLogsServiceRequest, - IResourceLogs, -} from '@opentelemetry/otlp-transformer'; - -const logsServiceProtoPath = - 'opentelemetry/proto/collector/logs/v1/logs_service.proto'; -const includeDirs = [path.resolve(__dirname, '../../otlp-transformer/protos')]; - -const httpAddr = 'https://localhost:1503'; -const udsAddr = 'unix:///tmp/otlp-logs.sock'; + LoggerProvider, + SimpleLogRecordProcessor, +} from '@opentelemetry/sdk-logs'; +import { OTLPLogExporter } from '../src'; +import { ServerTestContext, startServer } from './utils'; +import * as assert from 'assert'; -type TestParams = { - address?: string; - useTLS?: boolean; - metadata?: grpc.Metadata; +const testServiceDefinition = { + export: { + path: '/opentelemetry.proto.collector.logs.v1.LogsService/Export', + requestStream: false, + responseStream: false, + requestSerialize: (arg: Buffer) => { + return arg; + }, + requestDeserialize: (arg: Buffer) => { + return arg; + }, + responseSerialize: (arg: Buffer) => { + return arg; + }, + responseDeserialize: (arg: Buffer) => { + return arg; + }, + }, }; -const metadata = new grpc.Metadata(); -metadata.set('k', 'v'); - -const testCollectorExporter = (params: TestParams) => { - const { address = httpAddr, useTLS, metadata } = params; - return describe(`OTLPLogExporter - node ${useTLS ? 'with' : 'without'} TLS, ${ - metadata ? 'with' : 'without' - } metadata, target ${address}`, () => { - let collectorExporter: OTLPLogExporter; - let server: grpc.Server; - let exportedData: IResourceLogs | undefined; - let reqMetadata: grpc.Metadata | undefined; - - before(done => { - server = new grpc.Server(); - protoLoader - .load(logsServiceProtoPath, { - keepCase: false, - longs: String, - enums: String, - defaults: true, - oneofs: true, - includeDirs, - }) - .then((packageDefinition: protoLoader.PackageDefinition) => { - const packageObject: any = - grpc.loadPackageDefinition(packageDefinition); - server.addService( - packageObject.opentelemetry.proto.collector.logs.v1.LogsService - .service, - { - Export: (data: { - request: IExportLogsServiceRequest; - metadata: grpc.Metadata; - }) => { - if (data.request.resourceLogs != null) { - exportedData = data.request.resourceLogs[0]; - } - reqMetadata = data.metadata; - }, - } - ); - const credentials = useTLS - ? grpc.ServerCredentials.createSsl( - fs.readFileSync('./test/certs/ca.crt'), - [ - { - cert_chain: fs.readFileSync('./test/certs/server.crt'), - private_key: fs.readFileSync('./test/certs/server.key'), - }, - ] - ) - : grpc.ServerCredentials.createInsecure(); - const serverAddr = new URL(address); - server.bindAsync( - serverAddr.protocol === 'https:' ? serverAddr.host : address, - credentials, - err => { - if (err) { - done(err); - } else { - server.start(); - done(); - } - } - ); - }) - .catch(done); - }); - - after(() => { - server.forceShutdown(); - }); - - beforeEach(done => { - const credentials = useTLS - ? grpc.credentials.createSsl( - fs.readFileSync('./test/certs/ca.crt'), - fs.readFileSync('./test/certs/client.key'), - fs.readFileSync('./test/certs/client.crt') - ) - : grpc.credentials.createInsecure(); - collectorExporter = new OTLPLogExporter({ - url: address, - credentials, - metadata: metadata, - }); - done(); - }); - - afterEach(() => { - exportedData = undefined; - reqMetadata = undefined; - sinon.restore(); - }); - - if (useTLS && crypto.X509Certificate) { - it('test certs are valid', () => { - const certPaths = [ - './test/certs/ca.crt', - './test/certs/client.crt', - './test/certs/server.crt', - ]; - certPaths.forEach(certPath => { - const cert = new crypto.X509Certificate(fs.readFileSync(certPath)); - const now = new Date(); - assert.ok( - new Date(cert.validTo) > now, - `TLS cert "${certPath}" is still valid: cert.validTo="${cert.validTo}" (if this fails use 'npm run maint:regenerate-test-certs')` - ); - }); - }); - } - - describe('instance', () => { - it('should warn about headers when using grpc', () => { - // Need to stub/spy on the underlying logger as the 'diag' instance is global - const spyLoggerWarn = sinon.stub(diag, 'warn'); - collectorExporter = new OTLPLogExporter({ - url: address, - headers: { - foo: 'bar', - }, - }); - const args = spyLoggerWarn.args[0]; - assert.strictEqual(args[0], 'Headers cannot be set when using grpc'); - }); - it('should warn about path in url', () => { - if (new URL(address).protocol === 'unix:') { - // Skip this test for UDS - return; - } - const spyLoggerWarn = sinon.stub(diag, 'warn'); - collectorExporter = new OTLPLogExporter({ - url: `${address}/v1/logs`, - }); - const args = spyLoggerWarn.args[0]; - assert.strictEqual( - args[0], - 'URL path should not be set when using grpc, the path part of the URL will be ignored.' - ); - }); - }); - - describe('export', () => { - it('should export log records', done => { - const responseSpy = sinon.spy(); - const logRecords = [Object.assign({}, mockedReadableLogRecord)]; - collectorExporter.export(logRecords, responseSpy); - setTimeout(() => { - assert.ok( - typeof exportedData !== 'undefined', - 'resource' + " doesn't exist" - ); - - const logs = exportedData.scopeLogs[0].logRecords; - const resource = exportedData.resource; - - assert.ok(typeof logs !== 'undefined', 'log records do not exist'); - - ensureExportedLogRecordIsCorrect(logs[0]); - - assert.ok(typeof resource !== 'undefined', "resource doesn't exist"); - - ensureResourceIsCorrect(resource); - - ensureMetadataIsCorrect(reqMetadata, params?.metadata); +/* + * NOTE: Tests here are not intended to test the underlying components directly. They are intended as a quick + * check if the correct components are used. Use the following packages to test details: + * - `@opentelemetry/oltp-exporter-base`: OTLP common exporter logic (handling of concurrent exports, ...) + * - `@opentelemetry/otlp-transformer`: Everything regarding serialization and transforming internal representations to OTLP + * - `@opentelemetry/otlp-grpc-exporter-base`: gRPC transport + */ +describe('OTLPLogExporter', function () { + let shutdownHandle: () => void | undefined; + const serverTestContext: ServerTestContext = { + requests: [], + serverResponseProvider: () => { + return { error: null, buffer: Buffer.from([]) }; + }, + }; + + beforeEach(async function () { + shutdownHandle = await startServer( + 'localhost:1503', + testServiceDefinition, + serverTestContext + ); + }); - done(); - }, 500); - }); - it('should log deadline exceeded error', done => { - const credentials = useTLS - ? grpc.credentials.createSsl( - fs.readFileSync('./test/certs/ca.crt'), - fs.readFileSync('./test/certs/client.key'), - fs.readFileSync('./test/certs/client.crt') - ) - : grpc.credentials.createInsecure(); + afterEach(function () { + shutdownHandle(); - const collectorExporterWithTimeout = new OTLPLogExporter({ - url: address, - credentials, - metadata: metadata, - timeoutMillis: 100, - }); + // clear context + serverTestContext.requests = []; + serverTestContext.serverResponseProvider = () => { + return { error: null, buffer: Buffer.from([]) }; + }; + }); - const responseSpy = sinon.spy(); - const logRecords = [Object.assign({}, mockedReadableLogRecord)]; - collectorExporterWithTimeout.export(logRecords, responseSpy); + it('successfully exports data', async () => { + // arrange + const loggerProvider = new LoggerProvider(); + loggerProvider.addLogRecordProcessor( + new SimpleLogRecordProcessor( + new OTLPLogExporter({ + url: 'http://localhost:1503', + }) + ) + ); - setTimeout(() => { - const result = responseSpy.args[0][0] as core.ExportResult; - assert.strictEqual(result.code, core.ExportResultCode.FAILED); - assert.match( - responseSpy.args[0][0].error.details, - /Deadline exceeded.*/ - ); - done(); - }, 300); - }); + // act + loggerProvider.getLogger('test-logger').emit({ + body: 'test-body', }); - describe('export - with gzip compression', () => { - beforeEach(() => { - const credentials = useTLS - ? grpc.credentials.createSsl( - fs.readFileSync('./test/certs/ca.crt'), - fs.readFileSync('./test/certs/client.key'), - fs.readFileSync('./test/certs/client.crt') - ) - : grpc.credentials.createInsecure(); - collectorExporter = new OTLPLogExporter({ - url: address, - credentials, - metadata: metadata, - compression: CompressionAlgorithm.GZIP, - }); - }); - it('should successfully send the log records', done => { - const responseSpy = sinon.spy(); - const logRecords = [Object.assign({}, mockedReadableLogRecord)]; - collectorExporter.export(logRecords, responseSpy); - setTimeout(() => { - assert.ok( - typeof exportedData !== 'undefined', - 'resource' + " doesn't exist" - ); - const logs = exportedData.scopeLogs[0].logRecords; - const resource = exportedData.resource; - - assert.ok(typeof logs !== 'undefined', 'log records do not exist'); - ensureExportedLogRecordIsCorrect(logs[0]); + await loggerProvider.shutdown(); - assert.ok(typeof resource !== 'undefined', "resource doesn't exist"); - ensureResourceIsCorrect(resource); - - ensureMetadataIsCorrect(reqMetadata, metadata); - - done(); - }, 500); - }); - }); + // assert + assert.strictEqual(serverTestContext.requests.length, 1); }); -}; - -testCollectorExporter({ useTLS: true }); -testCollectorExporter({ useTLS: false }); -testCollectorExporter({ metadata }); -// skip UDS tests on windows -process.platform !== 'win32' && testCollectorExporter({ address: udsAddr }); +}); diff --git a/experimental/packages/exporter-logs-otlp-grpc/test/certs/ca.crt b/experimental/packages/exporter-logs-otlp-grpc/test/certs/ca.crt deleted file mode 100644 index 62270748a6e..00000000000 --- a/experimental/packages/exporter-logs-otlp-grpc/test/certs/ca.crt +++ /dev/null @@ -1,33 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFozCCA4ugAwIBAgIUAlsD9Gz58PTwA00z7LcmYLcREgswDQYJKoZIhvcNAQEL -BQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQHDBFPcGVuVGVs -ZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9vdDENMAsGA1UECwwEVGVzdDELMAkGA1UE -AwwCY2EwHhcNMjQwNjA4MTkxODQ4WhcNMjUwNjA4MTkxODQ4WjBhMQswCQYDVQQG -EwJDTDELMAkGA1UECAwCUk0xGjAYBgNVBAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0w -CwYDVQQKDARSb290MQ0wCwYDVQQLDARUZXN0MQswCQYDVQQDDAJjYTCCAiIwDQYJ -KoZIhvcNAQEBBQADggIPADCCAgoCggIBAMv6RFj5bgfSnj27LJMUwceaVI8Rz6Ks -BKRyJlM/cE3MQg+58BjoelLxfRsCxHFLvwuo/S6l0leRYAvzCexsnFnqd5Ie0tMi -1pB6YMPcmzUwbJCywLUGBin85TDFpEd1L1cSxKvi4DoC6EDYdBge0yp3T1my3mlu -8LaMVYr22RQvofwaTqFwmOQSqxK3wR9LRWTMDoUioMdolkIv7y1lpQ59ORWlASfP -SMUhh4KAYmDCtH9M40iY7kwCMv8ZwB2DIiw1qZxkk3MFJoyI5HZuvb586Pp5GfHI -Wry2KaTZskGCDB/8mURhMyFQnsO+kN9moYLm+NVk+8jzTTus4DUI6sEnpSgF05hU -O9lIL+HAFl/6N5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Bcvhetq1jVR8 -mjXEADzaP1a9+nMG+LFD+PeHcpYbuxaOwAinFbA1SwwGmAwWFhXudSiFpIM2btrE -f9n1KYObAw== ------END CERTIFICATE----- diff --git a/experimental/packages/exporter-logs-otlp-grpc/test/certs/ca.key b/experimental/packages/exporter-logs-otlp-grpc/test/certs/ca.key deleted file mode 100644 index 6d444ffdab8..00000000000 --- a/experimental/packages/exporter-logs-otlp-grpc/test/certs/ca.key +++ /dev/null @@ -1,52 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQDL+kRY+W4H0p49 -uyyTFMHHmlSPEc+irASkciZTP3BNzEIPufAY6HpS8X0bAsRxS78LqP0updJXkWAL -8wnsbJxZ6neSHtLTItaQemDD3Js1MGyQssC1BgYp/OUwxaRHdS9XEsSr4uA6AuhA -2HQYHtMqd09Zst5pbvC2jFWK9tkUL6H8Gk6hcJjkEqsSt8EfS0VkzA6FIqDHaJZC -L+8tZaUOfTkVpQEnz0jFIYeCgGJgwrR/TONImO5MAjL/GcAdgyIsNamcZJNzBSaM -iOR2br2+fOj6eRnxyFq8timk2bJBggwf/JlEYTMhUJ7DvpDfZqGC5vjVZPvI8007 -rOA1COrBJ6UoBdOYVDvZSC/hwBZf+jeXf1ucG0nzrpT8CQnfnOPcpSAFLt/GZjZk -aZhj2pQZZbg2LvBMcHf7qFwZreb8nhPXdeLk2GLfsXn/eNrOukJ6KvcCxScpkrDG -9b+NT7/843ledzSERMSdbEh/ucXEWgHb43Zjdquc7inXZA/9hciJdDZFsDWHnymh -XSxMvTH3WwYCgRzpIZ3k1iGcCPCpH3+r+TE1tNtjCu7954rNcFI67xJ9AsiPFEgo -f8HDQZoibKxD5bTfkgrK4mS8E9ceJnHvuN/m4m8Ypy/kWaIFsWf0Pk5HlLJbgTY5 -/IcFsuZ/++dByoEQGg/isRpJ/dgfbQIDAQABAoICACVqCWFclx8eNeJS09FCrGyl -VT9M4A4RiW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Y4y+2gbcQa2racjAR5uIE3/zl1W8/TzwymoHbxRdXscYcH1bdPV -aDheDbeV5Hwg9Mee7/Tpd/bs0oms+gh/vebND3AZG/E7v+QjTRVbKHkOq1kUHM0v -vci7xEl1X2TYMkMZbXkGsx21HOkfS0qi5gNjH6RDZC6G51Cx4nfy76hIwjIVtDXa -ui79Ftf71GfGkz8C7Vvg7XTuiZEUv+gnQTaQudguL7ERjt0z912S3lXMD2HkobO/ -Z4y6eNlrPgWPTUHp+YTgMmZ/c1kwHGo= ------END PRIVATE KEY----- diff --git a/experimental/packages/exporter-logs-otlp-grpc/test/certs/client.crt b/experimental/packages/exporter-logs-otlp-grpc/test/certs/client.crt deleted file mode 100644 index ff9555042c9..00000000000 --- a/experimental/packages/exporter-logs-otlp-grpc/test/certs/client.crt +++ /dev/null @@ -1,32 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFiDCCA3CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQGEwJDTDEL -MAkGA1UECAwCUk0xGjAYBgNVBAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0wCwYDVQQK -DARSb290MQ0wCwYDVQQLDARUZXN0MQswCQYDVQQDDAJjYTAeFw0yNDA2MDgxOTE4 -NDlaFw0yNTA2MDgxOTE4NDlaMGoxCzAJBgNVBAYTAkNMMQswCQYDVQQIDAJSTTEa -MBgGA1UEBwwRT3BlblRlbGVtZXRyeVRlc3QxDTALBgNVBAoMBFRlc3QxDzANBgNV -BAsMBkNsaWVudDESMBAGA1UEAwwJbG9jYWxob3N0MIICIjANBgkqhkiG9w0BAQEF -AAOCAg8AMIICCgKCAgEAwmlAXHz7CE3EQ7XEMNwYymj193+C3Mo6V210X2BKjCuZ -SRdq0c/VpAWeFy5f1SHzFEkvpmfXKjePrnQL9fT5bFwUusx1pepI1c+9eHMxiSxc -rpO5SPfEPfZPHOhZBUYEYI2MRektn0UaE/a9qiQpBh5fFtyMedLkyNkfJ2OAbwCJ -XRwmUpt5p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F+N36eKVGFIeFN/jQaLAE4pO -3qaVCEpQCPC4NoCW+lIOLtYQ+nTg6RVCHf26uZqkuHKqh/gGP9MCSEkg9b78iC8D -ciKxp4gz7CUUV+cmDMcDJxqAaBZnA+V0brVqDcYtul1UyanPN4WsJbBRG5s705vy -m7Fk4k2GWdfyEiOjrRd2EuezmemeSD4S9aIgtAGhggcIMtkJaSdS6zfjo/nuu2kO -A0+Bw3OOUbvnnJ0MlmLHeCSMPBCu4xVaKda8Lw== ------END CERTIFICATE----- diff --git a/experimental/packages/exporter-logs-otlp-grpc/test/certs/client.csr b/experimental/packages/exporter-logs-otlp-grpc/test/certs/client.csr deleted file mode 100644 index 1fe2d47932e..00000000000 --- a/experimental/packages/exporter-logs-otlp-grpc/test/certs/client.csr +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQH -DBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEVGVzdDEPMA0GA1UECwwGQ2xp -ZW50MRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQDCaUBcfPsITcRDtcQw3BjKaPX3f4LcyjpXbXRfYEqMK5lJF2rRz9Wk -BZ4XLl/VIfMUSS+mZ9cqN4+udAv19PlsXBS6zHWl6kjVz714czGJLFyuk7lI98Q9 -9k8c6FkFRgRgjYxF6S2fRRoT9r2qJCkGHl8W3Ix50uTI2R8nY4BvAIldHCZSm3ml -YAU5FcN5xUta1NJUxCxaw4j/aBp7p2BtNsl1dotRX9QWwE6WnqbWbBs+weJANrDE -zlqSzYCNEDv1oFIXUjHA70O6q/dmOoV3wLWdevuipXIS6NAW2MgC80kjVo/0y7k/ -Jtyn3bxWRBPw91FxosO3yK47KCAjzoIhPFUU66vwbEBIcXUQXjKaR8aNLmMIuHwE -uoAao0RFCmg3IPzv3JOWryGj+T8XSKf1bJoSNu4QqjrA+ElSBnUlXSoKmrGZOUaB -xYGDUyeXxF2YeSrrzOyZOkts/Om5eW/nUqYkJqFzfWNYcmM3U5E8Y+CEusqRtzKV -b/odOkjmLaSSf6TmjBQCSy3srSeNEflMXinuJi4LjPBKdODGW+Kj0TkKLoGKcyCQ -M6PA2i9fLrSZH5Gco/3LGWm4n+Ntm9H1rZJikxu7UKsEXJngmRMsIQIDquHpquNd -VbqtPASMqkyiqFleDsI27HuDGr9zOj1LolrTFU6eiZNEIctOAKgA5wIDAQABoAAw -DQYJKoZIhvcNAQELBQADggIBAHfjpZwmJgizjCW89+pYI0vhYH9LH22YhN7qzV6y -smS9JNRe/N3jCOadpKgsmx7W52+RZHkdst69dvg775cMJjQ6qNouXALydUHTloXj -2k562BeUCfDBFlBR06dRGdGNkAuntAEdn/uV7+wU2SyptPGpXW8HP5xHyYoqdIlA -tEqcb/Ue9WqG7oiP4X6FI56/4HjVt9PiFtCWZS1uU06eJSRufMDSzKzS12jNfm6C -TGHD0vnzzJdW2YkaGwAUa2Iluzm7lo3eD0QJOaa9RvquxPCjbIKnzJQuzOpcI6Lm -m/fd3fGxyAl6T8kCMnItzjFTgux7NuPps3oF/FKaiNqeL/HZXWLRRI74agzlvUP7 -10HqmUvw+diVka4+ve/8zmStn7pUb5IHd8C0OGbU/N2Y+UX++jYlI5W6vXGpjo76 -R2FMaG+crPAlOKZ9/7t9+NeoqYM5iW8zLiGTXX1Zx0UKMV2om3b8CXVsGrB3y7WG -j3ZYs/4apg9sNqsIs8+udOPkfx8a3a+ZvBlrCl3XavYCaUHoNH5+dThQWvMpaFAQ -Z2wKwuSkD9kTQqeTJUj684ztf2kDopM+nt9j54ZhrkfsDiGMUtz8Xk4SPYTdN/Yc -KKVBOnm/4Hr1bASAukkQmF7AEUyUG6eJVGrEP/5MWuWc6ddONFj+eiwyAd2OzVq7 -3tvv ------END CERTIFICATE REQUEST----- diff --git a/experimental/packages/exporter-logs-otlp-grpc/test/certs/client.key b/experimental/packages/exporter-logs-otlp-grpc/test/certs/client.key deleted file mode 100644 index 4cfd6bcdb31..00000000000 --- a/experimental/packages/exporter-logs-otlp-grpc/test/certs/client.key +++ /dev/null @@ -1,52 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIJRAIBADANBgkqhkiG9w0BAQEFAASCCS4wggkqAgEAAoICAQDCaUBcfPsITcRD -tcQw3BjKaPX3f4LcyjpXbXRfYEqMK5lJF2rRz9WkBZ4XLl/VIfMUSS+mZ9cqN4+u -dAv19PlsXBS6zHWl6kjVz714czGJLFyuk7lI98Q99k8c6FkFRgRgjYxF6S2fRRoT -9r2qJCkGHl8W3Ix50uTI2R8nY4BvAIldHCZSm3mlYAU5FcN5xUta1NJUxCxaw4j/ -aBp7p2BtNsl1dotRX9QWwE6WnqbWbBs+weJANrDEzlqSzYCNEDv1oFIXUjHA70O6 -q/dmOoV3wLWdevuipXIS6NAW2MgC80kjVo/0y7k/Jtyn3bxWRBPw91FxosO3yK47 -KCAjzoIhPFUU66vwbEBIcXUQXjKaR8aNLmMIuHwEuoAao0RFCmg3IPzv3JOWryGj -+T8XSKf1bJoSNu4QqjrA+ElSBnUlXSoKmrGZOUaBxYGDUyeXxF2YeSrrzOyZOkts -/Om5eW/nUqYkJqFzfWNYcmM3U5E8Y+CEusqRtzKVb/odOkjmLaSSf6TmjBQCSy3s -rSeNEflMXinuJi4LjPBKdODGW+Kj0TkKLoGKcyCQM6PA2i9fLrSZH5Gco/3LGWm4 -n+Ntm9H1rZJikxu7UKsEXJngmRMsIQIDquHpquNdVbqtPASMqkyiqFleDsI27HuD -Gr9zOj1LolrTFU6eiZNEIctOAKgA5wIDAQABAoICAADrNIfwswut8fZW2IQEJyhI -1wkwH1wI/GiZQTbRENkgLoLh3PL75Gjb+ijJ/19j4BKahpuDOAILH7unYqJrNwT+ -sNqcemvbz8H5ltwkXeRJWHDJN2HlSWu/i04PR7ak1VghBq29PInnbqS6u2bYY3V3 -cZyZqJCE0w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qiYjCz2U86QM+ -z306IHwAzlUTgWfXYyKkY8oFu/Jpw9k+aiVg+KPNIy4qnzimMcDjI3efU4ZxJHF1 -CwCTq2h46R5GzsLl6AasE//wi9qyepbS0zl2ZZ5S8/qPKqE110LaQFqc/6jmpqdM -GCjn3ccqyYWia5VCpKUwdjE0k/SMU8/D ------END PRIVATE KEY----- diff --git a/experimental/packages/exporter-logs-otlp-grpc/test/certs/regenerate.sh b/experimental/packages/exporter-logs-otlp-grpc/test/certs/regenerate.sh deleted file mode 100755 index cc052a4effe..00000000000 --- a/experimental/packages/exporter-logs-otlp-grpc/test/certs/regenerate.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env sh -# -# Regenerate certificates that are used for tests using TLS. -# Certs are generated with a one year expiry, so periodic regen is required. -# -# Usage: npm run maint:regenerate-test-certs - -rm ca.crt ca.key client.crt client.csr client.key server.crt server.csr server.key - -openssl genrsa -out ca.key 4096 -openssl req -new -x509 -days 365 -key ca.key -out ca.crt -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Root/OU=Test/CN=ca" - -openssl genrsa -out server.key 4096 -openssl req -new -key server.key -out server.csr -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Test/OU=Server/CN=localhost" -openssl x509 -req -days 365 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt -openssl rsa -in server.key -out server.key - -openssl genrsa -out client.key 4096 -openssl req -new -key client.key -out client.csr -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Test/OU=Client/CN=localhost" -openssl x509 -req -days 365 -in client.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out client.crt -openssl rsa -in client.key -out client.key diff --git a/experimental/packages/exporter-logs-otlp-grpc/test/certs/server.crt b/experimental/packages/exporter-logs-otlp-grpc/test/certs/server.crt deleted file mode 100644 index 99877d77596..00000000000 --- a/experimental/packages/exporter-logs-otlp-grpc/test/certs/server.crt +++ /dev/null @@ -1,32 +0,0 @@ ------BEGIN CERTI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cEBvHYSAf454noTuehlZvL6tCaAobZZMqsXSfvnVvkC -AwEAAaNCMEAwHQYDVR0OBBYEFFRmQkQkZmb8ER1Cx/6FOWmKXKlXMB8GA1UdIwQY -MBaAFCOWKzzaitEuaazjDV1skV/00M7rMA0GCSqGSIb3DQEBCwUAA4ICAQAYQHvf -s1hrdDUDzn6LQiAMbDh3VwEVOg3O/8uomn6+J/TCBkTAD6avMO3hZH28Kc5H4c8P -9db7rBkmqyOzOo7JG8xJz7vg90oh0sqo5+G73h9PQb7G8f6wCGJTD9IbRDcgCspW -Z8zIBZGxpeHHitdB2Jik1DxUkqViwxlBzBkiNpqixDde5U5EqxbecTBIuMqJkkxG -7JV61Mbb6r8xCNPqd1qYDQ6fggV1MFb6yf9TEuLmV2mKn1ypo/MzMBoTMGgKoHS8 -RgiN0bztRayaEqnmMZ5TQOYkmuGbW1oBwXeA7lorOu7/Yi4/IP0/H0rt/mSUhh5K -ubtZkWrsZV3xPeERYL9UiuOdEJ58tI3u3yDFvnULczH8bzapZisxQIfaMasq9aHg -LO8lqMk4+Kyb09vz+DPuMGdDkl4hchHlySUCrhmMmrCJTgQHmEmQMF+1TBP1cFXe -B9grn4zr+sVsqKNMArnQoUff42cFi1E5pZq7Z4DfGltcv81ay51OgTVxMJYOUB9Q -1PJcO0hkLrV66kSbTd5//6uyYuAOy5ZVXOFHOO/tDBlKlgOqYXe5tj90uZQh0AnJ -NeH73pwS3x9dF0JZBcviaH/yTK2ggi9lmzJ0EkwqUXyfYfJZGBgnLVDnNpXSUUha -v1h7xzhfZgYbWEgwV+AWiXlHTrZCXSmY3sM2QA== ------END CERTIFICATE----- diff --git a/experimental/packages/exporter-logs-otlp-grpc/test/certs/server.csr b/experimental/packages/exporter-logs-otlp-grpc/test/certs/server.csr deleted file mode 100644 index b459ff45ffd..00000000000 --- a/experimental/packages/exporter-logs-otlp-grpc/test/certs/server.csr +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIIErz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npq -o2ssCd2GmbMmiAdSJspgWJnCJUQneV0hW+l7b79oW8E0j4aZLQ7g0B3y2iTg2Ngk -0R301hh3Fs9B5PYa/TlOJsd4icgxvMjCvsIxHaihKjvNLDu3GhYRyHlxyAnZVvaG -GAqHn2WyvLeg2bMswy7FV9J6qI5PQVaApLb2g5TPbG6y52XgLMCl06fM25UbTaym -GCAEeylvXwIClPNlmnvLnytABHA5tLkfHt+E7UPJmPv8BuOeRTYtlp3UB/aI6rKG -HOMZnhUNZTVCnxid6gLEI7xMxdAKP6N1sWdcDD8bkcVEk8IjOJrpQzuYUchQwzZ+ -hZIact21gTuN5xhxq1f1gvEN0th1vUSjfZ0K67M9mgqNdza8fXOaUNc3XwRUxhfB -1kpXxDuH2dzjsy3CGeobry8nHmUB/P2KEy8u7ue7Ra3J4stFCPDRJqroRM3V8xNK -1+I2KBM8UeybFzYya9xqT9q0FNe/ukS2ohV5C1YjnxrMQ2Mx+CqJOVqpA/nP55ZE -cuZ8 ------END CERTIFICATE REQUEST----- diff --git a/experimental/packages/exporter-logs-otlp-grpc/test/certs/server.key b/experimental/packages/exporter-logs-otlp-grpc/test/certs/server.key deleted file mode 100644 index 8af97da4a70..00000000000 --- a/experimental/packages/exporter-logs-otlp-grpc/test/certs/server.key +++ /dev/null @@ -1,52 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIJQQIBADANBgkqhkiG9w0BAQEFAASCCSswggknAgEAAoICAQCzix+SBkGQYs12 -y/WLa1x+sw5+qb/vF8YdMLTmYENq2/feTREv70qFHvFuUBHdVp0A3weF22bOUH6R -1VixJkd5kMkWM6fBejExEXGg1bFzi39FPKPsl9a1hUv7YBeo69d4wEJjk3ei1LqL -/p6+h4F/isQqziHZsGhFPMSEEqUXvNEeSqeEGtNH++M4li9qxS17wpEVuwl6jECy -fmgItAcDn4MGCAF8Vfyk78kgZFht2muhnsBTSX2F1Mw/uJqQvWlki511E7CTqQXm -ZzbZPYl7L+xCnk6rGpP2a1vJmoN1CwVX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EAZkUfnIcL45SAAgxwrjFU -VlohYbgUJUwgfspkElBKjyKJ8AsyagkiUKzWYXoO4B/7qn9ztpjF2JgeMxgdyeuU -rEI5xDVqR3JGR1+eU3wL84yUX908hLzvZUldtNw4aPclAPT30zaeKctXQ63mQ0pH -iomcntmRocSntfp4LfrWJJXxD+5NKqcJQ9vuT+pP0vCYiCMEHkkdC8U3EWAbAr/r -Sg/TigYXNkxd2MD8sadjK6J5LL3QjBxZf4nI8kTDuzQQM7vra/QnrQKn+J4Yqo7v -1HvgU3Spd53Gqo0fSzdePjMQXol0UTstiunOMLYM8/af16QLSZsNHa0lO4AAyiK/ -YwKCAQB/5KSWIXXK050vrPvC67szVxMcV1hf5xequzadYHu0n89Abek6BtLLijkd -GLwy5uJS4lY0l8+gaTBf0geMvzo0Svkf+3V1NvnOLIC/+ebw+LKFlizYrFNbU7bQ -L9pnq0txJhmNSnyb0O0G4QopZLATxKVZIT+fTCZePcmPVQm7nlxOfzbEdxRLGeYo -gaWnKJ6rUag0dOTITmmh9L15sme3H6PnXzCHvee6T4FZLNTWZbBewXrTqeZLJa+S -8JhEszuAHjbMIG3MCfy5GdApLNaztKtlPlxnnrB7323QIbrWlL/60w1rKoiZs2y7 -LPnexONaL/II1DilmyNT5mZMXCXP ------END PRIVATE KEY----- diff --git a/experimental/packages/exporter-logs-otlp-grpc/test/logsHelper.ts b/experimental/packages/exporter-logs-otlp-grpc/test/logsHelper.ts deleted file mode 100644 index 21e151d2277..00000000000 --- a/experimental/packages/exporter-logs-otlp-grpc/test/logsHelper.ts +++ /dev/null @@ -1,175 +0,0 @@ -/* - * 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 { HrTime, TraceFlags } from '@opentelemetry/api'; -import { SeverityNumber } from '@opentelemetry/api-logs'; -import { Resource } from '@opentelemetry/resources'; -import * as assert from 'assert'; -import * as grpc from '@grpc/grpc-js'; -import { VERSION } from '@opentelemetry/core'; -import { - IAnyValue, - IKeyValue, - ILogRecord, - IResource, -} from '@opentelemetry/otlp-transformer'; -import { ReadableLogRecord } from '@opentelemetry/sdk-logs'; - -const traceIdArr = [ - 31, 16, 8, 220, 142, 39, 14, 133, 196, 10, 13, 124, 57, 57, 178, 120, -]; -const spanIdArr = [94, 16, 114, 97, 246, 79, 165, 62]; - -export const mockedReadableLogRecord: ReadableLogRecord = { - resource: Resource.default().merge( - new Resource({ - 'resource-attribute': 'some resource-attr value', - }) - ), - instrumentationScope: { - name: 'scope_name_1', - version: '0.1.0', - schemaUrl: 'http://url.to.schema', - }, - hrTime: [1680253513, 123241635] as HrTime, - hrTimeObserved: [1683526948, 965142784] as HrTime, - attributes: { - 'some-attribute': 'some attribute value', - }, - droppedAttributesCount: 0, - severityNumber: SeverityNumber.ERROR, - severityText: 'error', - body: 'some_log_body', - spanContext: { - traceFlags: TraceFlags.SAMPLED, - traceId: '1f1008dc8e270e85c40a0d7c3939b278', - spanId: '5e107261f64fa53e', - }, -}; - -export function ensureExportedAttributesAreCorrect(attributes: IKeyValue[]) { - assert.deepStrictEqual( - attributes, - [ - { - key: 'some-attribute', - value: { - stringValue: 'some attribute value', - value: 'stringValue', - }, - }, - ], - 'exported attributes are incorrect' - ); -} - -export function ensureExportedBodyIsCorrect(body?: IAnyValue) { - assert.deepStrictEqual( - body, - { stringValue: 'some_log_body', value: 'stringValue' }, - 'exported attributes are incorrect' - ); -} - -export function ensureExportedLogRecordIsCorrect(logRecord: ILogRecord) { - ensureExportedBodyIsCorrect(logRecord.body); - ensureExportedAttributesAreCorrect(logRecord.attributes); - assert.strictEqual( - logRecord.timeUnixNano, - '1680253513123241635', - 'timeUnixNano is wrong' - ); - assert.strictEqual( - logRecord.observedTimeUnixNano, - '1683526948965142784', - 'observedTimeUnixNano is wrong' - ); - assert.strictEqual( - logRecord.severityNumber, - 'SEVERITY_NUMBER_ERROR', - 'severityNumber is wrong' - ); - assert.strictEqual(logRecord.severityText, 'error', 'severityText is wrong'); - assert.strictEqual( - logRecord.droppedAttributesCount, - 0, - 'droppedAttributesCount is wrong' - ); - assert.strictEqual(logRecord.flags, TraceFlags.SAMPLED, 'flags is wrong'); - assert.deepStrictEqual( - logRecord.traceId, - Buffer.from(traceIdArr), - 'traceId is wrong' - ); - assert.deepStrictEqual( - logRecord.spanId, - Buffer.from(spanIdArr), - 'spanId is wrong' - ); -} - -export function ensureResourceIsCorrect(resource: IResource) { - assert.deepStrictEqual(resource, { - attributes: [ - { - key: 'service.name', - value: { - stringValue: `unknown_service:${process.argv0}`, - value: 'stringValue', - }, - }, - { - key: 'telemetry.sdk.language', - value: { - stringValue: 'nodejs', - value: 'stringValue', - }, - }, - { - key: 'telemetry.sdk.name', - value: { - stringValue: 'opentelemetry', - value: 'stringValue', - }, - }, - { - key: 'telemetry.sdk.version', - value: { - stringValue: VERSION, - value: 'stringValue', - }, - }, - { - key: 'resource-attribute', - value: { - stringValue: 'some resource-attr value', - value: 'stringValue', - }, - }, - ], - droppedAttributesCount: 0, - }); -} - -export function ensureMetadataIsCorrect( - actual?: grpc.Metadata, - expected?: grpc.Metadata -) { - //ignore user agent - expected?.remove('user-agent'); - actual?.remove('user-agent'); - assert.deepStrictEqual(actual?.getMap(), expected?.getMap() ?? {}); -} diff --git a/experimental/packages/exporter-logs-otlp-grpc/test/utils.ts b/experimental/packages/exporter-logs-otlp-grpc/test/utils.ts new file mode 100644 index 00000000000..8dc6ae14e0c --- /dev/null +++ b/experimental/packages/exporter-logs-otlp-grpc/test/utils.ts @@ -0,0 +1,72 @@ +/* + * 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 { + Metadata, + Server, + ServerCredentials, + ServiceDefinition, +} from '@grpc/grpc-js'; + +export interface ExportedData { + request: Buffer; + metadata: Metadata; +} + +export interface ServerTestContext { + requests: ExportedData[]; + serverResponseProvider: () => { error: Error | null; buffer?: Buffer }; +} + +/** + * Starts a customizable server that saves all responses to context.responses + * Returns data as defined in context.ServerResponseProvider + * + * @return shutdown handle, needs to be called to ensure that mocha exits + * @param address address to bind to + * @param service service to start + * @param context context for storing responses and to define server behavior. + */ +export function startServer( + address: string, + service: ServiceDefinition, + context: ServerTestContext +): Promise<() => void> { + const server = new Server(); + server.addService(service, { + export: (data: ExportedData, callback: any) => { + context.requests.push(data); + const response = context.serverResponseProvider(); + callback(response.error, response.buffer); + }, + }); + + return new Promise<() => void>((resolve, reject) => { + server.bindAsync( + address, + ServerCredentials.createInsecure(), + (error, port) => { + server.start(); + if (error != null) { + reject(error); + } + resolve(() => { + server.forceShutdown(); + }); + } + ); + }); +} diff --git a/experimental/packages/exporter-trace-otlp-grpc/package.json b/experimental/packages/exporter-trace-otlp-grpc/package.json index 84b83dd55d5..efa366d787a 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/package.json +++ b/experimental/packages/exporter-trace-otlp-grpc/package.json @@ -18,8 +18,7 @@ "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js", - "align-api-deps": "node ../../../scripts/align-api-deps.js", - "maint:regenerate-test-certs": "cd test/certs && ./regenerate.sh" + "align-api-deps": "node ../../../scripts/align-api-deps.js" }, "keywords": [ "opentelemetry", 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 801f85a36b9..85b6725c5eb 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/test/OTLPTraceExporter.test.ts +++ b/experimental/packages/exporter-trace-otlp-grpc/test/OTLPTraceExporter.test.ts @@ -14,295 +14,85 @@ * limitations under the License. */ -import * as protoLoader from '@grpc/proto-loader'; -import { diag } from '@opentelemetry/api'; +import { OTLPTraceExporter } from '../src'; +import { ServerTestContext, startServer } from './utils'; +import * as assert from 'assert'; import { - BasicTracerProvider, SimpleSpanProcessor, + BasicTracerProvider, } from '@opentelemetry/sdk-trace-base'; -import * as assert from 'assert'; -import * as crypto from 'crypto'; -import * as fs from 'fs'; -import * as grpc from '@grpc/grpc-js'; -import * as path from 'path'; -import * as sinon from 'sinon'; -import { OTLPTraceExporter } from '../src'; - -import { - ensureExportedSpanIsCorrect, - ensureMetadataIsCorrect, - ensureResourceIsCorrect, - mockedReadableSpan, -} from './traceHelper'; -import * as core from '@opentelemetry/core'; -import { CompressionAlgorithm } from '@opentelemetry/otlp-exporter-base'; -import { - IExportTraceServiceRequest, - IResourceSpans, -} from '@opentelemetry/otlp-transformer'; - -const traceServiceProtoPath = - 'opentelemetry/proto/collector/trace/v1/trace_service.proto'; -const includeDirs = [path.resolve(__dirname, '../../otlp-transformer/protos')]; - -const httpAddr = 'https://localhost:1501'; -const udsAddr = 'unix:///tmp/otlp-traces.sock'; - -type TestParams = { - address?: string; - useTLS?: boolean; - metadata?: grpc.Metadata; +const testServiceDefinition = { + export: { + path: '/opentelemetry.proto.collector.trace.v1.TraceService/Export', + requestStream: false, + responseStream: false, + requestSerialize: (arg: Buffer) => { + return arg; + }, + requestDeserialize: (arg: Buffer) => { + return arg; + }, + responseSerialize: (arg: Buffer) => { + return arg; + }, + responseDeserialize: (arg: Buffer) => { + return arg; + }, + }, }; -const metadata = new grpc.Metadata(); -metadata.set('k', 'v'); - -const testCollectorExporter = (params: TestParams) => { - const { address = httpAddr, useTLS, metadata } = params; - return describe(`OTLPTraceExporter - node ${ - useTLS ? 'with' : 'without' - } TLS, ${metadata ? 'with' : 'without'} metadata, target ${address}`, () => { - let collectorExporter: OTLPTraceExporter; - let server: grpc.Server; - let exportedData: IResourceSpans | undefined; - let reqMetadata: grpc.Metadata | undefined; - - before(done => { - server = new grpc.Server(); - protoLoader - .load(traceServiceProtoPath, { - keepCase: false, - longs: String, - enums: String, - defaults: true, - oneofs: true, - includeDirs, - }) - .then((packageDefinition: protoLoader.PackageDefinition) => { - const packageObject: any = - grpc.loadPackageDefinition(packageDefinition); - server.addService( - packageObject.opentelemetry.proto.collector.trace.v1.TraceService - .service, - { - Export: (data: { - request: IExportTraceServiceRequest; - metadata: grpc.Metadata; - }) => { - if (data.request.resourceSpans != null) { - exportedData = data.request.resourceSpans[0]; - } - reqMetadata = data.metadata; - }, - } - ); - const credentials = useTLS - ? grpc.ServerCredentials.createSsl( - fs.readFileSync('./test/certs/ca.crt'), - [ - { - cert_chain: fs.readFileSync('./test/certs/server.crt'), - private_key: fs.readFileSync('./test/certs/server.key'), - }, - ] - ) - : grpc.ServerCredentials.createInsecure(); - const serverAddr = new URL(address); - server.bindAsync( - serverAddr.protocol === 'https:' ? serverAddr.host : address, - credentials, - () => { - server.start(); - done(); - } - ); - }); - }); - - after(() => { - server.forceShutdown(); - }); - - beforeEach(done => { - const credentials = useTLS - ? grpc.credentials.createSsl( - fs.readFileSync('./test/certs/ca.crt'), - fs.readFileSync('./test/certs/client.key'), - fs.readFileSync('./test/certs/client.crt') - ) - : grpc.credentials.createInsecure(); - collectorExporter = new OTLPTraceExporter({ - url: address, - credentials, - metadata: metadata, - }); - - const provider = new BasicTracerProvider(); - provider.addSpanProcessor(new SimpleSpanProcessor(collectorExporter)); - done(); - }); - - afterEach(() => { - exportedData = undefined; - reqMetadata = undefined; - sinon.restore(); - }); - - if (useTLS && crypto.X509Certificate) { - it('test certs are valid', () => { - const certPaths = [ - './test/certs/ca.crt', - './test/certs/client.crt', - './test/certs/server.crt', - ]; - certPaths.forEach(certPath => { - const cert = new crypto.X509Certificate(fs.readFileSync(certPath)); - const now = new Date(); - assert.ok( - new Date(cert.validTo) > now, - `TLS cert "${certPath}" is still valid: cert.validTo="${cert.validTo}" (if this fails use 'npm run maint:regenerate-test-certs')` - ); - }); - }); - } - - describe('instance', () => { - it('should warn about headers when using grpc', () => { - // Need to stub/spy on the underlying logger as the 'diag' instance is global - const spyLoggerWarn = sinon.stub(diag, 'warn'); - collectorExporter = new OTLPTraceExporter({ - url: address, - headers: { - foo: 'bar', - }, - }); - const args = spyLoggerWarn.args[0]; - assert.strictEqual(args[0], 'Headers cannot be set when using grpc'); - }); - it('should warn about path in url', () => { - if (new URL(address).protocol === 'unix:') { - // Skip this test for UDS - return; - } - const spyLoggerWarn = sinon.stub(diag, 'warn'); - collectorExporter = new OTLPTraceExporter({ - url: `${address}/v1/trace`, - }); - const args = spyLoggerWarn.args[0]; - assert.strictEqual( - args[0], - 'URL path should not be set when using grpc, the path part of the URL will be ignored.' - ); - }); - }); - - describe('export', () => { - it('should export spans', done => { - const responseSpy = sinon.spy(); - const spans = [Object.assign({}, mockedReadableSpan)]; - collectorExporter.export(spans, responseSpy); - setTimeout(() => { - assert.ok( - typeof exportedData !== 'undefined', - 'resource' + " doesn't exist" - ); - - const spans = exportedData.scopeSpans[0].spans; - const resource = exportedData.resource; - - assert.ok(typeof spans !== 'undefined', 'spans do not exist'); - - ensureExportedSpanIsCorrect(spans[0]); - - assert.ok(typeof resource !== 'undefined', "resource doesn't exist"); - - ensureResourceIsCorrect(resource); - - ensureMetadataIsCorrect(reqMetadata, params?.metadata); - - done(); - }, 500); - }); - it('should log deadline exceeded error', done => { - const credentials = useTLS - ? grpc.credentials.createSsl( - fs.readFileSync('./test/certs/ca.crt'), - fs.readFileSync('./test/certs/client.key'), - fs.readFileSync('./test/certs/client.crt') - ) - : grpc.credentials.createInsecure(); +/* + * NOTE: Tests here are not intended to test the underlying components directly. They are intended as a quick + * check if the correct components are used. Use the following packages to test details: + * - `@opentelemetry/oltp-exporter-base`: OTLP common exporter logic (handling of concurrent exports, ...) + * - `@opentelemetry/otlp-transformer`: Everything regarding serialization and transforming internal representations to OTLP + * - `@opentelemetry/otlp-grpc-exporter-base`: gRPC transport + */ +describe('OTLPTraceExporter', function () { + let shutdownHandle: () => void | undefined; + const serverTestContext: ServerTestContext = { + requests: [], + serverResponseProvider: () => { + return { error: null, buffer: Buffer.from([]) }; + }, + }; + + beforeEach(async function () { + shutdownHandle = await startServer( + 'localhost:1501', + testServiceDefinition, + serverTestContext + ); + }); - const collectorExporterWithTimeout = new OTLPTraceExporter({ - url: address, - credentials, - metadata: metadata, - timeoutMillis: 100, - }); + afterEach(function () { + shutdownHandle(); - const responseSpy = sinon.spy(); - const spans = [Object.assign({}, mockedReadableSpan)]; - collectorExporterWithTimeout.export(spans, responseSpy); + // clear context + serverTestContext.requests = []; + serverTestContext.serverResponseProvider = () => { + return { error: null, buffer: Buffer.from([]) }; + }; + }); - setTimeout(() => { - const result = responseSpy.args[0][0] as core.ExportResult; - assert.strictEqual(result.code, core.ExportResultCode.FAILED); - assert.match( - responseSpy.args[0][0].error.details, - /Deadline exceeded.*/ - ); - done(); - }, 300); - }); + it('successfully exports data', async () => { + // arrange + const tracerProvider = new BasicTracerProvider({ + spanProcessors: [ + new SimpleSpanProcessor( + new OTLPTraceExporter({ + url: 'http://localhost:1501', + }) + ), + ], }); - describe('export - with gzip compression', () => { - beforeEach(() => { - const credentials = useTLS - ? grpc.credentials.createSsl( - fs.readFileSync('./test/certs/ca.crt'), - fs.readFileSync('./test/certs/client.key'), - fs.readFileSync('./test/certs/client.crt') - ) - : grpc.credentials.createInsecure(); - collectorExporter = new OTLPTraceExporter({ - url: address, - credentials, - metadata: metadata, - compression: CompressionAlgorithm.GZIP, - }); - - const provider = new BasicTracerProvider(); - provider.addSpanProcessor(new SimpleSpanProcessor(collectorExporter)); - }); - it('should successfully send the spans', done => { - const responseSpy = sinon.spy(); - const spans = [Object.assign({}, mockedReadableSpan)]; - collectorExporter.export(spans, responseSpy); - setTimeout(() => { - assert.ok( - typeof exportedData !== 'undefined', - 'resource' + " doesn't exist" - ); - const spans = exportedData.scopeSpans[0].spans; - const resource = exportedData.resource; - assert.ok(typeof spans !== 'undefined', 'spans do not exist'); - ensureExportedSpanIsCorrect(spans[0]); + // act + tracerProvider.getTracer('test-tracer').startSpan('test-span').end(); + await tracerProvider.shutdown(); - assert.ok(typeof resource !== 'undefined', "resource doesn't exist"); - ensureResourceIsCorrect(resource); - - ensureMetadataIsCorrect(reqMetadata, metadata); - - done(); - }, 500); - }); - }); + // assert + assert.strictEqual(serverTestContext.requests.length, 1); }); -}; - -testCollectorExporter({ useTLS: true }); -testCollectorExporter({ useTLS: false }); -testCollectorExporter({ metadata }); -// skip UDS tests on windows -process.platform !== 'win32' && testCollectorExporter({ address: udsAddr }); +}); diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/certs/ca.crt b/experimental/packages/exporter-trace-otlp-grpc/test/certs/ca.crt deleted file mode 100644 index 08075df43be..00000000000 --- a/experimental/packages/exporter-trace-otlp-grpc/test/certs/ca.crt +++ /dev/null @@ -1,33 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFozCCA4ugAwIBAgIUFk1cYj0iRoo2KlsL519xVhA3k/gwDQYJKoZIhvcNAQEL -BQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQHDBFPcGVuVGVs -ZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9vdDENMAsGA1UECwwEVGVzdDELMAkGA1UE -AwwCY2EwHhcNMjQwNjA4MTkxODUwWhcNMjUwNjA4MTkxODUwWjBhMQswCQYDVQQG -EwJDTDELMAkGA1UECAwCUk0xGjAYBgNVBAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0w -CwYDVQQKDARSb290MQ0wCwYDVQQLDARUZXN0MQswCQYDVQQDDAJjYTCCAiIwDQYJ -KoZIhvcNAQEBBQADggIPAD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YdWfWaqwkP6Vp -Icx4asgi8rdG4bdRU1EL87J1ReXheXf+jRLu/bWbNBWC/o6C21abK7DZHrpKv8xf -WeCNw3wczbdQrAQ96FgJwxloIvCjOZKWNI3vAAcB9aEYMTxcCO2iV0Q+ihIIAg7M -kTbkjoKbVWAFDbtdwSDvOVv+G/tfb8E7k5rZrBDvsKCbdaR238LIZITgZ8mtLvS7 -DeWlDL9GlFKxNkz64dgSSxpYTOdZKO2/Dty/0LydmlsSz85GeSYXIPlzAp5Zcg+x -Rs1/zkrWGlnaos9uQj7xKj8B0ltrDLkI0mrX5TFuc9/lbGaJMT3n5jMlcfMUOwgV -3jCo3i2plrxhLE22tK9M26a0NywkCrygRGiu2fgrunQgLTAbC4EyK1crZYoFXyhI -Tq//oOEjNgGF8yvDUDh2R2CndsH+w3+P+Z0IrM3xRCqSWFOEvyOJ7pBfiesUwSbI -nkERQqdGug== ------END CERTIFICATE----- diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/certs/ca.key b/experimental/packages/exporter-trace-otlp-grpc/test/certs/ca.key deleted file mode 100644 index fa1f66e65fc..00000000000 --- a/experimental/packages/exporter-trace-otlp-grpc/test/certs/ca.key +++ /dev/null @@ -1,52 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQC9DaitiHi+nwcH -RMh3sFhHaQYwn9UMR0vHo4CU13CPJlAoo5/0OFqMd2TYlQGnf8thE2DUVhMaOGdC -1KvyhUa3c+KAXMVNC5Yn8OSm6cOB2ZOls7xsNRYTmjjrgm2gUWCS51cuNgKa2H5p -J7ydW/4gKDi5mK5SVCTobUojnN62Q6vwN9NU8CyferzlZ6CaIRn/WqmKD+hFRGEi -C6Wj70TeXTfB3z26xFhRJS8NYXjBIr12o8UOMBHR94+dJVOdDXJlAvNetvQmvg4m -vcizfpXmI2VoXpYb9pXuJP6agteAn2fdV222/1n1U584Epl3Ywg6Vys1emHRimt7 -d7mAHL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io -IwzfabEfEX64ie1+LnTUa24J/CALz1QizyaOTj8+REIgvozhiW46WA4i/D/EOfyr -L9TydZBgpw80bY4IAZYwY/doKbZZfNpEydRL1BegxhokulpFqIAzqQsFYpfpQtqu -GdZFror+9ymOopHPG4nSTl6vgNzSxpB+YkiBgjDgNvSVSonYgSWdhxhTnyB8gQoQ -FunfnnqFSsZ6pjE05/LN+4P5ReubirDmp6fvBWpak8FNmAPDVU7yHL15QGFvNDKr -x2ZGBcaGPGOgqwL9wc5OWNT5YF1ZiEJ6lYzueU9J8St7y44CKHOyT320WIpNKGM7 -oQKCAQEAhNUlKUP6fKrw9sW6q3KSpezQEnwIgFraGMR7t3Mzyy4Hmin+Sh6b4FKy -hklbCbMM2q9hXUQMlKCxpmcOx4VhHWg1gJ5vh9DqofJ9BtLrDeAqxZtiL3kr3xHR -/BKsKopPUgm0zayGXYChnT36m58aFNqSt2OyNee9x3Zdd5YUDkk4rN4cIoxF9yfv -qdEHX0CB8vLw91BHFXUt6vKm9UGpYvT9mg82wyCWI7IR0MU6vGFmmcc6NYaMK52W -fwGQWe8SjbKPYYuXwHzjninSPdsB50Drs1oMttz1kSM7AhbicymRZM9AOKkLlzOh -MKrxFkhV1ynkDphHDFz5xXbumyvCNw== ------END PRIVATE KEY----- diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/certs/client.crt b/experimental/packages/exporter-trace-otlp-grpc/test/certs/client.crt deleted file mode 100644 index 80f6c147e74..00000000000 --- a/experimental/packages/exporter-trace-otlp-grpc/test/certs/client.crt +++ /dev/null @@ -1,32 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFiDCCA3CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQGEwJDTDEL -MAkGA1UECAwCUk0xGjAYBgNVBAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0wCwYDVQQK -DARSb290MQ0wCwYDVQQLDARUZXN0MQswCQYDVQQDDAJjYTAeFw0yNDA2MDgxOTE4 -NTBaFw0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mkJlBYiv1CGmn+CE97CWSoIz3gxPWJs -fe8crVlQXflOm3fvWFzLXqK2026v/Ql1s6GcoG2YCBJLvJYtSrMRUecP48K1qkAA -m0b7nxM5nKx2pvMYMN+TqBEhjOCCAKgRqCZbhO+oN36n1LcGUpjWy2aCg9N3QBq/ -jlZrOC019eiB97HZOmM27hGKmLflIqLklDBG28ANBSk18Nh7AvH9PZ4QWAZBcAmB -RJ5/DncdFooHeQVJYyH28lkdvAruFA8YONWgP4rmwBLGBmaKKw3ZxkghV1XKDfCj -tAlxSLj+WutnKo1E5EML7PAVLhhTfHKx+C7JLjjonyJhr+vozdNSWaYWcaTHMN2l -s+Hadsi1AmLaYbL/9lVVV1+v+IiPlisMAm+T5PBxnxuiuwARBh3UCeFEkSWmpmA4 -EE9RQ3/JKhqGZRMyRg2tlodgOvSyAlXe+h6MbUF8IRgdvXfgrlGEDYVbLOqW6D8K -KNO+1hqNdXKC7am7nDH41JlU5CUxSQISOgRV92IJ3jeGMUF35lfYERlR4E9K2TrT -NXsvLp3Vf7nqfQNhSji3r/hsEEs/ni7fo1SbuaZjX1bGyAGZnMSQMJWyBCeucxsd -WRHY+ANKPbPWedOdaMn3uGBXndUHFMPu6cyk6w== ------END CERTIFICATE----- diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/certs/client.csr b/experimental/packages/exporter-trace-otlp-grpc/test/certs/client.csr deleted file mode 100644 index cee04b8bd64..00000000000 --- a/experimental/packages/exporter-trace-otlp-grpc/test/certs/client.csr +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQH -DBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEVGVzdDEPMA0GA1UECwwGQ2xp -ZW50MRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQCnwuWtvDP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thb7Mpu7/CeaowVSekeOTR4xcAvCeLJ1pf+UJscXnCYSPkajzCxAXMzR -76Aruzoigk4DGVAYfPQuTdD+Ap397LUI8MbhoZQ6UEfvslubblOAoHzTqLxJ3WWt -/QhuDBQVWoHtIArkPP9kI6PFstwUw+HW5nctO7HQeCBQ7FKHlFEgCUSFedbZNy9A -daGXHM53IqDA2jpnkujLoGOxLQV3IsymoKGTyFOxP2AJMeAiKYG+xTUxHYCp4Z99 -cM/bPRQJKCYECb+ZQ13dLT9uBJdjIH2lve1UYXdyUC9Y8dNwV5Bvht5P87rDZChX -8IR+ ------END CERTIFICATE REQUEST----- diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/certs/client.key b/experimental/packages/exporter-trace-otlp-grpc/test/certs/client.key deleted file mode 100644 index 7681e0a5e7e..00000000000 --- a/experimental/packages/exporter-trace-otlp-grpc/test/certs/client.key +++ /dev/null @@ -1,52 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQCnwuWtvDP1ctpL -a+tujy9AH8qz+RgTsR+HjHeFkUPUhWP/uxw2EEklOw7coaZ+4odwmqEKnvOAZ4Ro -X9yIHZXcmYXX49yaM4ZnJabx62KhLe6p9ORLfvpvppnRXKXgnXSAJgRqJpyZg/Fd -spPPdPX+IP1w2YBM3KIkWJVEc/YRFNZE4JSdVWC7KscIlWhcQAJrtzuVUZ++Mwlr -nrDdf4638m0bWihuHKcbfdQ73/dL+YmqJ6sW3tDtu/G+fmloGS1Q7n2pMS8OxOYv -bwG6PgQeMESkQm+uvkgMantnfT89fFZjraXqeJ8wRr9Bf8THFi3MeXrEuTg5vfyg -DyL+vPg3qAkWdWrZ1j+WKnovhop+D36KdSSrJ2sbTXzwQltDz+93QrjB9144hM0Z -IvcgYE0AG8mxfSw7H2onFJMV03P49mynSt5lVxPsA3XJjNhJqa+2gj1KDbdkJWdd -NiJRRos4CiovGCEosTyxO7cBw00C5m9MOh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ej8TuweSgc0dL1tPdwcfHPdlH7dKH0yd3gDThVm -xO5nXy5CKamQkg3Q/N+EwIRQDfBpo8UuNxksFzEjLK2ozTNU+/nelE66oZF8hZQA -VX981TvYCqHhJXdgxSn230MKgbB9BY1q13v9gb8xm72I7Jz9+9peiNLZt3JwFGe1 -OTECggEBAI2p9rMyLqiWz0WuUtFtTwAeNbGeapijieqKe2TCqsYeNXGRd2usXg94 -DyR0EfyBquHazH3pmfHE4yMFr/S2vnszWdQ4ZBluqOQk3E4GXxP/ucHdCrI/3pdk -6EE6Pgj/esQKrzB150UVsNWozYKD/MSog76FkdGcLc6Z+JjiIGUEJYhonuhrV+S3 -U82giIeb7chjCd73CU8P/xr6Dcu13odQLRASMZyeh9mBUZf/Bc6tXbkGZmJpFb1h -NFBm7idC907JEWv4tXP9LM5zO5PmsExQu8J26S0LxZSQSvW4mOmhNpQ1CBOQrvPE -oZy6rwoqrtLFacr41Jy5fq4MvMmkxwo= ------END PRIVATE KEY----- diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/certs/regenerate.sh b/experimental/packages/exporter-trace-otlp-grpc/test/certs/regenerate.sh deleted file mode 100755 index cc052a4effe..00000000000 --- a/experimental/packages/exporter-trace-otlp-grpc/test/certs/regenerate.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env sh -# -# Regenerate certificates that are used for tests using TLS. -# Certs are generated with a one year expiry, so periodic regen is required. -# -# Usage: npm run maint:regenerate-test-certs - -rm ca.crt ca.key client.crt client.csr client.key server.crt server.csr server.key - -openssl genrsa -out ca.key 4096 -openssl req -new -x509 -days 365 -key ca.key -out ca.crt -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Root/OU=Test/CN=ca" - -openssl genrsa -out server.key 4096 -openssl req -new -key server.key -out server.csr -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Test/OU=Server/CN=localhost" -openssl x509 -req -days 365 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt -openssl rsa -in server.key -out server.key - -openssl genrsa -out client.key 4096 -openssl req -new -key client.key -out client.csr -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Test/OU=Client/CN=localhost" -openssl x509 -req -days 365 -in client.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out client.crt -openssl rsa -in client.key -out client.key diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/certs/server.crt b/experimental/packages/exporter-trace-otlp-grpc/test/certs/server.crt deleted file mode 100644 index db941affc40..00000000000 --- a/experimental/packages/exporter-trace-otlp-grpc/test/certs/server.crt +++ /dev/null @@ -1,32 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFiDCCA3CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQGEwJDTDEL -MAkGA1UECAwCUk0xGjAYBgNVBAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0wCwYDVQQK -DARSb290MQ0wCwYDVQQLDARUZXN0MQswCQYDVQQDDAJjYTAeFw0yNDA2MDgxOTE4 -NTBaFw0yNTA2MDgxOTE4NTBaMGoxCzAJBgNVBAYTAkNMMQswCQYDVQQIDAJSTTEa -MBgGA1UEBwwRT3BlblRlbGVtZXRyeVRlc3QxDTALBgNVBAoMBFRlc3QxDzANBgNV -BAsMBlNlcnZlcjESMBAGA1UEAwwJbG9jYWxob3N0MIICIjANBgkqhkiG9w0BAQEF -AAOCAg8AMIICCgKCAgEAho9Odc3xj0yN5rlGePl4NG5FAhLeoG4zsPm8Wq/F8tYV -RGNuBv4FbfIwscWc21vN5vxIazlNe+wR9gs+JPXQqetJNBzoKyCnY5JWbUxhD69o -5CqYUifWBML2+9fJlfPDRyLjZ63PaXw1lM+25F46qLC5VYaXcR8+OUf7SIOJnS6n -1ZT1s5038tJdHw3pkep/hwaFuMAXEkAgemL/OOYJw4RSGAIGjXdsbDhTzIHovIwu -LmyAAOivF/FPdTFoMdy08au7t21GMQKSa/eoJ6luMfy67DsqJ5FRFc570ZTjejOq -VeLrxjjEGOHndZy550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2li6RRzGfY0kfxrH -yRGbvxLgpTD3rgFTR2mTDz2Q6UODWriQ7cgmQ8OV+t61v92Di0OnXWVRUCNI+/P9 -xmNKrMU+gfM7amKc4N3oMKZgVtQexHNm7+Geng== ------END CERTIFICATE----- diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/certs/server.csr b/experimental/packages/exporter-trace-otlp-grpc/test/certs/server.csr deleted file mode 100644 index 6ac87e971b2..00000000000 --- a/experimental/packages/exporter-trace-otlp-grpc/test/certs/server.csr +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQH -DBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEVGVzdDEPMA0GA1UECwwGU2Vy -dmVyMRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQCGj051zfGPTI3muUZ4+Xg0bkUCEt6gbjOw+bxar8Xy1hVEY24G/gVt -8jCxxZzbW83m/EhrOU177BH2Cz4k9dCp60k0HOgrIKdjklZtTGEPr2jkKphSJ9YE -wvb718mV88NHIuNnrc9pfDWUz7bkXjqosLlVhpdxHz45R/tIg4mdLqfVlPWznTfy -0l0fDemR6n+HBoW4wBcSQCB6Yv845gnDhFIYAgaNd2xsOFPMgei8jC4ubIAA6K8X -8U91MWgx3LTxq7u3bUYxApJr96gnqW4x/LrsOyonkVEVznvRlON6M6pV4uvGOMQY -4ed1nLnnScgHnT66SaMbB2ATJBngaJ7actyRAx+AA8bouzGLEGgCDUF+badEN4QD -zv7lVY8IHEAnhasPbgePFNLQ/uBecCdgLwLEGiXDp4aFgTjOsCgLQZC3JTmIt1vc -n2Nu9X86MeY1wwBtCs60X4sL47RhHpNJwXIxRDLUPMI81KMHosD5uitDC76LHIWV -IBZNt3QJsF6nWTMEoZvDhY/uipTToUCJuDlMOLNkh7Lql6reJr7SBonTxj0GImzQ -gKUM/XOFO1dqeNGwh+Kiz25xjNmIHbJ8QpmFuUGrx6r/Pvuywv/ioN9zNsWb3Byr -bY++yf+xjrRSo2TGB9m9QPOEN1d3kQGi5R3rsoQRbe/oA7LYAb9hiQIDAQABoAAw -DQYJKoZIhvcNAQELBQADggIBAA6azFPc6LFR3wm8VkPXwQuAEMk8MwTWdSL/7NGf -tW1AwlXaTVfzD+Q+lDqFCIBeDz783jC8CUzlLwToncQFIKJINE4Df16uX/UDe4Ez -yyKeuyBKGiPPktmgtYKGnzQNXoJmJ4QjWUyZNxR1qojyj/niVc11WJbKjF1xOl9H -RAf0W6HGLwjov68ZcHeaShE7utMPLTxa13LQh66bUGkIW9mtu20y9YRjRf9j3Y3n -56qfRk0f8e/qqnG8EZr+KITm8W3abfDG2onozVYFTWZQ8dJhlYrKmBBoMjnpmG/7 -1DP59Ar+59ikpAtvtbdohhunlcMAcYKfZ/AIb4YcUdjbdMxPgfTEwMso4NL2p1at -B/B26xqjolUz92oqByYn6G+t6MH9O5jDFvgazg1vVRIDXScxWj26VS37JE5qs7o6 -L5mWCc9XJpMocEX3goeFPERvFs6Ar6RH+j+wQQrHB7mIMBoLbxMQz+ZM6xbkwkv9 -JpRTCbbDUNZSC7FzNRDhlj22x4FnDhNOIwsUu8jH+Hm6c4Nudj+uxowdPvjFkF32 -0o4INWpBLY01SNKhkHuzsbbPvSzx3wx7fB2zHZFvQ558bRBc8j8SrxGegOtEiBkF -tMTNObLaMHUAQ0y7izjcqFe2DBq8knc/kY9/QCkD5/0Zb/hYz8VnSvdmY2VrXcOn -bdO+ ------END CERTIFICATE REQUEST----- diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/certs/server.key b/experimental/packages/exporter-trace-otlp-grpc/test/certs/server.key deleted file mode 100644 index 66969c7f7ca..00000000000 --- a/experimental/packages/exporter-trace-otlp-grpc/test/certs/server.key +++ /dev/null @@ -1,52 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIJQ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E KEY----- diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/traceHelper.ts b/experimental/packages/exporter-trace-otlp-grpc/test/traceHelper.ts deleted file mode 100644 index 62157741a89..00000000000 --- a/experimental/packages/exporter-trace-otlp-grpc/test/traceHelper.ts +++ /dev/null @@ -1,328 +0,0 @@ -/* - * 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 { SpanStatusCode, TraceFlags } from '@opentelemetry/api'; -import { Resource } from '@opentelemetry/resources'; -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'; - -const traceIdArr = [ - 31, 16, 8, 220, 142, 39, 14, 133, 196, 10, 13, 124, 57, 57, 178, 120, -]; -const spanIdArr = [94, 16, 114, 97, 246, 79, 165, 62]; -const parentIdArr = [120, 168, 145, 80, 152, 134, 67, 136]; - -export const mockedReadableSpan: ReadableSpan = { - name: 'documentFetch', - kind: 0, - spanContext: () => { - return { - traceId: '1f1008dc8e270e85c40a0d7c3939b278', - spanId: '5e107261f64fa53e', - traceFlags: TraceFlags.SAMPLED, - }; - }, - parentSpanId: '78a8915098864388', - startTime: [1574120165, 429803070], - endTime: [1574120165, 438688070], - ended: true, - status: { code: SpanStatusCode.OK }, - attributes: { component: 'document-load' }, - links: [ - { - context: { - traceId: '1f1008dc8e270e85c40a0d7c3939b278', - spanId: '78a8915098864388', - traceFlags: TraceFlags.SAMPLED, - }, - attributes: { component: 'document-load' }, - }, - ], - events: [ - { - name: 'fetchStart', - time: [1574120165, 429803070], - }, - { - name: 'domainLookupStart', - time: [1574120165, 429803070], - }, - { - name: 'domainLookupEnd', - time: [1574120165, 429803070], - }, - { - name: 'connectStart', - time: [1574120165, 429803070], - }, - { - name: 'connectEnd', - time: [1574120165, 429803070], - }, - { - name: 'requestStart', - time: [1574120165, 435513070], - }, - { - name: 'responseStart', - time: [1574120165, 436923070], - }, - { - name: 'responseEnd', - time: [1574120165, 438688070], - }, - ], - duration: [0, 8885000], - resource: Resource.default().merge( - new Resource({ - service: 'ui', - version: 1, - cost: 112.12, - }) - ), - instrumentationLibrary: { name: 'default', version: '0.0.1' }, - droppedAttributesCount: 0, - droppedEventsCount: 0, - droppedLinksCount: 0, -}; - -export function ensureExportedEventsAreCorrect(events: IEvent[]) { - assert.deepStrictEqual( - events, - [ - { - attributes: [], - timeUnixNano: '1574120165429803070', - name: 'fetchStart', - droppedAttributesCount: 0, - }, - { - attributes: [], - timeUnixNano: '1574120165429803070', - name: 'domainLookupStart', - droppedAttributesCount: 0, - }, - { - attributes: [], - timeUnixNano: '1574120165429803070', - name: 'domainLookupEnd', - droppedAttributesCount: 0, - }, - { - attributes: [], - timeUnixNano: '1574120165429803070', - name: 'connectStart', - droppedAttributesCount: 0, - }, - { - attributes: [], - timeUnixNano: '1574120165429803070', - name: 'connectEnd', - droppedAttributesCount: 0, - }, - { - attributes: [], - timeUnixNano: '1574120165435513070', - name: 'requestStart', - droppedAttributesCount: 0, - }, - { - attributes: [], - timeUnixNano: '1574120165436923070', - name: 'responseStart', - droppedAttributesCount: 0, - }, - { - attributes: [], - timeUnixNano: '1574120165438688070', - name: 'responseEnd', - droppedAttributesCount: 0, - }, - ], - 'exported events are incorrect' - ); -} - -export function ensureExportedAttributesAreCorrect(attributes: IKeyValue[]) { - assert.deepStrictEqual( - attributes, - [ - { - key: 'component', - value: { - stringValue: 'document-load', - value: 'stringValue', - }, - }, - ], - 'exported attributes are incorrect' - ); -} - -export function ensureExportedLinksAreCorrect(attributes: ILink[]) { - assert.deepStrictEqual( - attributes, - [ - { - attributes: [ - { - key: 'component', - value: { - stringValue: 'document-load', - value: 'stringValue', - }, - }, - ], - traceId: Buffer.from(traceIdArr), - spanId: Buffer.from(parentIdArr), - traceState: '', - droppedAttributesCount: 0, - }, - ], - 'exported links are incorrect' - ); -} - -export function ensureExportedSpanIsCorrect(span: ISpan) { - if (span.attributes) { - ensureExportedAttributesAreCorrect(span.attributes); - } - if (span.events) { - ensureExportedEventsAreCorrect(span.events); - } - if (span.links) { - ensureExportedLinksAreCorrect(span.links); - } - assert.deepStrictEqual( - span.traceId, - Buffer.from(traceIdArr), - 'traceId is wrong' - ); - assert.deepStrictEqual( - span.spanId, - Buffer.from(spanIdArr), - 'spanId is wrong' - ); - assert.strictEqual(span.traceState, '', 'traceState is wrong'); - assert.deepStrictEqual( - span.parentSpanId, - Buffer.from(parentIdArr), - 'parentIdArr is wrong' - ); - assert.strictEqual(span.name, 'documentFetch', 'name is wrong'); - assert.strictEqual(span.kind, 'SPAN_KIND_INTERNAL', 'kind is wrong'); - assert.strictEqual( - span.startTimeUnixNano, - '1574120165429803070', - 'startTimeUnixNano is wrong' - ); - assert.strictEqual( - span.endTimeUnixNano, - '1574120165438688070', - 'endTimeUnixNano is wrong' - ); - assert.strictEqual( - span.droppedAttributesCount, - 0, - 'droppedAttributesCount is wrong' - ); - assert.strictEqual(span.droppedEventsCount, 0, 'droppedEventsCount is wrong'); - assert.strictEqual(span.droppedLinksCount, 0, 'droppedLinksCount is wrong'); - assert.deepStrictEqual( - span.status, - { - code: 'STATUS_CODE_OK', - message: '', - }, - 'status is wrong' - ); -} - -export function ensureResourceIsCorrect(resource: IResource) { - assert.deepStrictEqual(resource, { - attributes: [ - { - key: 'service.name', - value: { - stringValue: `unknown_service:${process.argv0}`, - value: 'stringValue', - }, - }, - { - key: 'telemetry.sdk.language', - value: { - stringValue: 'nodejs', - value: 'stringValue', - }, - }, - { - key: 'telemetry.sdk.name', - value: { - stringValue: 'opentelemetry', - value: 'stringValue', - }, - }, - { - key: 'telemetry.sdk.version', - value: { - stringValue: VERSION, - value: 'stringValue', - }, - }, - { - key: 'service', - value: { - stringValue: 'ui', - value: 'stringValue', - }, - }, - { - key: 'version', - value: { - intValue: '1', - value: 'intValue', - }, - }, - { - key: 'cost', - value: { - doubleValue: 112.12, - value: 'doubleValue', - }, - }, - ], - droppedAttributesCount: 0, - }); -} - -export function ensureMetadataIsCorrect( - actual?: grpc.Metadata, - expected?: grpc.Metadata -) { - //ignore user agent - expected?.remove('user-agent'); - actual?.remove('user-agent'); - assert.deepStrictEqual(actual?.getMap(), expected?.getMap() ?? {}); -} diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/utils.ts b/experimental/packages/exporter-trace-otlp-grpc/test/utils.ts new file mode 100644 index 00000000000..8dc6ae14e0c --- /dev/null +++ b/experimental/packages/exporter-trace-otlp-grpc/test/utils.ts @@ -0,0 +1,72 @@ +/* + * 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 { + Metadata, + Server, + ServerCredentials, + ServiceDefinition, +} from '@grpc/grpc-js'; + +export interface ExportedData { + request: Buffer; + metadata: Metadata; +} + +export interface ServerTestContext { + requests: ExportedData[]; + serverResponseProvider: () => { error: Error | null; buffer?: Buffer }; +} + +/** + * Starts a customizable server that saves all responses to context.responses + * Returns data as defined in context.ServerResponseProvider + * + * @return shutdown handle, needs to be called to ensure that mocha exits + * @param address address to bind to + * @param service service to start + * @param context context for storing responses and to define server behavior. + */ +export function startServer( + address: string, + service: ServiceDefinition, + context: ServerTestContext +): Promise<() => void> { + const server = new Server(); + server.addService(service, { + export: (data: ExportedData, callback: any) => { + context.requests.push(data); + const response = context.serverResponseProvider(); + callback(response.error, response.buffer); + }, + }); + + return new Promise<() => void>((resolve, reject) => { + server.bindAsync( + address, + ServerCredentials.createInsecure(), + (error, port) => { + server.start(); + if (error != null) { + reject(error); + } + resolve(() => { + server.forceShutdown(); + }); + } + ); + }); +} diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json index c81b4201b73..40760ce73c1 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json @@ -18,8 +18,7 @@ "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js", - "align-api-deps": "node ../../../scripts/align-api-deps.js", - "maint:regenerate-test-certs": "cd test/certs && ./regenerate.sh" + "align-api-deps": "node ../../../scripts/align-api-deps.js" }, "keywords": [ "opentelemetry", 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 833fa2ba7d1..ac84344ba4b 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 @@ -14,295 +14,83 @@ * limitations under the License. */ -import * as protoLoader from '@grpc/proto-loader'; -import { diag, DiagLogger } from '@opentelemetry/api'; -import * as assert from 'assert'; -import * as crypto from 'crypto'; -import * as fs from 'fs'; -import * as grpc from '@grpc/grpc-js'; -import * as path from 'path'; -import * as sinon from 'sinon'; import { OTLPMetricExporter } from '../src'; +import { ServerTestContext, startServer } from './utils'; +import * as assert from 'assert'; import { - collect, - ensureExportedCounterIsCorrect, - ensureExportedHistogramIsCorrect, - ensureExportedObservableGaugeIsCorrect, - ensureMetadataIsCorrect, - ensureResourceIsCorrect, - mockCounter, - mockHistogram, - mockObservableGauge, - setUp, - shutdown, -} from './metricsHelper'; -import { ResourceMetrics } from '@opentelemetry/sdk-metrics'; -import { - IExportMetricsServiceRequest, - IResourceMetrics, -} from '@opentelemetry/otlp-transformer'; -import { AggregationTemporalityPreference } from '@opentelemetry/exporter-metrics-otlp-http'; - -const metricsServiceProtoPath = - 'opentelemetry/proto/collector/metrics/v1/metrics_service.proto'; -const includeDirs = [path.resolve(__dirname, '../../otlp-transformer/protos')]; - -const httpAddr = 'https://localhost:1502'; -const udsAddr = 'unix:///tmp/otlp-metrics.sock'; - -type TestParams = { - address?: string; - useTLS?: boolean; - metadata?: grpc.Metadata; + MeterProvider, + PeriodicExportingMetricReader, +} from '@opentelemetry/sdk-metrics'; + +const testServiceDefinition = { + export: { + path: '/opentelemetry.proto.collector.metrics.v1.MetricsService/Export', + requestStream: false, + responseStream: false, + requestSerialize: (arg: Buffer) => { + return arg; + }, + requestDeserialize: (arg: Buffer) => { + return arg; + }, + responseSerialize: (arg: Buffer) => { + return arg; + }, + responseDeserialize: (arg: Buffer) => { + return arg; + }, + }, }; -const metadata = new grpc.Metadata(); -metadata.set('k', 'v'); - -const testOTLPMetricExporter = (params: TestParams) => { - const { address = httpAddr, useTLS, metadata } = params; - return describe(`OTLPMetricExporter - node ${ - useTLS ? 'with' : 'without' - } TLS, ${metadata ? 'with' : 'without'} metadata, target ${address}`, () => { - let collectorExporter: OTLPMetricExporter; - let server: grpc.Server; - let exportedData: IResourceMetrics[] | undefined; - let metrics: ResourceMetrics; - let reqMetadata: grpc.Metadata | undefined; - - before(done => { - server = new grpc.Server(); - protoLoader - .load(metricsServiceProtoPath, { - keepCase: false, - longs: String, - enums: String, - defaults: true, - oneofs: true, - includeDirs, - }) - .then((packageDefinition: protoLoader.PackageDefinition) => { - const packageObject: any = - grpc.loadPackageDefinition(packageDefinition); - server.addService( - packageObject.opentelemetry.proto.collector.metrics.v1 - .MetricsService.service, - { - Export: (data: { - request: IExportMetricsServiceRequest; - metadata: grpc.Metadata; - }) => { - try { - exportedData = data.request.resourceMetrics; - reqMetadata = data.metadata; - } catch (e) { - exportedData = undefined; - } - }, - } - ); - const credentials = useTLS - ? grpc.ServerCredentials.createSsl( - fs.readFileSync('./test/certs/ca.crt'), - [ - { - cert_chain: fs.readFileSync('./test/certs/server.crt'), - private_key: fs.readFileSync('./test/certs/server.key'), - }, - ] - ) - : grpc.ServerCredentials.createInsecure(); - const serverAddr = new URL(address); - server.bindAsync( - serverAddr.protocol === 'https:' ? serverAddr.host : address, - credentials, - () => { - server.start(); - done(); - } - ); - }); - }); - - after(() => { - server.forceShutdown(); - }); - - beforeEach(async () => { - const credentials = useTLS - ? grpc.credentials.createSsl( - fs.readFileSync('./test/certs/ca.crt'), - fs.readFileSync('./test/certs/client.key'), - fs.readFileSync('./test/certs/client.crt') - ) - : grpc.credentials.createInsecure(); - collectorExporter = new OTLPMetricExporter({ - url: address, - credentials, - metadata: metadata, - temporalityPreference: AggregationTemporalityPreference.CUMULATIVE, - }); - - setUp(); - - const counter = mockCounter(); - mockObservableGauge(observableResult => { - observableResult.observe(3, {}); - observableResult.observe(6, {}); - }); - const histogram = mockHistogram(); - - counter.add(1); - histogram.record(7); - histogram.record(14); - - const { resourceMetrics, errors } = await collect(); - assert.strictEqual(errors.length, 0); - metrics = resourceMetrics; - }); - - afterEach(async () => { - await shutdown(); - exportedData = undefined; - reqMetadata = undefined; - sinon.restore(); - }); - - if (useTLS && crypto.X509Certificate) { - it('test certs are valid', () => { - const certPaths = [ - './test/certs/ca.crt', - './test/certs/client.crt', - './test/certs/server.crt', - ]; - certPaths.forEach(certPath => { - const cert = new crypto.X509Certificate(fs.readFileSync(certPath)); - const now = new Date(); - assert.ok( - new Date(cert.validTo) > now, - `TLS cert "${certPath}" is still valid: cert.validTo="${cert.validTo}" (if this fails use 'npm run maint:regenerate-test-certs')` - ); - }); - }); - } - - describe('instance', () => { - let warnStub: sinon.SinonStub; +/* + * NOTE: Tests here are not intended to test the underlying components directly. They are intended as a quick + * check if the correct components are used. Use the following packages to test details: + * - `@opentelemetry/oltp-exporter-base`: OTLP common exporter logic (handling of concurrent exports, ...) + * - `@opentelemetry/otlp-transformer`: Everything regarding serialization and transforming internal representations to OTLP + * - `@opentelemetry/otlp-grpc-exporter-base`: gRPC transport + */ +describe('OTLPMetricsExporter', function () { + let shutdownHandle: () => void | undefined; + const serverTestContext: ServerTestContext = { + requests: [], + serverResponseProvider: () => { + return { error: null, buffer: Buffer.from([]) }; + }, + }; + + beforeEach(async function () { + shutdownHandle = await startServer( + 'localhost:1502', + testServiceDefinition, + serverTestContext + ); + }); - beforeEach(() => { - // Need to stub/spy on the underlying logger as the "diag" instance is global - warnStub = sinon.stub(); - const nop = () => {}; - const diagLogger: DiagLogger = { - debug: nop, - error: nop, - info: nop, - verbose: nop, - warn: warnStub, - }; - diag.setLogger(diagLogger); - }); + afterEach(function () { + shutdownHandle(); - afterEach(() => { - diag.disable(); - }); + // clear context + serverTestContext.requests = []; + serverTestContext.serverResponseProvider = () => { + return { error: null, buffer: Buffer.from([]) }; + }; + }); - it('should warn about headers', () => { - collectorExporter = new OTLPMetricExporter({ - url: address, - headers: { - foo: 'bar', - }, - temporalityPreference: AggregationTemporalityPreference.CUMULATIVE, - }); - const args = warnStub.args[0]; - assert.strictEqual(args[0], 'Headers cannot be set when using grpc'); - }); - it('should warn about path in url', () => { - if (new URL(address).protocol === 'unix:') { - // Skip this test for UDS - return; - } - collectorExporter = new OTLPMetricExporter({ - url: `${address}/v1/metrics`, - temporalityPreference: AggregationTemporalityPreference.CUMULATIVE, - }); - const args = warnStub.args[0]; - assert.strictEqual( - args[0], - 'URL path should not be set when using grpc, the path part of the URL will be ignored.' - ); - }); + it('successfully exports data', async () => { + // arrange + const meterProvider = new MeterProvider({ + readers: [ + new PeriodicExportingMetricReader({ + exporter: new OTLPMetricExporter({ url: 'http://localhost:1502' }), + }), + ], }); - describe('export', () => { - it('should export metrics', done => { - const responseSpy = sinon.spy(); - collectorExporter.export(metrics, responseSpy); - setTimeout(() => { - assert.ok( - typeof exportedData !== 'undefined', - 'resource does not exist' - ); - - assert.ok(exportedData, 'exportedData does not exist'); - - // The order of the metrics is not guaranteed. - const counterIndex = - exportedData[0].scopeMetrics[0].metrics.findIndex( - it => it.name === 'int-counter' - ); - const observableIndex = - exportedData[0].scopeMetrics[0].metrics.findIndex( - it => it.name === 'double-observable-gauge' - ); - const histogramIndex = - exportedData[0].scopeMetrics[0].metrics.findIndex( - it => it.name === 'int-histogram' - ); - - const resource = exportedData[0].resource; - const counter = exportedData[0].scopeMetrics[0].metrics[counterIndex]; - const observableGauge = - exportedData[0].scopeMetrics[0].metrics[observableIndex]; - const histogram = - exportedData[0].scopeMetrics[0].metrics[histogramIndex]; - ensureExportedCounterIsCorrect( - counter, - metrics.scopeMetrics[0].metrics[counterIndex].dataPoints[0].endTime, - metrics.scopeMetrics[0].metrics[counterIndex].dataPoints[0] - .startTime - ); - ensureExportedObservableGaugeIsCorrect( - observableGauge, - metrics.scopeMetrics[0].metrics[observableIndex].dataPoints[0] - .endTime, - metrics.scopeMetrics[0].metrics[observableIndex].dataPoints[0] - .startTime - ); - ensureExportedHistogramIsCorrect( - histogram, - metrics.scopeMetrics[0].metrics[histogramIndex].dataPoints[0] - .endTime, - metrics.scopeMetrics[0].metrics[histogramIndex].dataPoints[0] - .startTime, - [0, 100], - ['0', '2', '0'] - ); - assert.ok(typeof resource !== 'undefined', "resource doesn't exist"); - ensureResourceIsCorrect(resource); + // act + meterProvider.getMeter('test-meter').createCounter('test-counter').add(1); + await meterProvider.forceFlush(); - ensureMetadataIsCorrect(reqMetadata, metadata); - - done(); - }, 500); - }); - }); + // assert + assert.strictEqual(serverTestContext.requests.length, 1); }); -}; - -testOTLPMetricExporter({ useTLS: true }); -testOTLPMetricExporter({ useTLS: false }); -testOTLPMetricExporter({ metadata }); -// skip UDS tests on windows -process.platform !== 'win32' && testOTLPMetricExporter({ address: udsAddr }); +}); diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/ca.crt b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/ca.crt deleted file mode 100644 index 57decab97a0..00000000000 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/ca.crt +++ /dev/null @@ -1,33 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFozCCA4ugAwIBAgIUB0Ij1wY1Y97b9f57vy3qxdY3eyMwDQYJKoZIhvcNAQEL -BQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQHDBFPcGVuVGVs -ZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9vdDENMAsGA1UECwwEVGVzdDELMAkGA1UE -AwwCY2EwHhcNMjQwNjA4MTkxODUwWhcNMjUwNjA4MTkxODUwWjBhMQswCQYDVQQG -EwJDTDELMAkGA1UECAwCUk0xGjAYBgNVBAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0w -CwYDVQQKDARSb290MQ0wCwYDVQQLDARUZXN0MQswCQYDVQQDDAJjYTCCAiIwDQYJ -KoZIhvcNAQEBBQADggIPADCCAgoCggIBAL5sOaALnaMG5LvsyTRf77a0iQj5A1QP -N11tcWPQ5DvRtD6rKh3ISuKCPOX0BOeY0VdwqWP3dVP0qQgek48iGQw4Wl7SBQxO -vX3+cmaIy17ZHPu4RZIbjbGbS61OHU2iM4Ek1styhccWTv8dDN9V1LGr9mOnqVkv -4SZrmrGYAKyF5JLImafzAUUGttc5aeBpqWmjObk3GLFDWEvObkrI5sUqabJ3U4LS -KVPAX4sXoEPmlmnqIe6/5edmYNbeK0Kr8gZLDqJXThIDsgbRNIOTYWohPR3/JlDy -xnIH31GXygSWlGmDUxHynm7rvzY70Dm4G8JHI8F8hClRZ29XVYjyBMlS8qBHLa72 -mLU79WfsCbvdU/1AWg9g1FopSdf3G3z0Y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2RAGbSCwjok/nKN -62MwO+Npr0sSkBGvYG2xzTS7R00L14cWOA9L26v7EqjZbpFd2B6vE0sUWLvVlbNc -wwZok4pFbw== ------END CERTIFICATE----- diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/ca.key b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/ca.key deleted file mode 100644 index b9f12f4f350..00000000000 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/ca.key +++ /dev/null @@ -1,52 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIJQQIBADANBgkqhkiG9w0BAQEFAASCCSswggknAgEAAoICAQC+bDmgC52jBuS7 -7Mk0X++2tIkI+QNUDzddbXFj0OQ70bQ+qyodyErigjzl9ATnmNFXcKlj93VT9KkI -HpOPIhkMOFpe0gUMTr19/nJmiMte2Rz7uEWSG42xm0utTh1NojOBJNbLcoXHFk7/ -HQzfVdSxq/Zjp6lZL+Ema5qxmACsheSSyJmn8wFFBrbXOWngaalpozm5NxixQ1hL -zm5KyObFKmmyd1OC0ilTwF+LF6BD5pZp6iHuv+XnZmDW3itCq/IGSw6iV04SA7IG -0TSDk2FqIT0d/yZQ8sZyB99Rl8oElpRpg1MR8p5u6782O9A5uBvCRyPBfIQpUWdv -V1WI8gTJUvKgRy2u9pi1O/Vn7Am73VP9QFoPYNRaKUnX9xt89GOGSPJ0wjAG0idM -0Jt5yE/aTVT2vZ5NHojqNeOtvk2eNF9/xPrexuz5BoCB8mKy96OmzLKdwdqSmyRy -Mm8MBjcYrskSr8yMnF3M+42xM8i+65nLMYjTbrpJPIpaTHsXgg7v2Pp3Zr5zVVgL -DX+h0mx5ZIqdxH4vqeqStKVoDaa5KEL4oIhHkqnqebtr/6IE0X5S8IodVAwfZKyd -3c6BOkweZA64L5p/7CKIYfy1gux4qbkI4tW/v3oxbkDct5sA0dhtPb66pOT2V73x -0V/ggn01GUhWPLhB60wIX4IihD2n+QIDAQABAoICAAH0mI7lL6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u -FWaGQgoXyh1iWpI1X10iPyU+VUYFvg7/s0dj80J04mBBFVyXUzZeLsZgo4dcU7nH -Oy8KjV8Ldl0QJxwKlTQELW5V3u4MCfUI59a7nUF47RB1hNB2gzQGH81ibuYkFtQg -oM1YZB0tLg7jsMVkPZG3d8mP7mvitK0BTekQt5Ea/Z5qmOrOd4gpvMe9KWPdML0K -B0yMLykxCmg2NqRpcyV3Kk4LOd/UZr2kAFjM7Tt0u03gY4OjxXyX4xTyMu8S9Dj5 -+pFcbZ4RROHkC2Vg2eaQxFXb0mnv ------END PRIVATE KEY----- diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/client.crt b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/client.crt deleted file mode 100644 index b85e18dffad..00000000000 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/client.crt +++ /dev/null @@ -1,32 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFiDCCA3CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQGEwJDTDEL -MAkGA1UECAwCUk0xGjAYBgNVBAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0wCwYDVQQK -DARSb290MQ0wCwYDVQQLDARUZXN0MQswCQYDVQQDDAJjYTAeFw0yNDA2MDgxOTE4 -NTFaFw0yNTA2MDgxOTE4NTFaMGoxCzAJBgNVBAYTAkNMMQswCQYDVQQIDAJSTTEa -MBgGA1UEBwwRT3BlblRlbGVtZXRyeVRlc3QxDTALBgNVBAoMBFRlc3QxDzANBgNV -BAsMBkNsaWVudDESMBAGA1UEAwwJbG9jYWxob3N0MIICIjANBgkqhkiG9w0BAQEF -AAOCAg8AMIICCgKCAgEAjTQGK0mcpE04z7FRBz2mYOeoIh7SToyII0cR8+6T3YEK -R6SzZOLRXZ73/EucsQs0WxYEqXLgSlnxOBDQVttEwIi4VBxQnTc3T1itbZJeGnvf -t108ntOX5czbFJMuey/4D5WPRFBFJfSgqRP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v61zVeVXaqjJHX12AMP41PEjFvBlIB0PqsORDZv4+X5MOchRf5VepM4hd01LW -9lTrX7oBSc0uzjDA5OyOZaqNDP06YfgezO0uF049cVbuGQ4NA+Iby6+nFILFgjcS -50p29zV2mP2KJ4dLnFf3/6CPNUSGrY7SXh2rcTefs7oxvlBu6Jt+b+2XYIWl9+Iz -Z/3dm5l5cEt9B4eogUb6HpFCfm3yba89wqUZK9o4O5WS/amx7MxPcQ4NPw5e+6EE -If4hv5PmFbUJtzKCwwvtjg1eWRW0th/Il3ixgQ== ------END CERTIFICATE----- diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/client.csr b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/client.csr deleted file mode 100644 index 190eb372ce1..00000000000 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/client.csr +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQH -DBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEVGVzdDEPMA0GA1UECwwGQ2xp -ZW50MRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQCNNAYrSZykTTjPsVEHPaZg56giHtJOjIgjRxHz7pPdgQpHpLNk4tFd -nvf8S5yxCzRbFgSpcuBKWfE4ENBW20TAiLhUHFCdNzdPWK1tkl4ae9+3XTye05fl -zNsUky57L/gPlY9EUEUl9KCpE+riHnO72ubV5Rc4IHqXoH44rkS/n/w4scBdj9Cp -Q0U8tiCBQyibs6GdaoDRnUdHnTgngaR4SwjAj9qwRyWjWBLpatXpUGFlkVLu7/8L -na/D6NJn5UBctyAn72boI9F2uEGH7JD2FfZktv5OtRo8CyC3GuPqgHS5XrYxgTvM -2E2euSzrPBPwYM67+sxJsgjRukXcv8z98Pn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ICATE REQUEST----- diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/client.key b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/client.key deleted file mode 100644 index 4ea34697a30..00000000000 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/client.key +++ /dev/null @@ -1,52 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQCNNAYrSZykTTjP -sVEHPaZg56giHtJOjIgjRxHz7pPdgQpHpLNk4tFdnvf8S5yxCzRbFgSpcuBKWfE4 -ENBW20TAiLhUHFCdNzdPWK1tkl4ae9+3XTye05flzNsUky57L/gPlY9EUEUl9KCp -E+riHnO72ubV5Rc4IHqXoH44rkS/n/w4scBdj9CpQ0U8tiCBQyibs6GdaoDRnUdH -nTgngaR4SwjAj9qwRyWjWBLpatXpUGFlkVLu7/8Lna/D6NJn5UBctyAn72boI9F2 -uEGH7JD2FfZktv5OtRo8CyC3GuPqgHS5XrYxgTvM2E2euSzrPBPwYM67+sxJsgjR -ukXcv8z98Pnu+lxtK7S3dMuA/ZmBXounAp6xCZyXebsbqa+HHVH0znGUqRw6NyjE -IyYK22TPKHj3HttVhkSb6YVX5Y+SCh4IGDl4RsHGxWwgeSlTYaOfMgUwmU+mfC0N -2Aopj995DzwItGUQXv6O4meNRLa1eYna1wa166AiLjn08fDdlwVpc+yF4RdRrzM+ -TI8JsVhculguldk3zAjDPGWC3DrY7CSuLoMDb0XStnLY3U1/lH+aRWo3r26Vk/Ff -1Ri3lsI9ifjPZUpPjomnGwFMxXxMtt9E7zE58uPc8BEIZYdXgqYEL19qQtCZWwwq -OVyhY3ebahUs0A5GVh2aj4jzUmvJqwIDAQABAoICABP52auTEOl/kTt0uuFa2+hW -rYcSNC9vmyzed5A6XsnV4RXsm4J4wiTMAgo7yjGTw7blIQi12zw5iDIl0suO3qWc -UfN4RAFR1+3OPk7Dh7OYdbhT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0K7jjHT -LeES8L0kwnC8Zq/JTQnWXkHM4xB5BEIzpCG1cwGJIzfDtMat7a2x40DtnjXIZ+yq -xuuVAxg4m1KWRNHAKhVuq0hRk9/HKou83sJgs6vtZ6zE81csQwo4MOH1LwcsS2A4 -EVJOYPsoWpflL6ULvGyKckHdQMfzkHjrsUF/nfpOOikxe/ot4cu54eRQWKuZsJHR -rUDy/i3nw+6XSyDDV2kEJRodu+fA8Q== ------END PRIVATE KEY----- diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/regenerate.sh b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/regenerate.sh deleted file mode 100755 index cc052a4effe..00000000000 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/regenerate.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env sh -# -# Regenerate certificates that are used for tests using TLS. -# Certs are generated with a one year expiry, so periodic regen is required. -# -# Usage: npm run maint:regenerate-test-certs - -rm ca.crt ca.key client.crt client.csr client.key server.crt server.csr server.key - -openssl genrsa -out ca.key 4096 -openssl req -new -x509 -days 365 -key ca.key -out ca.crt -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Root/OU=Test/CN=ca" - -openssl genrsa -out server.key 4096 -openssl req -new -key server.key -out server.csr -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Test/OU=Server/CN=localhost" -openssl x509 -req -days 365 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt -openssl rsa -in server.key -out server.key - -openssl genrsa -out client.key 4096 -openssl req -new -key client.key -out client.csr -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Test/OU=Client/CN=localhost" -openssl x509 -req -days 365 -in client.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out client.crt -openssl rsa -in client.key -out client.key diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/server.crt b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/server.crt deleted file mode 100644 index e4e85c42df3..00000000000 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/server.crt +++ /dev/null @@ -1,32 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFiDCCA3CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQGEwJDTDEL -MAkGA1UECAwCUk0xGjAYBgNVBAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0wCwYDVQQK -DARSb290MQ0wCwYDVQQLDARUZXN0MQswCQYDVQQDDAJjYTAeFw0yNDA2MDgxOTE4 -NTFaFw0yNTA2MDgxOTE4NTFaMGoxCzAJBgNVBAYTAkNMMQswCQYDVQQIDAJSTTEa -MBgGA1UEBwwRT3BlblRlbGVtZXRyeVRlc3QxDTALBgNVBAoMBFRlc3QxDzANBgNV -BAsMBlNlcnZlcjESMBAGA1UEAwwJbG9jYWxob3N0MIICIjANBgkqhkiG9w0BAQEF -AAOCAg8AMIICCgKCAgEAsrgR40g2ius4P7h5mO6/2r9uD903m672EHRkYXKKKViV -wMS/7kgNo8vbenmmO0Ra3Rk3J80M4HhWJsI5bWvjLtbLkG6CkiK0yCpSbsK+F13B -oDvCeVEYaLz2IV2e/61l5y73Q5s6Iu2OTckIvGZr/jsCBJ+9457uuMd4Mvzi1jLo -PmVYJZYG/8I2dIjrtxqm/gAiBjbrZ5Nmm702GArvm85VWL8o3b0C+9YXI8PHHGT9 -CYqBjKobDdM0lrZdBiy5JEwSI1L0MCGzcmEVCJIuHe9b66GUVWrAsvOKrBMkziSm -BKjvAzDIsiRIS0Z2jiXpRwUhjpAphJDtsePGXvbSzvt4mUNUvSsnS4ImKURkDLVB -BndzJMUX0/fJG2fh0cVmT0V6+otqpPTrf89i3dsSG9gBHVlp4u1p7krQ8KgZ0Fpw -wbo+p41KrChQ8iwE4eEgcI2joQrC2ccpQzxyn/quH604gadtBTEw+NrCu8NB5hso -hMGJV1jMJ0wENkRY0WjD51y87ieUhMQwUnM7Yi7CLq3SJA9N0KHbtg4U+42d63pH -HmMwUw2cG7tVKJR/quZxwibqkA7mkUYp/pyILt6m1IOAwK5SgomMGCsstXSFXisR -fCCNTEkQMvuylC3TsV6THPb6zJvhntIkLGbSFzxfLeGP5x0KhqWt76W//BnKfXsC -AwEAAaNCMEAwHQYDVR0OBBYEFLNHcwOHiVPwk8X3kZnMBz/rezOiMB8GA1UdIwQY -MBaAFAnipYlSco3heta4YnxM3hgg3tGyMA0GCSqGSIb3DQEBCwUAA4ICAQCqWBJL -+hOWGK4IUXXUodvHcctiXU6ktUP4ki8Ml0c1UWnRZECuBU/tlCiasgQlGc0eld/H -q9h0zK3gUDoLXYb6uPuFUmhtJYY6ydIBR7XqCCTgBMfJ6gwxH2ybC/BTyp1cE9o1 -hMkaD+/r3JRGX0G5FPYRhfF5JDSGVAiWWFD1udPH4+UidjFAXTyi0bn5BsY5Aze9 -xVWvOMYNLxiaZEklfTGGgY7xbTECow+XR7ThguzL1Wg9GBJEAYWvfbdb+RKB5bqs -ggKRTg21VWapTeSbfnjhvyrRN2FamGxeW1lqb8Ts1yyKiqtkj/cy2tIheEGAPt/a -wWgFKAuSRN0YtSW8D8oOmY+4+ULDl0um/dhJ31/nF0qOgopHUozJXDj71GsNrokh -3TmYYnuyZdAAyVFwNffXWingfqNOs2ozf/efBTLLAb094QOnpdit9pYPqE5ar72Y -JdGACna1Mxz5PDa6Z7eQB7s7h/Q47JFXIOI4TdguKGYiDT0XXfEq6lKbvVYkheQ/ -kutiMFQQCwwv/LxRhjTeeFEnASyWgRhhvuTg0ndOqpCtgUJ8mEZ4c9RB+QA7XeOe -FKx9QMLJRAOMNE2WoSPhgaJrf6glSKOvR6CuH/v1ekE3pJpVZGk+3GOs3H8k92Vv -pV9S89yNX95tLzlOR/nKWLrX6n27fjE2BBXeBg== ------END CERTIFICATE----- diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/server.csr b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/server.csr deleted file mode 100644 index 642fbae3c42..00000000000 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/server.csr +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQH -DBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEVGVzdDEPMA0GA1UECwwGU2Vy -dmVyMRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQCyuBHjSDaK6zg/uHmY7r/av24P3TebrvYQdGRhcoopWJXAxL/uSA2j -y9t6eaY7RFrdGTcnzQzgeFYmwjlta+Mu1suQboKSIrTIKlJuwr4XXcGgO8J5URho -vPYhXZ7/rWXnLvdDmzoi7Y5NyQi8Zmv+OwIEn73jnu64x3gy/OLWMug+ZVgllgb/ -wjZ0iOu3Gqb+ACIGNutnk2abvTYYCu+bzlVYvyjdvQL71hcjw8ccZP0JioGMqhsN -0zSWtl0GLLkkTBIjUvQwIbNyYRUIki4d71vroZRVasCy84qsEyTOJKYEqO8DMMiy -JEhLRnaOJelHBSGOkCmEkO2x48Ze9tLO+3iZQ1S9KydLgiYpRGQMtUEGd3MkxRfT -98kbZ+HRxWZPRXr6i2qk9Ot/z2Ld2xIb2AEdWWni7WnuStDwqBnQWnDBuj6njUqs -KFDyLATh4SBwjaOhCsLZxylDPHKf+q4frTiBp20FMTD42sK7w0HmGyiEwYlXWMwn -TAQ2RFjRaMPnXLzuJ5SExDBScztiLsIurdIkD03Qodu2DhT7jZ3rekceYzBTDZwb -u1UolH+q5nHCJuqQDuaRRin+nIgu3qbUg4DArlKCiYwYKyy1dIVeKxF8II1MSRAy -+7KULdOxXpMc9vrMm+Ge0iQsZtIXPF8t4Y/nHQqGpa3vpb/8Gcp9ewIDAQABoAAw -DQYJKoZIhvcNAQELBQADggIBAAvxaoCgCOM5mVOAFeLQoKGTORIWoT73yKeebLu8 -Ie26lrOZyItFneYCnyFocYb20mriC+C30lUgNM66mHWLW0QSDPhI0VeBMDRHYPMo -S5EWkQNy0VQ1HZV/DITXqEBld0WdmBl71D7gOlZvDHHnrb5emOKOVP/7poitywC1 -NA/Ry0TJYAz1z9uu5GLmMNJwfkRAPVYJnzMTMQ6G8z2tUKTTDKbJvkkJ1tmjBToD -/8JeXmxH0a0NuwC7QLDzR1Jl4XWj3uIAHUtcsHMFjOc3nAin3L7FGD7CaXTyz/Hw -J7GkeIMGSYs+i+09l9dMLSrlIsh2sphV768dKajqA11C6nGOeEkJFziY+l9KNy9B -MkW74Vj2SyN0l8Cn2X282UakAxQ0kCwpBQYSO+M6q2gVLhwTwmDUCpfuo03dOGrn -kHPDYQUahTLfKNEe6seXHomGUxTpMnr5p3ftMOrc4uCWY1DkhEviw9Jea666gG/e -5yiYcN4vSmru4GpmOV5N28GNC8oAgm7rPpPgXeiVET+p3wms8cZ8/Htpkxn2nTcc -3tBvAYt8qql9Wt/2R4ewo39bzg4dPzl9AUWeQRpA6O0n6ZhtHhCzDSik5Tam9fh8 -lxTldG69Enm4+amCLja/YYRmaEE9KYM3jxSi6k+Xh2L+vI8WlwbkZKnYs9suDW22 -eoJ+ ------END CERTIFICATE REQUEST----- diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/server.key b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/server.key deleted file mode 100644 index 1801be40223..00000000000 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/server.key +++ /dev/null @@ -1,52 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIJQQIBADANBgkqhkiG9w0BAQEFAASCCSswggknAgEAAoICAQCyuBHjSDaK6zg/ -uHmY7r/av24P3TebrvYQdGRhcoopWJXAxL/uSA2jy9t6eaY7RFrdGTcnzQzgeFYm -wjlta+Mu1suQboKSIrTIKlJuwr4XXcGgO8J5URhov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F9PtKIouNhUyZ99Wr5q+RjI+ -VaE0dpC3PGYhJo33qHDvktwB4lzCYK77aSjoLzXuVchXNwuQ/qnIDK0Xq7Kg2R9X -nGTNnypgWuHp+CIyD/OHKqj12SNPCs66REs3CILegl9AcbKtDxXzE9uGxbOJ0TKy -2EmjTca4l+e1zdwpS+Iy88Ope2YXNrr4oeKr5FUCggEAZ5ZcTzApD/P4GvmR/clA -XB5gJz5AWgsoj7CkZ1QUb0IAL7b9VBXDongmeSDRmTJ6jUkv6G90O8WVQV8Bprdt -uZrtYJC7QndhLi5ZUYfA7CihYxb969IILJ2p2mcv7D36F3kDqAutzgmobwbQvOua -v98FB52dnifuctGW8EedQBy/rOpJ9UGvb9E5TQnnubQKJ3aXkyqQEr1uoF/5p7W0 -KG68sRP8TB5K+V8xLgDGKr1Ptvsu9WIJIYYDI3qy3Jc0PdWlIucnvEJAT4yxeVT0 -heIEmTNIdHXISa3AIa2zcbhpu6rZsqDeznUGooxs43LTuBF5gx8liyw+114XnnFj -+wKCAQBvYIspfu+hjHpR67Tv8NLAzH9pWcbpKJ66YYW5IaD3kytsML9C+x7NiuGy -U2Svxfdin3otbG/TEPH+d5e5t23lWZEBmuQucjhpRZj7J8zzImdjCtYMekYHIepD -1XMKAQdYqx251Gux2FHmYD8hbJbUJLrfuSyFksxvqDdkidQiKMfRDNS1IElkcRRz -bhJUPzJ9XRJIlkIzZCQ8XgZWDyiSA0Gpq+jwZfqmn8v4ol1cmK9EEAFZ9cewvSdq -YIxr/IvWouwSqVkn0p33g080Uv+Rc871XtnxMcdVFExVE2cPZFY7v8yWqpo7PNU+ -HvjeIanEQir29p2epOg8Epxewjc9 ------END PRIVATE KEY----- diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/metricsHelper.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/metricsHelper.ts deleted file mode 100644 index 7c9fbfd99c0..00000000000 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/metricsHelper.ts +++ /dev/null @@ -1,277 +0,0 @@ -/* - * 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 { - Counter, - Histogram, - HrTime, - ObservableGauge, - ObservableResult, - ValueType, -} from '@opentelemetry/api'; -import { Resource } from '@opentelemetry/resources'; -import * as assert from 'assert'; -import * as grpc from '@grpc/grpc-js'; -import { VERSION } from '@opentelemetry/core'; -import { - ExplicitBucketHistogramAggregation, - MeterProvider, - MetricReader, - View, -} from '@opentelemetry/sdk-metrics'; -import { - encodeAsString, - IKeyValue, - IMetric, - IResource, -} from '@opentelemetry/otlp-transformer'; - -class TestMetricReader extends MetricReader { - protected onForceFlush(): Promise { - return Promise.resolve(undefined); - } - - protected onShutdown(): Promise { - return Promise.resolve(undefined); - } -} - -const testResource = new Resource({ - service: 'ui', - version: 1, - cost: 112.12, -}); - -let reader = new TestMetricReader(); -let meterProvider = new MeterProvider({ - resource: testResource, - readers: [reader], -}); - -let meter = meterProvider.getMeter('default', '0.0.1'); - -export async function collect() { - return (await reader.collect())!; -} - -export function setUp() { - reader = new TestMetricReader(); - meterProvider = new MeterProvider({ - resource: testResource, - views: [ - new View({ - aggregation: new ExplicitBucketHistogramAggregation([0, 100]), - instrumentName: 'int-histogram', - }), - ], - readers: [reader], - }); - meter = meterProvider.getMeter('default', '0.0.1'); -} - -export async function shutdown() { - await meterProvider.shutdown(); -} - -export function mockCounter(): Counter { - const name = 'int-counter'; - return meter.createCounter(name, { - description: 'sample counter description', - valueType: ValueType.INT, - }); -} - -export function mockObservableGauge( - callback: (observableResult: ObservableResult) => void -): ObservableGauge { - const name = 'double-observable-gauge'; - const observableGauge = meter.createObservableGauge(name, { - description: 'sample observable gauge description', - valueType: ValueType.DOUBLE, - }); - observableGauge.addCallback(callback); - - return observableGauge; -} - -export function mockHistogram(): Histogram { - return meter.createHistogram('int-histogram', { - description: 'sample histogram description', - valueType: ValueType.INT, - }); -} - -export function ensureExportedAttributesAreCorrect(attributes: IKeyValue[]) { - assert.deepStrictEqual( - attributes, - [ - { - key: 'component', - value: { - stringValue: 'document-load', - value: 'stringValue', - }, - }, - ], - 'exported attributes are incorrect' - ); -} - -export function ensureExportedCounterIsCorrect( - metric: IMetric, - time: HrTime, - startTime: HrTime -) { - assert.strictEqual(metric.name, 'int-counter'); - assert.strictEqual(metric.description, 'sample counter description'); - assert.strictEqual(metric.unit, ''); - assert.strictEqual(metric.sum?.dataPoints.length, 1); - assert.strictEqual( - metric.sum?.aggregationTemporality, - 'AGGREGATION_TEMPORALITY_CUMULATIVE' - ); - assert.strictEqual(metric.sum?.isMonotonic, true); - - const [dp] = metric.sum.dataPoints; - - assert.deepStrictEqual(dp.attributes, []); - assert.deepStrictEqual(dp.exemplars, []); - assert.strictEqual(dp.asInt, '1'); - assert.strictEqual(dp.flags, 0); - - assert.deepStrictEqual(dp.startTimeUnixNano, encodeAsString(startTime)); - assert.deepStrictEqual(dp.timeUnixNano as string, encodeAsString(time)); -} - -export function ensureExportedObservableGaugeIsCorrect( - metric: IMetric, - time: HrTime, - startTime: HrTime -) { - assert.strictEqual(metric.name, 'double-observable-gauge'); - assert.strictEqual(metric.description, 'sample observable gauge description'); - assert.strictEqual(metric.unit, ''); - assert.strictEqual(metric.gauge?.dataPoints.length, 1); - - const [dp] = metric.gauge.dataPoints; - - assert.deepStrictEqual(dp.attributes, []); - assert.deepStrictEqual(dp.exemplars, []); - assert.strictEqual(dp.asDouble, 6); - assert.strictEqual(dp.flags, 0); - - assert.deepStrictEqual(dp.startTimeUnixNano, encodeAsString(startTime)); - assert.deepStrictEqual(dp.timeUnixNano, encodeAsString(time)); -} - -export function ensureExportedHistogramIsCorrect( - metric: IMetric, - time: HrTime, - startTime: HrTime, - explicitBounds: number[] = [Infinity], - bucketCounts: string[] = ['2', '0'] -) { - assert.strictEqual(metric.name, 'int-histogram'); - assert.strictEqual(metric.description, 'sample histogram description'); - assert.strictEqual(metric.unit, ''); - assert.strictEqual(metric.histogram?.dataPoints.length, 1); - assert.strictEqual( - metric.histogram?.aggregationTemporality, - 'AGGREGATION_TEMPORALITY_CUMULATIVE' - ); - - const [dp] = metric.histogram.dataPoints; - - assert.deepStrictEqual(dp.attributes, []); - assert.deepStrictEqual(dp.exemplars, []); - assert.strictEqual(dp.flags, 0); - assert.strictEqual(dp.sum, 21); - assert.strictEqual(dp.count, '2'); - assert.strictEqual(dp.min, 7); - assert.strictEqual(dp.max, 14); - - assert.deepStrictEqual(dp.startTimeUnixNano, encodeAsString(startTime)); - assert.deepStrictEqual(dp.timeUnixNano, encodeAsString(time)); - assert.deepStrictEqual(dp.bucketCounts, bucketCounts); - assert.deepStrictEqual(dp.explicitBounds, explicitBounds); -} - -export function ensureResourceIsCorrect(resource: IResource) { - assert.deepStrictEqual(resource, { - attributes: [ - { - key: 'service.name', - value: { - stringValue: `unknown_service:${process.argv0}`, - value: 'stringValue', - }, - }, - { - key: 'telemetry.sdk.language', - value: { - stringValue: 'nodejs', - value: 'stringValue', - }, - }, - { - key: 'telemetry.sdk.name', - value: { - stringValue: 'opentelemetry', - value: 'stringValue', - }, - }, - { - key: 'telemetry.sdk.version', - value: { - stringValue: VERSION, - value: 'stringValue', - }, - }, - { - key: 'service', - value: { - stringValue: 'ui', - value: 'stringValue', - }, - }, - { - key: 'version', - value: { - intValue: '1', - value: 'intValue', - }, - }, - { - key: 'cost', - value: { - doubleValue: 112.12, - value: 'doubleValue', - }, - }, - ], - droppedAttributesCount: 0, - }); -} - -export function ensureMetadataIsCorrect( - actual?: grpc.Metadata, - expected?: grpc.Metadata -) { - //ignore user agent - expected?.remove('user-agent'); - actual?.remove('user-agent'); - assert.deepStrictEqual(actual?.getMap(), expected?.getMap() ?? {}); -} diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/utils.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/utils.ts new file mode 100644 index 00000000000..8dc6ae14e0c --- /dev/null +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/utils.ts @@ -0,0 +1,72 @@ +/* + * 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 { + Metadata, + Server, + ServerCredentials, + ServiceDefinition, +} from '@grpc/grpc-js'; + +export interface ExportedData { + request: Buffer; + metadata: Metadata; +} + +export interface ServerTestContext { + requests: ExportedData[]; + serverResponseProvider: () => { error: Error | null; buffer?: Buffer }; +} + +/** + * Starts a customizable server that saves all responses to context.responses + * Returns data as defined in context.ServerResponseProvider + * + * @return shutdown handle, needs to be called to ensure that mocha exits + * @param address address to bind to + * @param service service to start + * @param context context for storing responses and to define server behavior. + */ +export function startServer( + address: string, + service: ServiceDefinition, + context: ServerTestContext +): Promise<() => void> { + const server = new Server(); + server.addService(service, { + export: (data: ExportedData, callback: any) => { + context.requests.push(data); + const response = context.serverResponseProvider(); + callback(response.error, response.buffer); + }, + }); + + return new Promise<() => void>((resolve, reject) => { + server.bindAsync( + address, + ServerCredentials.createInsecure(), + (error, port) => { + server.start(); + if (error != null) { + reject(error); + } + resolve(() => { + server.forceShutdown(); + }); + } + ); + }); +} diff --git a/experimental/packages/otlp-grpc-exporter-base/test/grpc-exporter-transport.test.ts b/experimental/packages/otlp-grpc-exporter-base/test/grpc-exporter-transport.test.ts index c74b4013422..69b906e895a 100644 --- a/experimental/packages/otlp-grpc-exporter-base/test/grpc-exporter-transport.test.ts +++ b/experimental/packages/otlp-grpc-exporter-base/test/grpc-exporter-transport.test.ts @@ -111,6 +111,40 @@ function startServer(context: ServerTestContext): Promise<() => void> { }); } +/** + * Starts a customizable server that saves all responses to context.responses + * Returns data as defined in context.ServerResponseProvider + * + * @return shutdown handle, needs to be called to ensure that mocha exits + * @param context context for storing responses and to define server behavior. + */ +function startUdsServer(context: ServerTestContext): Promise<() => void> { + const server = new Server(); + server.addService(testServiceDefinition, { + export: (data: ExportedData, callback: any) => { + context.requests.push(data); + const response = context.serverResponseProvider(); + callback(response.error, response.buffer); + }, + }); + + return new Promise<() => void>((resolve, reject) => { + server.bindAsync( + 'unix:///tmp/otlp-test.sock', + ServerCredentials.createInsecure(), + (error, port) => { + server.start(); + if (error != null) { + reject(error); + } + resolve(() => { + server.forceShutdown(); + }); + } + ); + }); +} + describe('GrpcExporterTransport', function () { describe('utilities', function () { describe('createEmptyMetadata', function () { @@ -199,149 +233,202 @@ describe('GrpcExporterTransport', function () { }); }); describe('send', function () { - let shutdownHandle: () => void | undefined; - const serverTestContext: ServerTestContext = { - requests: [], - serverResponseProvider: () => { - return { error: null, buffer: Buffer.from([]) }; - }, - }; + describe('http2', function () { + let shutdownHandle: () => void | undefined; + const serverTestContext: ServerTestContext = { + requests: [], + serverResponseProvider: () => { + return { error: null, buffer: Buffer.from([]) }; + }, + }; - beforeEach(async function () { - shutdownHandle = await startServer(serverTestContext); - }); + beforeEach(async function () { + shutdownHandle = await startServer(serverTestContext); + }); - afterEach(function () { - shutdownHandle(); + afterEach(function () { + shutdownHandle(); - // clear context - serverTestContext.requests = []; - serverTestContext.serverResponseProvider = () => { - return { error: null, buffer: Buffer.from([]) }; - }; - }); + // clear context + serverTestContext.requests = []; + serverTestContext.serverResponseProvider = () => { + return { error: null, buffer: Buffer.from([]) }; + }; + }); - it('sends data', async function () { - const transport = createOtlpGrpcExporterTransport(simpleClientConfig); + it('sends data', async function () { + const transport = createOtlpGrpcExporterTransport(simpleClientConfig); - const result = (await transport.send( - Buffer.from([1, 2, 3]), - timeoutMillis - )) as ExportResponseSuccess; - - assert.strictEqual(result.status, 'success'); - assert.deepEqual(result.data, Buffer.from([])); - assert.strictEqual(serverTestContext.requests.length, 1); - assert.deepEqual( - serverTestContext.requests[0].request, - Buffer.from([1, 2, 3]) - ); - assert.deepEqual( - serverTestContext.requests[0].metadata.get('foo'), - simpleClientConfig.metadata().get('foo') - ); - }); + const result = (await transport.send( + Buffer.from([1, 2, 3]), + timeoutMillis + )) as ExportResponseSuccess; - it('forwards response', async function () { - const expectedResponseData = Buffer.from([1, 2, 3]); - serverTestContext.serverResponseProvider = () => { - return { - buffer: expectedResponseData, - error: null, + assert.strictEqual(result.status, 'success'); + assert.deepEqual(result.data, Buffer.from([])); + assert.strictEqual(serverTestContext.requests.length, 1); + assert.deepEqual( + serverTestContext.requests[0].request, + Buffer.from([1, 2, 3]) + ); + assert.deepEqual( + serverTestContext.requests[0].metadata.get('foo'), + simpleClientConfig.metadata().get('foo') + ); + }); + + it('forwards response', async function () { + const expectedResponseData = Buffer.from([1, 2, 3]); + serverTestContext.serverResponseProvider = () => { + return { + buffer: expectedResponseData, + error: null, + }; }; - }; - const transport = createOtlpGrpcExporterTransport(simpleClientConfig); + const transport = createOtlpGrpcExporterTransport(simpleClientConfig); - const result = (await transport.send( - Buffer.from([]), - timeoutMillis - )) as ExportResponseSuccess; + const result = (await transport.send( + Buffer.from([]), + timeoutMillis + )) as ExportResponseSuccess; - assert.strictEqual(result.status, 'success'); - assert.deepEqual(result.data, expectedResponseData); - }); + assert.strictEqual(result.status, 'success'); + assert.deepEqual(result.data, expectedResponseData); + }); - it('forwards handled server error as failure', async function () { - serverTestContext.serverResponseProvider = () => { - return { - buffer: Buffer.from([]), - error: new Error('handled server error'), + it('forwards handled server error as failure', async function () { + serverTestContext.serverResponseProvider = () => { + return { + buffer: Buffer.from([]), + error: new Error('handled server error'), + }; }; - }; - const transport = createOtlpGrpcExporterTransport(simpleClientConfig); + const transport = createOtlpGrpcExporterTransport(simpleClientConfig); - const result = (await transport.send( - Buffer.from([]), - timeoutMillis - )) as ExportResponseFailure; + const result = (await transport.send( + Buffer.from([]), + timeoutMillis + )) as ExportResponseFailure; - assert.strictEqual(result.status, 'failure'); - assert.ok(types.isNativeError(result.error)); - }); + assert.strictEqual(result.status, 'failure'); + assert.ok(types.isNativeError(result.error)); + }); - it('forwards unhandled server error as failure', async function () { - serverTestContext.serverResponseProvider = () => { - throw new Error('unhandled server error'); - }; - const transport = createOtlpGrpcExporterTransport(simpleClientConfig); + it('forwards unhandled server error as failure', async function () { + serverTestContext.serverResponseProvider = () => { + throw new Error('unhandled server error'); + }; + const transport = createOtlpGrpcExporterTransport(simpleClientConfig); + + const result = (await transport.send( + Buffer.from([]), + timeoutMillis + )) as ExportResponseFailure; + assert.strictEqual(result.status, 'failure'); + assert.ok(types.isNativeError(result.error)); + }); - const result = (await transport.send( - Buffer.from([]), - timeoutMillis - )) as ExportResponseFailure; - assert.strictEqual(result.status, 'failure'); - assert.ok(types.isNativeError(result.error)); - }); + it('forwards metadataProvider error as failure', async function () { + const expectedError = new Error('metadata provider error'); + const config = Object.assign({}, simpleClientConfig); + config.metadata = () => { + throw expectedError; + }; - it('forwards metadataProvider error as failure', async function () { - const expectedError = new Error('metadata provider error'); - const config = Object.assign({}, simpleClientConfig); - config.metadata = () => { - throw expectedError; - }; + const transport = createOtlpGrpcExporterTransport(config); - const transport = createOtlpGrpcExporterTransport(config); + const result = (await transport.send( + Buffer.from([]), + timeoutMillis + )) as ExportResponseFailure; + assert.strictEqual(result.status, 'failure'); + assert.strictEqual(result.error, expectedError); + }); - const result = (await transport.send( - Buffer.from([]), - timeoutMillis - )) as ExportResponseFailure; - assert.strictEqual(result.status, 'failure'); - assert.strictEqual(result.error, expectedError); - }); + it('forwards metadataProvider returns null value as failure', async function () { + const expectedError = new Error('metadata was null'); + const config = Object.assign({}, simpleClientConfig); + config.metadata = () => { + return null as unknown as Metadata; + }; - it('forwards metadataProvider returns null value as failure', async function () { - const expectedError = new Error('metadata was null'); - const config = Object.assign({}, simpleClientConfig); - config.metadata = () => { - return null as unknown as Metadata; - }; + const transport = createOtlpGrpcExporterTransport(config); - const transport = createOtlpGrpcExporterTransport(config); + const result = (await transport.send( + Buffer.from([]), + timeoutMillis + )) as ExportResponseFailure; + assert.strictEqual(result.status, 'failure'); + assert.deepEqual(result.error, expectedError); + }); - const result = (await transport.send( - Buffer.from([]), - timeoutMillis - )) as ExportResponseFailure; - assert.strictEqual(result.status, 'failure'); - assert.deepEqual(result.error, expectedError); - }); + it('forwards credential error as failure', async function () { + const expectedError = new Error('credential provider error'); + const config = Object.assign({}, simpleClientConfig); + config.credentials = () => { + throw expectedError; + }; + + const transport = createOtlpGrpcExporterTransport(config); - it('forwards credential error as failure', async function () { - const expectedError = new Error('credential provider error'); - const config = Object.assign({}, simpleClientConfig); - config.credentials = () => { - throw expectedError; + const result = (await transport.send( + Buffer.from([]), + timeoutMillis + )) as ExportResponseFailure; + assert.strictEqual(result.status, 'failure'); + assert.strictEqual(result.error, expectedError); + }); + }); + describe('uds', function () { + let shutdownHandle: (() => void) | undefined; + const serverTestContext: ServerTestContext = { + requests: [], + serverResponseProvider: () => { + return { error: null, buffer: Buffer.from([]) }; + }, }; - const transport = createOtlpGrpcExporterTransport(config); + beforeEach(async function () { + // skip uds tests on windows + if (process.platform === 'win32') { + this.skip(); + } + shutdownHandle = await startUdsServer(serverTestContext); + }); + + afterEach(function () { + shutdownHandle?.(); + + // clear context + serverTestContext.requests = []; + serverTestContext.serverResponseProvider = () => { + return { error: null, buffer: Buffer.from([]) }; + }; + }); + + it('sends data', async function () { + const transport = createOtlpGrpcExporterTransport({ + ...simpleClientConfig, + address: 'unix:///tmp/otlp-test.sock', + }); - const result = (await transport.send( - Buffer.from([]), - timeoutMillis - )) as ExportResponseFailure; - assert.strictEqual(result.status, 'failure'); - assert.strictEqual(result.error, expectedError); + const result = (await transport.send( + Buffer.from([1, 2, 3]), + timeoutMillis + )) as ExportResponseSuccess; + + assert.strictEqual(result.status, 'success'); + assert.deepEqual(result.data, Buffer.from([])); + assert.strictEqual(serverTestContext.requests.length, 1); + assert.deepEqual( + serverTestContext.requests[0].request, + Buffer.from([1, 2, 3]) + ); + assert.deepEqual( + serverTestContext.requests[0].metadata.get('foo'), + simpleClientConfig.metadata().get('foo') + ); + }); }); }); }); diff --git a/experimental/packages/otlp-grpc-exporter-base/test/traceHelper.ts b/experimental/packages/otlp-grpc-exporter-base/test/traceHelper.ts deleted file mode 100644 index 13103b405bf..00000000000 --- a/experimental/packages/otlp-grpc-exporter-base/test/traceHelper.ts +++ /dev/null @@ -1,329 +0,0 @@ -/* - * 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 { SpanStatusCode, TraceFlags } from '@opentelemetry/api'; -import { Resource } from '@opentelemetry/resources'; -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'; - -const traceIdArr = [ - 31, 16, 8, 220, 142, 39, 14, 133, 196, 10, 13, 124, 57, 57, 178, 120, -]; -const spanIdArr = [94, 16, 114, 97, 246, 79, 165, 62]; -const parentIdArr = [120, 168, 145, 80, 152, 134, 67, 136]; - -export const mockedReadableSpan: ReadableSpan = { - name: 'documentFetch', - kind: 0, - spanContext: () => { - return { - traceId: '1f1008dc8e270e85c40a0d7c3939b278', - spanId: '5e107261f64fa53e', - traceFlags: TraceFlags.SAMPLED, - }; - }, - parentSpanId: '78a8915098864388', - startTime: [1574120165, 429803070], - endTime: [1574120165, 438688070], - ended: true, - status: { code: SpanStatusCode.OK }, - attributes: { component: 'document-load' }, - links: [ - { - context: { - traceId: '1f1008dc8e270e85c40a0d7c3939b278', - spanId: '78a8915098864388', - traceFlags: TraceFlags.SAMPLED, - }, - attributes: { component: 'document-load' }, - }, - ], - events: [ - { - name: 'fetchStart', - time: [1574120165, 429803070], - }, - { - name: 'domainLookupStart', - time: [1574120165, 429803070], - }, - { - name: 'domainLookupEnd', - time: [1574120165, 429803070], - }, - { - name: 'connectStart', - time: [1574120165, 429803070], - }, - { - name: 'connectEnd', - time: [1574120165, 429803070], - }, - { - name: 'requestStart', - time: [1574120165, 435513070], - }, - { - name: 'responseStart', - time: [1574120165, 436923070], - }, - { - name: 'responseEnd', - time: [1574120165, 438688070], - }, - ], - duration: [0, 8885000], - resource: Resource.default().merge( - new Resource({ - service: 'ui', - version: 1, - cost: 112.12, - }) - ), - instrumentationLibrary: { name: 'default', version: '0.0.1' }, - droppedAttributesCount: 0, - droppedEventsCount: 0, - droppedLinksCount: 0, -}; - -export function ensureExportedEventsAreCorrect(events: IEvent[]) { - assert.deepStrictEqual( - events, - [ - { - attributes: [], - timeUnixNano: '1574120165429803008', - name: 'fetchStart', - droppedAttributesCount: 0, - }, - { - attributes: [], - timeUnixNano: '1574120165429803008', - name: 'domainLookupStart', - droppedAttributesCount: 0, - }, - { - attributes: [], - timeUnixNano: '1574120165429803008', - name: 'domainLookupEnd', - droppedAttributesCount: 0, - }, - { - attributes: [], - timeUnixNano: '1574120165429803008', - name: 'connectStart', - droppedAttributesCount: 0, - }, - { - attributes: [], - timeUnixNano: '1574120165429803008', - name: 'connectEnd', - droppedAttributesCount: 0, - }, - { - attributes: [], - timeUnixNano: '1574120165435513088', - name: 'requestStart', - droppedAttributesCount: 0, - }, - { - attributes: [], - timeUnixNano: '1574120165436923136', - name: 'responseStart', - droppedAttributesCount: 0, - }, - { - attributes: [], - timeUnixNano: '1574120165438688000', - name: 'responseEnd', - droppedAttributesCount: 0, - }, - ], - 'exported events are incorrect' - ); -} - -export function ensureExportedAttributesAreCorrect(attributes: IKeyValue[]) { - assert.deepStrictEqual( - attributes, - [ - { - key: 'component', - value: { - stringValue: 'document-load', - value: 'stringValue', - }, - }, - ], - 'exported attributes are incorrect' - ); -} - -export function ensureExportedLinksAreCorrect(attributes: ILink[]) { - assert.deepStrictEqual( - attributes, - [ - { - attributes: [ - { - key: 'component', - value: { - stringValue: 'document-load', - value: 'stringValue', - }, - }, - ], - traceId: Buffer.from(traceIdArr), - spanId: Buffer.from(parentIdArr), - traceState: '', - droppedAttributesCount: 0, - }, - ], - 'exported links are incorrect' - ); -} - -export function ensureExportedSpanIsCorrect(span: ISpan) { - if (span.attributes) { - ensureExportedAttributesAreCorrect(span.attributes); - } - if (span.events) { - ensureExportedEventsAreCorrect(span.events); - } - if (span.links) { - ensureExportedLinksAreCorrect(span.links); - } - assert.deepStrictEqual( - span.traceId, - Buffer.from(traceIdArr), - 'traceId is wrong' - ); - assert.deepStrictEqual( - span.spanId, - Buffer.from(spanIdArr), - 'spanId is wrong' - ); - assert.strictEqual(span.traceState, '', 'traceState is wrong'); - assert.deepStrictEqual( - span.parentSpanId, - Buffer.from(parentIdArr), - 'parentIdArr is wrong' - ); - assert.strictEqual(span.name, 'documentFetch', 'name is wrong'); - assert.strictEqual(span.kind, 'SPAN_KIND_INTERNAL', 'kind is wrong'); - assert.strictEqual( - span.startTimeUnixNano, - '1574120165429803008', - 'startTimeUnixNano is wrong' - ); - assert.strictEqual( - span.endTimeUnixNano, - '1574120165438688000', - 'endTimeUnixNano is wrong' - ); - assert.strictEqual( - span.droppedAttributesCount, - 0, - 'droppedAttributesCount is wrong' - ); - assert.strictEqual(span.droppedEventsCount, 0, 'droppedEventsCount is wrong'); - assert.strictEqual(span.droppedLinksCount, 0, 'droppedLinksCount is wrong'); - assert.deepStrictEqual( - span.status, - { - code: 'STATUS_CODE_OK', - deprecatedCode: 'DEPRECATED_STATUS_CODE_OK', - message: '', - }, - 'status is wrong' - ); -} - -export function ensureResourceIsCorrect(resource: IResource) { - assert.deepStrictEqual(resource, { - attributes: [ - { - key: 'service.name', - value: { - stringValue: `unknown_service:${process.argv0}`, - value: 'stringValue', - }, - }, - { - key: 'telemetry.sdk.language', - value: { - stringValue: 'nodejs', - value: 'stringValue', - }, - }, - { - key: 'telemetry.sdk.name', - value: { - stringValue: 'opentelemetry', - value: 'stringValue', - }, - }, - { - key: 'telemetry.sdk.version', - value: { - stringValue: VERSION, - value: 'stringValue', - }, - }, - { - key: 'service', - value: { - stringValue: 'ui', - value: 'stringValue', - }, - }, - { - key: 'version', - value: { - intValue: '1', - value: 'intValue', - }, - }, - { - key: 'cost', - value: { - doubleValue: 112.12, - value: 'doubleValue', - }, - }, - ], - droppedAttributesCount: 0, - }); -} - -export function ensureMetadataIsCorrect( - actual: grpc.Metadata, - expected: grpc.Metadata -) { - //ignore user agent - expected.remove('user-agent'); - actual.remove('user-agent'); - assert.deepStrictEqual(actual.getMap(), expected.getMap()); -}