Skip to content

Commit

Permalink
Fix typo in README & code inline comments
Browse files Browse the repository at this point in the history
It appears, that instead of "gauge", in several places we had a typo "gauce".
This commit fixes it.
  • Loading branch information
swilgosz committed Sep 4, 2024
1 parent cc22533 commit 3b02bc9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ EventTracer.info(
message: 'There is an action',
metrics: {
metric_1: { type: :counter, value: 12 },
metric_2: { type: :gauce, value: 1 },
metric_2: { type: :gauge, value: 1 },
metric_3: { type: :distribution, value: 10 }
}
)
Expand All @@ -131,7 +131,7 @@ Appsignal >= 2.5 is currently supported for the following metric functions:
|------------------------|-----------------|
| increment_counter | counter |
| add_distribution_value | distribution |
| set_gauge | gauce |
| set_gauge | gauge |

We can also add [tags](https://docs.appsignal.com/metrics/custom.html#metric-tags) for metric:

Expand Down Expand Up @@ -232,7 +232,7 @@ registry = if Sidekiq.server?
else
Prometheus.registry
end

logger = EventTracer::Prometheus.new(registry, allowed_tags: [], default_tags: {})
EventTracer.register :prometheus, logger
```
Expand All @@ -242,16 +242,16 @@ Then you can track your metrics using the same interface that `EventTracer` prov
*Notes*
- For multi-processes app, we need to choose the `DirectFileStore` for Prometheus's data store. Read on [Data store](https://github.com/prometheus/client_ruby#data-stores) for more information.

- Prometheus requires every metrics to be pre-registered before we can track them. In `EventTracer`, by default it will raise the error for any unregistered metrics. Alternative, we provide a `raise_if_missing` flag to allow just-in-time metric registration.
- Prometheus requires every metrics to be pre-registered before we can track them. In `EventTracer`, by default it will raise the error for any unregistered metrics. Alternative, we provide a `raise_if_missing` flag to allow just-in-time metric registration.
```ruby
logger = EventTracer::Prometheus.new(
registry,
allowed_tags: [],
registry,
allowed_tags: [],
default_tags: {},
raise_if_missing: false # this will register the missing metric instead of raising error
)
```
However, doing so defeats the purpose of being clear on what metrics we want to track and can also result in a performance penalty.
However, doing so defeats the purpose of being clear on what metrics we want to track and can also result in a performance penalty.
To make the metrics registration less tedious, we recommend you to standardize your custom metrics name.

### Results
Expand Down
2 changes: 1 addition & 1 deletion lib/event_tracer/appsignal_logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# EventTracer::AppsignalLogger.new(Appsignal, allowed_tags: ['tag_1', 'tag_2'])
#
# appsignal_logger.info metrics: [:counter_1, :counter_2]
# appsignal_logger.info metrics: { counter_1: { type: :counter, value: 1 }, gauce_2: { type: :gauce, value: 10 } }
# appsignal_logger.info metrics: { counter_1: { type: :counter, value: 1 }, gauge_2: { type: :gauge, value: 10 } }
module EventTracer
class AppsignalLogger < MetricLogger

Expand Down

0 comments on commit 3b02bc9

Please sign in to comment.