Skip to content

Commit a60d60a

Browse files
authored
specify default Config for the Registry (#95)
1 parent 5dbadf7 commit a60d60a

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nflx-spectator",
3-
"version": "3.0.3",
3+
"version": "3.0.4",
44
"license": "Apache-2.0",
55
"homepage": "https://github.com/Netflix/spectator-js",
66
"author": "Netflix Telemetry Engineering <netflix-atlas@googlegroups.com>",

src/registry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class Registry {
2525
private _config: Config;
2626
private readonly _writer: WriterUnion;
2727

28-
constructor(config: Config) {
28+
constructor(config: Config = new Config()) {
2929
this._config = config;
3030
this.logger = config.logger;
3131
this._writer = new_writer(this._config.location, this.logger);

test/registry.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
PercentileDistributionSummary,
1616
PercentileTimer,
1717
Registry,
18-
Timer
18+
Timer, UdpWriter
1919
} from "../src/index.js";
2020
import {describe, it} from "node:test";
2121

@@ -32,6 +32,11 @@ describe("Registry Tests", (): void => {
3232
assert.isTrue(writer.is_empty());
3333
});
3434

35+
it("default config", (): void => {
36+
const r = new Registry();
37+
assert.isTrue(r.writer() instanceof UdpWriter);
38+
});
39+
3540
it("age_gauge", (): void => {
3641
const r = new Registry(new Config("memory"));
3742
const writer = r.writer() as MemoryWriter;

0 commit comments

Comments
 (0)