-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework "Document" -> "Capture" and update tasks.
- Loading branch information
Showing
14 changed files
with
93 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ jobs: | |
- "2.7" | ||
- "3.0" | ||
- "3.1" | ||
- "3.2" | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ jobs: | |
- "2.7" | ||
- "3.0" | ||
- "3.1" | ||
- "3.2" | ||
|
||
experimental: [false] | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
# Released under the MIT License. | ||
# Copyright, 2023, by Samuel Williams. | ||
|
||
def capture | ||
ENV['METRICS_BACKEND'] = 'metrics/backend/capture' | ||
require 'metrics' | ||
end | ||
|
||
# Generate a list of metrics using the document backend. | ||
def list | ||
Metrics::Backend::Capture.metrics.sort_by!{|metric| metric.name} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
getting-started: | ||
order: 1 | ||
document: | ||
capture: | ||
order: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# frozen_string_literal: true | ||
|
||
# Released under the MIT License. | ||
# Copyright, 2023, by Samuel Williams. | ||
|
||
require 'metrics/provider' | ||
|
||
describe Metrics::Provider do | ||
let(:document_root) {File.expand_path(".capture", __dir__)} | ||
let(:environment) {{'METRICS_BACKEND' => nil}} | ||
|
||
it "runs without metrics" do | ||
pid = Process.spawn(environment, "bundle", "exec", "bake", "run", chdir: document_root) | ||
pid, status = Process.wait2(pid) | ||
|
||
expect(status).to be(:success?) | ||
end | ||
|
||
it "can list all metrics" do | ||
input, output = IO.pipe | ||
|
||
pid = Process.spawn(environment, "bundle", "exec", "bake", "metrics:capture", "environment", "metrics:capture:list", "output", "--format", "json", chdir: document_root, out: output) | ||
output.close | ||
Process.wait(pid) | ||
|
||
metrics = JSON.parse(input.read) | ||
|
||
expect(metrics).to be_a(Array) | ||
metric = metrics[0] | ||
|
||
expect(metric).to have_keys( | ||
"name" => be == "my_metric", | ||
"type" => be == "gauge", | ||
"description" => be == "My metric", | ||
"unit" => be == "seconds", | ||
"values" => be == [], | ||
"tags" => be == [], | ||
"sample_rates" => be == [] | ||
) | ||
end | ||
|
||
it "can collect metrics" do | ||
input, output = IO.pipe | ||
|
||
pid = Process.spawn(environment, "bundle", "exec", "bake", "metrics:capture", "run", "metrics:capture:list", "output", "--format", "json", chdir: document_root, out: output) | ||
output.close | ||
Process.wait(pid) | ||
|
||
metrics = JSON.parse(input.read) | ||
|
||
expect(metrics).to be_a(Array) | ||
metric = metrics[0] | ||
|
||
expect(metric).to have_keys( | ||
"name" => be == "my_metric", | ||
"type" => be == "gauge", | ||
"description" => be == "My metric", | ||
"unit" => be == "seconds", | ||
"values" => be == [1], | ||
"tags" => be == ['environment:test'], | ||
"sample_rates" => be == [1.0] | ||
) | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.