diff --git a/experimental/CHANGELOG.md b/experimental/CHANGELOG.md index 0db63bb216..0906830ea4 100644 --- a/experimental/CHANGELOG.md +++ b/experimental/CHANGELOG.md @@ -19,6 +19,7 @@ All notable changes to experimental packages in this project will be documented * was used internally to keep track of the service client used by the exporter, as a side effect it allowed end-users to modify the gRPC service client that was used * `compression` * was used internally to keep track of the compression to use but was unintentionally exposed to the users. It allowed to read and write the value, writing, however, would have no effect. +* feat(api-events)!: removed domain from the Events API [#4569](https://github.com/open-telemetry/opentelemetry-js/pull/4569) ### :rocket: (Enhancement) diff --git a/experimental/packages/api-events/README.md b/experimental/packages/api-events/README.md index 3aff88eff6..1b8d168f62 100644 --- a/experimental/packages/api-events/README.md +++ b/experimental/packages/api-events/README.md @@ -39,7 +39,7 @@ api.events.getEventEmitterProvider(); const eventEmitter = api.events.getEventEmitter(name, version); // logging an event in an instrumentation library -eventEmitter.emit({ name: 'event-name', domain: 'event-domain' }); +eventEmitter.emit({ name: 'event-name' }); ``` ## Useful links diff --git a/experimental/packages/api-events/src/NoopEventEmitterProvider.ts b/experimental/packages/api-events/src/NoopEventEmitterProvider.ts index 95731b0a8d..4d33536ac5 100644 --- a/experimental/packages/api-events/src/NoopEventEmitterProvider.ts +++ b/experimental/packages/api-events/src/NoopEventEmitterProvider.ts @@ -22,7 +22,6 @@ import { NoopEventEmitter } from './NoopEventEmitter'; export class NoopEventEmitterProvider implements EventEmitterProvider { getEventEmitter( _name: string, - _domain: string, _version?: string | undefined, _options?: EventEmitterOptions | undefined ): EventEmitter { diff --git a/experimental/packages/api-events/src/api/events.ts b/experimental/packages/api-events/src/api/events.ts index f17c93a2d3..0888bd684b 100644 --- a/experimental/packages/api-events/src/api/events.ts +++ b/experimental/packages/api-events/src/api/events.ts @@ -73,13 +73,11 @@ export class EventsAPI { */ public getEventEmitter( name: string, - domain: string, version?: string, options?: EventEmitterOptions ): EventEmitter { return this.getEventEmitterProvider().getEventEmitter( name, - domain, version, options ); diff --git a/experimental/packages/api-events/src/types/EventEmitterProvider.ts b/experimental/packages/api-events/src/types/EventEmitterProvider.ts index 276b2e627d..26c45b8306 100644 --- a/experimental/packages/api-events/src/types/EventEmitterProvider.ts +++ b/experimental/packages/api-events/src/types/EventEmitterProvider.ts @@ -26,14 +26,12 @@ export interface EventEmitterProvider { * schemaUrl pair is not already created. * * @param name The name of the event emitter or instrumentation library. - * @param domain The domain for events created by the event emitter. * @param version The version of the event emitter or instrumentation library. * @param options The options of the event emitter or instrumentation library. * @returns EventEmitter An event emitter with the given name and version. */ getEventEmitter( name: string, - domain: string, version?: string, options?: EventEmitterOptions ): EventEmitter; diff --git a/experimental/packages/api-events/test/api/api.test.ts b/experimental/packages/api-events/test/api/api.test.ts index e091688ff8..27a4b23b5c 100644 --- a/experimental/packages/api-events/test/api/api.test.ts +++ b/experimental/packages/api-events/test/api/api.test.ts @@ -37,7 +37,7 @@ describe('API', () => { events.setGlobalEventEmitterProvider(new TestEventEmitterProvider()); const eventEmitter = events .getEventEmitterProvider() - .getEventEmitter('name', 'domain'); + .getEventEmitter('name'); assert.deepStrictEqual(eventEmitter, dummyEventEmitter); }); @@ -58,7 +58,7 @@ describe('API', () => { it('should return a event emitter instance from global provider', () => { events.setGlobalEventEmitterProvider(new TestEventEmitterProvider()); - const eventEmitter = events.getEventEmitter('myEventEmitter', 'domain'); + const eventEmitter = events.getEventEmitter('myEventEmitter'); assert.deepStrictEqual(eventEmitter, dummyEventEmitter); }); }); diff --git a/experimental/packages/api-events/test/noop-implementations/noop-event-emitter-provider.test.ts b/experimental/packages/api-events/test/noop-implementations/noop-event-emitter-provider.test.ts index ad88d37058..346a339ce9 100644 --- a/experimental/packages/api-events/test/noop-implementations/noop-event-emitter-provider.test.ts +++ b/experimental/packages/api-events/test/noop-implementations/noop-event-emitter-provider.test.ts @@ -23,18 +23,15 @@ describe('NoopLoggerProvider', () => { const eventEmitterProvider = new NoopEventEmitterProvider(); assert.ok( - eventEmitterProvider.getEventEmitter('emitter-name', 'domain') instanceof + eventEmitterProvider.getEventEmitter('emitter-name') instanceof NoopEventEmitter ); assert.ok( - eventEmitterProvider.getEventEmitter( - 'emitter-name', - 'domain', - 'v1' - ) instanceof NoopEventEmitter + eventEmitterProvider.getEventEmitter('emitter-name', 'v1') instanceof + NoopEventEmitter ); assert.ok( - eventEmitterProvider.getEventEmitter('emitter-name', 'domain', 'v1', { + eventEmitterProvider.getEventEmitter('emitter-name', 'v1', { schemaUrl: 'https://opentelemetry.io/schemas/1.7.0', }) instanceof NoopEventEmitter ); diff --git a/experimental/packages/api-events/test/noop-implementations/noop-event-emitter.test.ts b/experimental/packages/api-events/test/noop-implementations/noop-event-emitter.test.ts index 933a3e6e88..1e4f0a4382 100644 --- a/experimental/packages/api-events/test/noop-implementations/noop-event-emitter.test.ts +++ b/experimental/packages/api-events/test/noop-implementations/noop-event-emitter.test.ts @@ -20,18 +20,12 @@ import { NoopEventEmitterProvider } from '../../src/NoopEventEmitterProvider'; describe('NoopEventEmitter', () => { it('constructor should not crash', () => { - const logger = new NoopEventEmitterProvider().getEventEmitter( - 'test-noop', - 'test-domain' - ); + const logger = new NoopEventEmitterProvider().getEventEmitter('test-noop'); assert(logger instanceof NoopEventEmitter); }); it('calling emit should not crash', () => { - const emitter = new NoopEventEmitterProvider().getEventEmitter( - 'test-noop', - 'test-domain' - ); + const emitter = new NoopEventEmitterProvider().getEventEmitter('test-noop'); emitter.emit({ name: 'event name', });