Skip to content

Commit b05634d

Browse files
committed
Rename pushSingleMetric to flushSingleMetric.
1 parent 7ef4e69 commit b05634d

File tree

12 files changed

+26
-27
lines changed

12 files changed

+26
-27
lines changed

docs/core/metrics.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ If you wish to set custom default dimensions, it can be done via `#!java metrics
414414

415415
### Creating a single metric with different configuration
416416

417-
You can create a single metric with its own namespace and dimensions using `pushSingleMetric`:
417+
You can create a single metric with its own namespace and dimensions using `flushSingleMetric`:
418418

419419
=== "App.java"
420420

@@ -430,7 +430,7 @@ You can create a single metric with its own namespace and dimensions using `push
430430
@Override
431431
@Metrics(namespace = "ServerlessAirline", service = "payment")
432432
public Object handleRequest(Object input, Context context) {
433-
metricsLogger.pushSingleMetric(
433+
metricsLogger.flushSingleMetric(
434434
"CustomMetric",
435435
1,
436436
MetricUnit.COUNT,

examples/powertools-examples-core-utilities/cdk/app/src/main/java/helloworld/App.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEv
6262
"AnotherService", "CustomService",
6363
"AnotherService1", "CustomService1"
6464
);
65-
metricsLogger.pushSingleMetric("CustomMetric2", 1, MetricUnit.COUNT, "Another", dimensionSet);
65+
metricsLogger.flushSingleMetric("CustomMetric2", 1, MetricUnit.COUNT, "Another", dimensionSet);
6666

6767
MDC.put("test", "willBeLogged");
6868

@@ -105,4 +105,4 @@ private String getPageContents(String address) throws IOException {
105105
return br.lines().collect(Collectors.joining(System.lineSeparator()));
106106
}
107107
}
108-
}
108+
}

examples/powertools-examples-core-utilities/gradle/src/main/java/helloworld/App.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEv
6363
"AnotherService", "CustomService",
6464
"AnotherService1", "CustomService1"
6565
);
66-
metricsLogger.pushSingleMetric("CustomMetric2", 1, MetricUnit.COUNT, "Another", dimensionSet);
66+
metricsLogger.flushSingleMetric("CustomMetric2", 1, MetricUnit.COUNT, "Another", dimensionSet);
6767

6868
MDC.put("test", "willBeLogged");
6969

@@ -106,4 +106,4 @@ private String getPageContents(String address) throws IOException {
106106
return br.lines().collect(Collectors.joining(System.lineSeparator()));
107107
}
108108
}
109-
}
109+
}

examples/powertools-examples-core-utilities/kotlin/src/main/kotlin/helloworld/App.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class App : RequestHandler<APIGatewayProxyRequestEvent?, APIGatewayProxyResponse
5454
"AnotherService", "CustomService",
5555
"AnotherService1", "CustomService1"
5656
)
57-
metricsLogger.pushSingleMetric("CustomMetric2", 1.0, MetricUnit.COUNT, "Another", dimensionSet)
57+
metricsLogger.flushSingleMetric("CustomMetric2", 1.0, MetricUnit.COUNT, "Another", dimensionSet)
5858

5959
MDC.put("test", "willBeLogged")
6060
val response = APIGatewayProxyResponseEvent().withHeaders(headers)
@@ -96,4 +96,4 @@ class App : RequestHandler<APIGatewayProxyRequestEvent?, APIGatewayProxyResponse
9696
reader.readText().trim()
9797
}
9898
}
99-
}
99+
}

examples/powertools-examples-core-utilities/sam-graalvm/src/main/java/helloworld/App.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEv
6464
"AnotherService", "CustomService",
6565
"AnotherService1", "CustomService1"
6666
);
67-
metricsLogger.pushSingleMetric("CustomMetric2", 1, MetricUnit.COUNT, "Another", dimensionSet);
67+
metricsLogger.flushSingleMetric("CustomMetric2", 1, MetricUnit.COUNT, "Another", dimensionSet);
6868

6969
metricsLogger.addMetric("CustomMetric3", 1, MetricUnit.COUNT, MetricResolution.HIGH);
7070

@@ -109,4 +109,4 @@ private String getPageContents(String address) throws IOException {
109109
return br.lines().collect(Collectors.joining(System.lineSeparator()));
110110
}
111111
}
112-
}
112+
}

