Skip to content

Commit 6459e65

Browse files
author
Hweinstock
committed
refactor(tel): rename start --> create
1 parent f01e5ff commit 6459e65

5 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ process.exit(
5050
globalConfigAccessor,
5151
});
5252

53-
const commandRunMetricEvent = telemetryClient.startMetricEvent("cli.command_run", {
53+
const commandRunMetricEvent = telemetryClient.createMetricEvent("cli.command_run", {
5454
exit_reason: "success",
5555
});
5656

src/router/router.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ test.each([
706706
const root = new Router("agentcore");
707707
root.handler(get);
708708

709-
const commandRunMetricEvent = telemetryClient.startMetricEvent("cli.command_run");
709+
const commandRunMetricEvent = telemetryClient.createMetricEvent("cli.command_run");
710710
const ctx = ValueContext.EmptyContext().withValue(
711711
CommandRunMetricEventKey,
712712
commandRunMetricEvent,

src/telemetry/client.test.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ describe("DefaultTelemetryClient", () => {
4040
metricSinks: [fileSystemSink],
4141
});
4242

43-
const metricEvent = client.startMetricEvent("cli.command_run", {
43+
const metricEvent = client.createMetricEvent("cli.command_run", {
4444
exit_reason: "success",
4545
command_path: "/agentcore",
4646
});
4747

4848
await metricEvent.emit(123);
4949

5050
// Start a second event with failure
51-
const metricEvent2 = client.startMetricEvent("cli.command_run", {
51+
const metricEvent2 = client.createMetricEvent("cli.command_run", {
5252
exit_reason: "failure",
5353
command_path: "/agentcore",
5454
});
@@ -134,14 +134,14 @@ describe("DefaultTelemetryClient", () => {
134134
auditFilePath,
135135
});
136136

137-
const enabledEvent = enabledClient.startMetricEvent("cli.command_run", {
137+
const enabledEvent = enabledClient.createMetricEvent("cli.command_run", {
138138
exit_reason: "success",
139139
command_path: "/agentcore",
140140
is_tui: true,
141141
});
142142
await enabledEvent.emit(123);
143143

144-
const disabledEvent = disabledClient.startMetricEvent("cli.command_run", {
144+
const disabledEvent = disabledClient.createMetricEvent("cli.command_run", {
145145
exit_reason: "failure",
146146
command_path: "/agentcore",
147147
is_tui: false,
@@ -179,7 +179,7 @@ describe("DefaultTelemetryClient", () => {
179179
metricSinks: [],
180180
});
181181

182-
const metricEvent = client.startMetricEvent("cli.command_run");
182+
const metricEvent = client.createMetricEvent("cli.command_run");
183183

184184
await expect(metricEvent.emit(100)).rejects.toThrow();
185185
await client.shutdown();
@@ -198,7 +198,7 @@ describe("DefaultTelemetryClient", () => {
198198
globalConfigAccessor: new TestGlobalConfigAccessor(),
199199
metricSinks: [sink],
200200
});
201-
const metricEvent = client.startMetricEvent("cli.command_run", {
201+
const metricEvent = client.createMetricEvent("cli.command_run", {
202202
exit_reason: "success",
203203
command_path: "/agentcore",
204204
});
@@ -242,7 +242,7 @@ describe("DefaultTelemetryClient", () => {
242242
metricSinks: [badSink, goodSink],
243243
});
244244

245-
const metricEvent = client.startMetricEvent("cli.command_run", {
245+
const metricEvent = client.createMetricEvent("cli.command_run", {
246246
exit_reason: "success",
247247
command_path: "/agentcore",
248248
});

src/telemetry/client.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class DefaultTelemetryClient implements TelemetryClient {
4242
path.join(os.homedir(), ".agentcore", "telemetry", `${this.sessionId}.jsonl`);
4343
}
4444

45-
startMetricEvent<TMetricName extends MetricName>(
45+
createMetricEvent<TMetricName extends MetricName>(
4646
metricName: TMetricName,
4747
initialAttributes: Partial<AttributesOf<TMetricName>> = {},
4848
): MetricEvent<TMetricName> {

src/telemetry/types.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export interface TelemetryClient {
88
/**
99
* Start a new metric event that accumulates attributes over its lifecycle.
1010
*/
11-
startMetricEvent<TMetricName extends MetricName>(
11+
createMetricEvent<TMetricName extends MetricName>(
1212
metricName: TMetricName,
1313
initialAttributes?: Partial<AttributesOf<TMetricName>>,
1414
): MetricEvent<TMetricName>;

0 commit comments

Comments
 (0)