@@ -119,6 +119,16 @@ public Logging logging() {
119119 /**
120120 * Deletes this metric.
121121 *
122+ * <p>Example of deleting the metric.
123+ * <pre> {@code
124+ * boolean deleted = metric.delete();
125+ * if (deleted) {
126+ * // the metric was deleted
127+ * } else {
128+ * // the metric was not found
129+ * }
130+ * }</pre>
131+ *
122132 * @return {@code true} if the metric was deleted, {@code false} if it was not found
123133 * @throws LoggingException upon failure
124134 */
@@ -131,6 +141,18 @@ public boolean delete() {
131141 * consume the result. {@link Future#get()} returns {@code true} if the metric was deleted,
132142 * {@code false} if it was not found.
133143 *
144+ * <p>Example of asynchronously deleting the metric.
145+ * <pre> {@code
146+ * Future<Boolean> future = metric.deleteAsync();
147+ * // ...
148+ * boolean deleted = future.get();
149+ * if (deleted) {
150+ * // the metric was deleted
151+ * } else {
152+ * // the metric was not found
153+ * }
154+ * }</pre>
155+ *
134156 * @throws LoggingException upon failure
135157 */
136158 public Future <Boolean > deleteAsync () {
@@ -140,6 +162,14 @@ public Future<Boolean> deleteAsync() {
140162 /**
141163 * Fetches current metric's latest information. Returns {@code null} if the metric does not exist.
142164 *
165+ * <p>Example of getting the metric's latest information.
166+ * <pre> {@code
167+ * Metric latestMetric = metric.reload();
168+ * if (latestMetric == null) {
169+ * // the metric was not found
170+ * }
171+ * }</pre>
172+ *
143173 * @return a {@code Metric} object with latest information or {@code null} if not found
144174 * @throws LoggingException upon failure
145175 */
@@ -152,6 +182,16 @@ public Metric reload() {
152182 * {@code Future} object to consume the result. {@link Future#get()} returns a {@code Metric}
153183 * object with latest information or {@code null} if not found.
154184 *
185+ * <p>Example of asynchronously getting the metric's latest information.
186+ * <pre> {@code
187+ * Future<Metric> future = metric.reloadAsync();
188+ * // ...
189+ * Metric latestMetric = future.get();
190+ * if (latestMetric == null) {
191+ * // the metric was not found
192+ * }
193+ * }</pre>
194+ *
155195 * @throws LoggingException upon failure
156196 */
157197 public Future <Metric > reloadAsync () {
@@ -161,22 +201,40 @@ public Future<Metric> reloadAsync() {
161201 /**
162202 * Updates current metric. If the metric does not exist, it is created.
163203 *
204+ * <p>Example of updating the metric's information.
205+ * <pre> {@code
206+ * Metric updatedMetric = metric.toBuilder()
207+ * .description("A more detailed description")
208+ * .build()
209+ * .update();
210+ * }</pre>
211+ *
164212 * @return a {@code Metric} object with updated information
165213 * @throws LoggingException upon failure
166214 */
167- public Metric update (MetricInfo metricInfo ) {
168- return logging .update (metricInfo );
215+ public Metric update () {
216+ return logging .update (this );
169217 }
170218
171219 /**
172220 * Sends a request to update current metric. If the metric does not exist, it is created. This
173221 * method returns a {@code Future} object to consume the result. {@link Future#get()} returns a
174222 * {@code Metric} object with updated information.
175223 *
224+ * <p>Example of asynchronously updating the metric's information.
225+ * <pre> {@code
226+ * Future<Metric> future = metric.toBuilder()
227+ * .description("A more detailed description")
228+ * .build()
229+ * .updateAsync();
230+ * // ...
231+ * Metric updatedMetric = future.get();
232+ * }</pre>
233+ *
176234 * @throws LoggingException upon failure
177235 */
178- public Future <Metric > updateAsync (MetricInfo metricInfo ) {
179- return logging .updateAsync (metricInfo );
236+ public Future <Metric > updateAsync () {
237+ return logging .updateAsync (this );
180238 }
181239
182240 private void readObject (ObjectInputStream input ) throws IOException , ClassNotFoundException {
0 commit comments