examples/powertools-examples-core-utilities/sam/src/main/java/helloworld/App.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEv
6666
DimensionSet dimensionSet = new DimensionSet();
6767
dimensionSet.addDimension("AnotherService", "CustomService");
6868
dimensionSet.addDimension("AnotherService1", "CustomService1");
69-
metricsLogger.pushSingleMetric("CustomMetric2", 1, MetricUnit.COUNT, "Another", dimensionSet);
69+
metricsLogger.flushSingleMetric("CustomMetric2", 1, MetricUnit.COUNT, "Another", dimensionSet);
7070

7171
metricsLogger.addMetric("CustomMetric3", 1, MetricUnit.COUNT, MetricResolution.HIGH);
7272

examples/powertools-examples-core-utilities/serverless/src/main/java/helloworld/App.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEv
6363
"AnotherService", "CustomService",
6464
"AnotherService1", "CustomService1"
6565
);
66-
metricsLogger.pushSingleMetric("CustomMetric2", 1, MetricUnit.COUNT, "Another", dimensionSet);
66+
metricsLogger.flushSingleMetric("CustomMetric2", 1, MetricUnit.COUNT, "Another", dimensionSet);
6767

6868
MDC.put("test", "willBeLogged");
6969

@@ -101,4 +101,4 @@ private String getPageContents(String address) throws IOException {
101101
return br.lines().collect(Collectors.joining(System.lineSeparator()));
102102
}
103103
}
104-
}
104+
}

examples/powertools-examples-core-utilities/terraform/src/main/java/helloworld/App.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEv
6363
"AnotherService", "CustomService",
6464
"AnotherService1", "CustomService1"
6565
);
66-
metricsLogger.pushSingleMetric("CustomMetric2", 1, MetricUnit.COUNT, "Another", dimensionSet);
66+
metricsLogger.flushSingleMetric("CustomMetric2", 1, MetricUnit.COUNT, "Another", dimensionSet);
6767

6868
MDC.put("test", "willBeLogged");
6969

@@ -101,4 +101,4 @@ private String getPageContents(String address) throws IOException {
101101
return br.lines().collect(Collectors.joining(System.lineSeparator()));
102102
}
103103
}
104-
}
104+
}

powertools-metrics/src/main/java/software/amazon/lambda/powertools/metrics/MetricsLogger.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ default void captureColdStartMetric() {
152152
}
153153

154154
/**
155-
* Push a single metric with custom dimensions. This creates a separate metrics context
155+
* Flush a single metric with custom dimensions. This creates a separate metrics context
156156
* that doesn't affect the default metrics context.
157157
*
158158
* @param name the name of the metric
@@ -161,19 +161,18 @@ default void captureColdStartMetric() {
161161
* @param namespace the namespace for the metric
162162
* @param dimensions custom dimensions for this metric (optional)
163163
*/
164-
void pushSingleMetric(String name, double value, MetricUnit unit, String namespace,
165-
DimensionSet dimensions);
164+
void flushSingleMetric(String name, double value, MetricUnit unit, String namespace, DimensionSet dimensions);
166165

167166
/**
168-
* Push a single metric with custom dimensions. This creates a separate metrics context
167+
* Flush a single metric with custom dimensions. This creates a separate metrics context
169168
* that doesn't affect the default metrics context.
170169
*
171170
* @param name the name of the metric
172171
* @param value the value of the metric
173172
* @param unit the unit of the metric
174173
* @param namespace the namespace for the metric
175174
*/
176-
default void pushSingleMetric(String name, double value, MetricUnit unit, String namespace) {
177-
pushSingleMetric(name, value, unit, namespace, null);
175+
default void flushSingleMetric(String name, double value, MetricUnit unit, String namespace) {
176+
flushSingleMetric(name, value, unit, namespace, null);
178177
}
179178
}

powertools-metrics/src/main/java/software/amazon/lambda/powertools/metrics/internal/EmfMetricsLogger.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ public void captureColdStartMetric(software.amazon.lambda.powertools.metrics.mod
201201
}
202202

203203
@Override
204-
public void pushSingleMetric(String name, double value, MetricUnit unit, String namespace,
204+
public void flushSingleMetric(String name, double value, MetricUnit unit, String namespace,
205205
software.amazon.lambda.powertools.metrics.model.DimensionSet dimensions) {
206206
Validator.validateNamespace(namespace);
207207

0 commit comments

Comments
 (0)