Skip to content

Commit

Permalink
Modernize gem and update documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Mar 3, 2023
1 parent 25c38fe commit 9735675
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
12 changes: 7 additions & 5 deletions guides/capture/readme.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Document
# Capture

This guide explains how to use `metrics` for exporting metric definitions from your application.

## Capture Metrics
## With Provider Metrics

If your application defines one or more metrics, you can export them using the `bake metrics:document` command. This command will generate a list of metrics which you can export.

```bash
$ cd test/metrics/backend/.capture/
$ bake metrics:capture environment metrics:capture:list output --format json
[
{
Expand All @@ -27,12 +28,13 @@ $ bake metrics:capture environment metrics:capture:list output --format json
]
```

## Capture Metrics with Test Data
## With Test Suite

If your application has a test suite which emits metrics, you can capture those as samples for the purpose of your documentation. This includes fields like tags.

```bash
$ bake metrics:capture test metrics:capture:list output --format json
$ cd test/metrics/backend/.capture/
$ bake metrics:capture run metrics:capture:list output --format json
[
{
"name": "my_metric",
Expand All @@ -52,4 +54,4 @@ $ bake metrics:capture test metrics:capture:list output --format json
]
```

This will assume you have a top level bake task `bake test` which runs your test suite.
This uses a custom task called `run` in the above example, but you should probably consider using `bake test` which runs your test suite.
2 changes: 1 addition & 1 deletion lib/metrics/backend/capture.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2021-2022, by Samuel Williams.
# Copyright, 2023, by Samuel Williams.

require 'console'
require_relative '../metric'
Expand Down
2 changes: 1 addition & 1 deletion lib/metrics/version.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2021-2022, by Samuel Williams.
# Copyright, 2021-2023, by Samuel Williams.

module Metrics
VERSION = "0.6.1"
Expand Down
2 changes: 2 additions & 0 deletions test/metrics/backend/.capture/app.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Released under the MIT License.
# Copyright, 2023, by Samuel Williams.

require 'metrics/provider'

Expand Down
2 changes: 2 additions & 0 deletions test/metrics/backend/.capture/bake.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Released under the MIT License.
# Copyright, 2023, by Samuel Williams.

def environment
require_relative 'app'
Expand Down

0 comments on commit 9735675

Please sign in to comment.