You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-26Lines changed: 4 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -113,7 +113,7 @@ To provide backwards compatibility, some of YACE's new features or breaking chan
113
113
114
114
## Installing and running
115
115
116
-
Refer to the [installing guide](docs/install.md).
116
+
Refer to the [installation guide](docs/installation.md).
117
117
118
118
## Authentication
119
119
@@ -278,31 +278,9 @@ This protects from the abuse of API requests that can cause extra billing in AWS
278
278
The flag 'scraping-interval' defines the seconds between scrapes.
279
279
The default value is 300.
280
280
281
-
## Using YACE as a Go library
282
-
283
-
It is possible to embed YACE in to an external application. This mode might be useful to you if you would like to scrape on demand or run in a stateless manner.
284
-
285
-
The entrypoint to use YACE as a library is the `UpdateMetrics` func in [update.go](./pkg/exporter.go#L35) which requires,
286
-
- `config`: this is the struct representation of the configuration defined in [Top Level Configuration](#top-level-configuration)
287
-
- `registry`: any prometheus compatible registry where scraped AWS metrics will be written
288
-
- `metricsPerQuery`: controls the same behavior defined by the CLI flag `metrics-per-query`
289
-
- `labelsSnakeCase`: controls the same behavior defined by the CLI flag `labels-snake-case`
290
-
- `cloudwatchSemaphore`/`tagSemaphore`: adjusts the concurrency of requests as defined by [Requests concurrency](#requests-concurrency). Pass in a different length channel to adjust behavior
291
-
- `cache`
292
-
- Any implementation of the [SessionCache Interface](./pkg/session/sessions.go#L41)
293
-
- `session.NewSessionCache(config, <fips value>)`would be the default
294
-
- `<fips value>`is defined by the `fips` CLI flag
295
-
- `observedMetricLabels`
296
-
- Prometheus requires that all metrics exported with the same key have the same labels
297
-
- This map will track all labels observed and ensure they are exported on all metrics with the same key in the provided `registry`
298
-
- You should provide the same instance of this map if you intend to re-use the `registry` between calls
299
-
- `logger`
300
-
- Any implementation of the [Logger Interface](./pkg/logging/logger.go#L13)
301
-
- `logging.NewLogger(logrus.StandardLogger())`is an acceptable default
302
-
303
-
The update definition also includes an exported slice of [Metrics](./pkg/exporter.go#L18) which includes AWS API call metrics. These can be registered with the provided `registry` if you want them
304
-
included in the AWS scrape results. If you are using multiple instances of `registry` it might make more sense to register these metrics in the application using YACE as a library to better
305
-
track them over the lifetime of the application.
281
+
## Embedding YACE in your application
282
+
283
+
YACE can be used as a library and embedded into your application, see the [embedding guide](docs/embedding.md).
It is possible to embed YACE into an external Go application. This mode might be useful to you if you would like to scrape on demand or run in a stateless manner.
4
+
5
+
See [`exporter.UpdateMetrics()`](https://pkg.go.dev/github.com/nerdswords/[email protected]/pkg#UpdateMetrics) for the documentation of the exporter entrypoint.
// UpdateMetrics can be used to scrape metrics from AWS on demand using the provided parameters. Scraped metrics will be added to the provided registry and
118
-
// any labels discovered during the scrape will be added to observedMetricLabels with their metric name as the key. Any errors encountered are not returned but
119
-
// will be logged and will either fail the scrape or a partial metric result will be added to the registry.
117
+
// UpdateMetrics is the entrypoint to scrape metrics from AWS on demand.
118
+
//
119
+
// Parameters are:
120
+
// - `ctx`: a context for the request
121
+
// - `config`: this is the struct representation of the configuration defined in top-level configuration
122
+
// - `logger`: any implementation of the `Logger` interface
123
+
// - `registry`: any prometheus compatible registry where scraped AWS metrics will be written
124
+
// - `cache`: any implementation of the `SessionCache`
125
+
// - `optFuncs`: (optional) any number of options funcs
126
+
//
127
+
// You can pre-register any of the default metrics with the provided `registry` if you want them
128
+
// included in the AWS scrape results. If you are using multiple instances of `registry` it
129
+
// might make more sense to register these metrics in the application using YACE as a library to better
130
+
// track them over the lifetime of the application.
0 commit comments