Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prepare 5.9.0 release #83

Merged
merged 234 commits into from
Dec 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
234 commits
Select commit Hold shift + click to select a range
bc5d48d
Run tests for all packages on CI
atrakh Jul 20, 2018
abdd059
Merge pull request #47 from launchdarkly/at/run-tests-on-ci
atrakh Jul 20, 2018
8920fb4
Fix typo in event field
ashanbrown Jul 24, 2018
19999ab
Stop running exporter tests in parallel.
ashanbrown Jul 24, 2018
02efa40
Disable another parallel test run
ashanbrown Jul 24, 2018
0de5f78
Add public OpenCensus exporters, route traces, and route hit counts
atrakh Jul 17, 2018
0ae8f2d
Make packages we don't intend for public use internal
atrakh Jul 25, 2018
8b23ecf
Merge pull request #52 from launchdarkly/at/make-things-internal
atrakh Jul 25, 2018
13eee66
Wait for views to finish being exported after each test (#51)
ashanbrown Jul 26, 2018
ce542eb
Add global tag configuration for datadog exporter
atrakh Jul 26, 2018
e433616
Flatten metrics tests
atrakh Jul 26, 2018
98e41f7
Merge pull request #53 from launchdarkly/at/ch20965/ld-relay-add-conf…
atrakh Jul 26, 2018
7773b60
Use goreleaser to release images (#55)
ashanbrown Jul 27, 2018
a3de1c9
Fix build by not running publish for private repo.
ashanbrown Jul 27, 2018
16b6fc8
Don't check git tags when running release.
ashanbrown Jul 27, 2018
ffcb94c
Fix gorelease arg
ashanbrown Jul 27, 2018
17523a1
Ensure scripts know that version is now in internal packages.
ashanbrown Jul 27, 2018
b66c5fe
Address review
atrakh Jul 27, 2018
2bf0f36
address review
atrakh Jul 27, 2018
da5f190
Merge branch 'v5' into at/ch20947/ld-relay-have-less-nesting-in-metri…
atrakh Jul 27, 2018
68951c7
Seperate private and public metrics
atrakh Jul 27, 2018
cb32106
Merge pull request #54 from launchdarkly/at/ch20947/ld-relay-have-les…
atrakh Jul 27, 2018
5f50c2e
add methods to get public and private views
atrakh Jul 27, 2018
0423660
remove useless test
atrakh Jul 27, 2018
35c1315
Merge pull request #56 from launchdarkly/at/ch21033/seperate-private-…
atrakh Jul 27, 2018
f9bc10f
Fix readme
atrakh Jul 30, 2018
4c88991
Update internal events exporter to use private measures
atrakh Jul 30, 2018
a186236
Change name of private measures to internal_X
atrakh Jul 30, 2018
9befab4
Merge pull request #57 from launchdarkly/at/fix-readme
atrakh Jul 30, 2018
502935f
Move logging out of internal packages. (#58)
ashanbrown Jul 30, 2018
b153604
Set docker credentials
ashanbrown Jul 30, 2018
fb32400
Merge remote-tracking branch 'public/v5' into v5
ashanbrown Jul 30, 2018
8bcb962
Update datadog opencensus exporter
atrakh Aug 3, 2018
9629cd6
[ch21633] Use the route path template for metrics tags (#61)
atrakh Aug 3, 2018
607d1af
Merge remote-tracking branch 'public/v5' into v5
atrakh Aug 3, 2018
79f6d77
Provide default values for flush interval. (#62)
ashanbrown Aug 4, 2018
9ab9acc
add /meval ping stream
eli-darkly Aug 9, 2018
02da31c
add /meval to readme
eli-darkly Aug 9, 2018
49e3e54
Update README.md
arun251 Aug 9, 2018
15e5f29
add /meval to basic endpoint tests
eli-darkly Aug 9, 2018
9b90674
Merge pull request #63 from launchdarkly/eb/ch17401/meval
eli-darkly Aug 9, 2018
27c688f
version 5.4.0
eli-darkly Aug 9, 2018
a0c0004
Merge branch 'v5' of github.com:launchdarkly/ld-relay into v5
eli-darkly Aug 9, 2018
232e34f
Use the X-LaunchDarkly-User-Agent header for metrics if available (#65)
ashanbrown Aug 22, 2018
eaa3bd9
Remove trailing slash from streaming and events urls (#68)
ashanbrown Aug 24, 2018
569e50b
Fix release note generator
ashanbrown Aug 24, 2018
b2ffd2e
fix default base and stream uris
brooswit Aug 24, 2018
714a4db
Merge pull request #67 from launchdarkly/jw/ch22782
Aug 24, 2018
182b443
fix documented default values (#64)
Aug 24, 2018
19408d2
update readme to contain status endpoint (#59)
Aug 24, 2018
60a4560
Fix typo in README.
ashanbrown Aug 24, 2018
74f3649
Merge remote-tracking branch 'public/v5' into v5
ashanbrown Aug 24, 2018
8c4baee
Update go client (#69)
ashanbrown Aug 27, 2018
511f43f
update Go client to 4.3.0
eli-darkly Aug 27, 2018
cdc7891
don't use deprecated method
eli-darkly Aug 27, 2018
7c6053e
Merge pull request #70 from launchdarkly/eb/go-client-4.3.0
eli-darkly Aug 27, 2018
a666a75
Ensure that we run middleware for server-side eval endpoints. (#71)
ashanbrown Aug 29, 2018
1efb2ff
Merge remote-tracking branch 'public/v5' into v5
ashanbrown Aug 29, 2018
0e7b795
Change RelayMetrics field from StopDate to EndDate (#72)
ashanbrown Aug 29, 2018
28ddad5
add description of client-side flag issue (+ rm duplicate changelog e…
eli-darkly Aug 30, 2018
ba9fbde
Merge pull request #73 from launchdarkly/eb/changelog
eli-darkly Aug 30, 2018
bb184f4
Return reasons for evaluation responses when withReasons=true. (#75)
ashanbrown Aug 31, 2018
cbcc9af
Use Get method to look up withReasons query parameter. (#76)
ashanbrown Sep 5, 2018
9197b1b
[ch21867] Add docker env variables for metric export configuration (#74)
atrakh Sep 6, 2018
9e80b34
Merge remote-tracking branch 'public/v5' into v5
ashanbrown Sep 7, 2018
4602bc8
Merge branch 'v5' of github.com:launchdarkly/ld-relay into v5
eli-darkly Nov 16, 2018
c6af9ec
allow Consul or DynamoDB feature store
eli-darkly Nov 16, 2018
e85dd27
readme edits
eli-darkly Nov 16, 2018
1978cfe
allow per-environment DynamoDB table name
eli-darkly Nov 16, 2018
c3903f9
Fix goreleaser docker image to use /ldr directory.
ashanbrown Nov 16, 2018
f9dd1b8
Doc fixes
ashanbrown Nov 16, 2018
e91daa1
Improve docs
ashanbrown Nov 16, 2018
c5f3dc3
Fix typo
ashanbrown Nov 16, 2018
acc19d8
Fix test
ashanbrown Nov 16, 2018
232e841
Merge branch 'ashanbrown/fix-entrypoint' of github.com:launchdarkly/l…
eli-darkly Nov 16, 2018
56fd700
Fix goreleaser docker image to be able to write to the /ldr directory…
ashanbrown Nov 16, 2018
8e3e2c8
Merge branch 'v5' into eb/ch26703/dynamo-consul
eli-darkly Nov 16, 2018
953eab4
allow per-environment DynamoDB config; improve Docker script
eli-darkly Nov 16, 2018
e5dadf6
add Consul and DynamoDB support to ld-relay
eli-darkly Nov 17, 2018
1ce79ec
readme & script fixes
eli-darkly Nov 17, 2018
53aa7c6
readme fix
eli-darkly Nov 17, 2018
f7e4110
fix unreleased read lock that can cause a hang
eli-darkly Nov 19, 2018
f793348
Merge pull request #79 from launchdarkly/eb/ch26827/client-hang
eli-darkly Nov 19, 2018
0f8cb78
merge from public after release
LaunchDarklyCI Nov 20, 2018
ab91cf0
fix readme explanation of DDB table name
eli-darkly Nov 20, 2018
ca4c611
fix comment about environment ID
eli-darkly Nov 20, 2018
9e328d4
Merge branch 'v5' into eb/ch26703/dynamo-consul
eli-darkly Nov 20, 2018
aa03939
Merge pull request #78 from launchdarkly/eb/ch26703/dynamo-consul
eli-darkly Nov 20, 2018
d760a54
Merge branch 'v5' of github.com:launchdarkly/ld-relay into v5
eli-darkly Nov 21, 2018
d15d220
use client 4.6.1
eli-darkly Nov 27, 2018
a2101cc
add missing prefix info
eli-darkly Nov 27, 2018
96bd8cf
merge from public after release
LaunchDarklyCI Nov 28, 2018
6d75091
forward events to different endpoints
eli-darkly Dec 19, 2018
8587627
misc fixes + tests
eli-darkly Dec 19, 2018
e3accec
linter
eli-darkly Dec 19, 2018
9b835d8
misc fixes
eli-darkly Dec 19, 2018
d1229a3
rm unused function
eli-darkly Dec 19, 2018
22623e7
disallow incompatible options, fix shell script, clarify docs
eli-darkly Dec 19, 2018
25eedda
Merge pull request #81 from launchdarkly/eb/ch28566-ch28567/config-sc…
eli-darkly Dec 20, 2018
3c6ac08
Merge branch 'v5' into eb/ch28051/event-endpoints
eli-darkly Dec 20, 2018
b7ebe62
comment
eli-darkly Dec 20, 2018
1e0ee47
Merge pull request #80 from launchdarkly/eb/ch28051/event-endpoints
eli-darkly Dec 20, 2018
6bc03d8
merge from public after release
LaunchDarklyCI Dec 20, 2018
1cbb88b
document REDIS_URL variable
eli-darkly Apr 5, 2019
3ef1fad
Merge pull request #82 from launchdarkly/eb/ch35868/readme-redis-url
eli-darkly Apr 5, 2019
6c9f674
Replace go-client usage with go-server-sdk and fix some build breakag…
bwoskow-ld May 13, 2019
91665b9
Merge branch 'v5' of github.com:launchdarkly/ld-relay-private into v5
bwoskow-ld May 15, 2019
8867de1
merge from public after release
LaunchDarklyCI May 15, 2019
b3ac6ef
add readme examples about configuration
eli-darkly May 20, 2019
1b07179
Add proxy options and NTLM proxy auth support
eli-darkly May 21, 2019
3561024
fix missing configuration
eli-darkly May 21, 2019
3193ffe
fix config section name
eli-darkly May 21, 2019
7f326d6
update SDK mechanism for specifying HTTP adapter
eli-darkly May 22, 2019
3a63311
update for SDK changes
eli-darkly May 22, 2019
4135219
config param names, readme
eli-darkly May 22, 2019
8446d1f
simplify transport object logic
eli-darkly May 23, 2019
9e127aa
use forked NTLM package, simplify configuration, add logging
eli-darkly Jun 1, 2019
63f6e0a
copy unreleased fix for Go SDK to log stream connection errors
eli-darkly Jun 26, 2019
d2682db
copy fork of go-ntlm-proxy-auth with HTTPS proxy URL support
eli-darkly Jul 2, 2019
8f0731e
add ability to specify CA certs; remove InsecureSkipVerify parameter
eli-darkly Jul 10, 2019
56e54a1
include pre-existing CAs
eli-darkly Jul 10, 2019
641be61
update dependencies
eli-darkly Jul 10, 2019
b13e1d2
linter
eli-darkly Jul 10, 2019
63a0254
linter
eli-darkly Jul 10, 2019
ca7dbbd
Merge branch 'eb/ch37474/ntlm-proxy' into eb/ch37474/ca-cert
eli-darkly Jul 10, 2019
8b3ac51
upgrade linter, disable some rules
eli-darkly Jul 10, 2019
e47f487
fix linter version
eli-darkly Jul 10, 2019
08bd141
more compatible linter version
eli-darkly Jul 10, 2019
3218dec
try build before lint
eli-darkly Jul 10, 2019
a8045d9
update eventsource
eli-darkly Jul 10, 2019
f502158
Revert "try build before lint"
eli-darkly Jul 10, 2019
7493db1
run lint after tests
eli-darkly Jul 10, 2019
6a61486
CI diagnostics
eli-darkly Jul 10, 2019
df9b9e5
Merge branch 'v5' of github.com:launchdarkly/ld-relay into v5
bwoskow-ld Jul 18, 2019
11d0229
update to use SDK for NTLM stuff
eli-darkly Jul 18, 2019
08037e7
Merge pull request #86 from launchdarkly/eb/config-docs
eli-darkly Jul 18, 2019
29b9e0f
server only client-side flags from client-side endpoints
eli-darkly Jul 19, 2019
6ce4f64
restore original label for these routes
eli-darkly Jul 19, 2019
fd97458
rm unused
eli-darkly Jul 19, 2019
b3f1fbe
update eventsource
eli-darkly Jul 19, 2019
42ab39d
Merge pull request #85 from launchdarkly/eb/ch37474/ca-cert
eli-darkly Jul 19, 2019
28b5358
Merge branch 'v5' of github.com:launchdarkly/ld-relay into v5
bwoskow-ld Jul 19, 2019
5d072f1
Merge branch 'v5' of github.com:launchdarkly/ld-relay-private into v5
bwoskow-ld Jul 19, 2019
8474771
better test data generation
eli-darkly Jul 22, 2019
3ba4d60
Merge pull request #87 from launchdarkly/eb/ch43586/client-side-flags
eli-darkly Jul 22, 2019
767bf07
Add TLS listener option
Jul 21, 2019
cec28d8
Run server as go func, change var name
Jul 21, 2019
968c4dd
Update README with new TLS instructions
Jul 21, 2019
b687220
Fix tests
Jul 21, 2019
da6f0b0
camel case error message
Jul 21, 2019
d66f8c5
Add Environment variables for docker-entrypoint
Jul 22, 2019
52804db
move logging to separate line
Jul 22, 2019
55fb083
Merge branch 'v5' into eb/ch37474/ntlm-proxy
eli-darkly Jul 23, 2019
2755b24
disable linter in CI build + Makefile improvements
eli-darkly Jul 23, 2019
e65b603
Merge pull request #89 from launchdarkly/eb/ch44169/linter
eli-darkly Jul 23, 2019
9e6c56b
Merge branch 'v5' into eb/ch37474/ntlm-proxy
eli-darkly Jul 23, 2019
5f80cf9
use Go SDK 4.9.0
eli-darkly Jul 23, 2019
e5c10a8
Merge pull request #84 from launchdarkly/eb/ch37474/ntlm-proxy
eli-darkly Jul 23, 2019
d0283a8
Requested changes for PR
Jul 24, 2019
7354546
Fix Checks and clean up logging
Jul 24, 2019
aecb8e1
Change select to for single channel
Jul 24, 2019
187f596
minor typo
Jul 24, 2019
b4c35da
Add Environment variables to README
Jul 24, 2019
aa66314
Always exit on http listener error
Jul 25, 2019
1923b3c
break out config structs into their own file and simplify how default…
eli-darkly Jul 25, 2019
efc6c58
don't hard-code events URI
eli-darkly Jul 25, 2019
cd81333
misc fixes
eli-darkly Jul 25, 2019
9d56259
Simpler logic on startup
Jul 25, 2019
ba5de6a
Merge pull request #88 from launchdarkly/relay-tls
eli-darkly Jul 26, 2019
38ef021
Merge branch 'v5' into eb/ch44013/default-uris
eli-darkly Jul 26, 2019
7df9002
fix test of config file generation
eli-darkly Jul 26, 2019
cd88014
rm unnecessary braces
eli-darkly Jul 27, 2019
5564b68
don't need to set default URIs in sample config
eli-darkly Jul 27, 2019
a4682fe
Merge pull request #90 from launchdarkly/eb/ch44013/default-uris
eli-darkly Jul 27, 2019
490a220
allow relay to be configured with environment vars and no file (#91)
eli-darkly Aug 2, 2019
032f2e5
add Redis password & TLS options
eli-darkly Aug 3, 2019
91d9d57
Merge pull request #93 from launchdarkly/eb/ch44576/redis-password
eli-darkly Aug 3, 2019
60859d4
merge from public after release
LaunchDarklyCI Aug 3, 2019
48d27f6
update opencensus packages
mightyguava Aug 5, 2019
d72cbbf
fix dependency versions
mightyguava Aug 5, 2019
089483f
change Redis config logic so TLS option is always respected
eli-darkly Aug 5, 2019
4edcb96
rm debugging
eli-darkly Aug 5, 2019
950db97
update readme
eli-darkly Aug 5, 2019
ce2f010
revert accidental delete
eli-darkly Aug 5, 2019
5603f0d
Merge pull request #94 from launchdarkly/eb/ch45497/tls-option
eli-darkly Aug 5, 2019
d85b833
merge from public after release
LaunchDarklyCI Aug 6, 2019
b709911
Merge branch 'v5' of github.com:launchdarkly/ld-relay into v5
eli-darkly Aug 28, 2019
e20b03c
Upgraded alpine image in Dockerfile
e96wic Sep 16, 2019
4565ed7
add debug logging of HTTP requests, make log levels configurable, upd…
eli-darkly Sep 17, 2019
ba1c448
add missing files
eli-darkly Sep 17, 2019
18ab43b
add more debug logging, rework config to allow setting per-env log level
eli-darkly Sep 18, 2019
9feaff7
don't use richgo because it breaks the 1.8 build
eli-darkly Sep 18, 2019
0f6c690
pin goreleaser version
eli-darkly Sep 18, 2019
f22a043
set goreleaser version correctly
eli-darkly Sep 18, 2019
ae98983
use newer goreleaser config format
eli-darkly Sep 18, 2019
89cab6f
Merge branch 'eb/ch49539/go1.8-build' into eb/ch28687/debug-logging
eli-darkly Sep 18, 2019
6ee316d
fix tests
eli-darkly Sep 18, 2019
ee03ec8
implement one-shot mode (exit always)
eli-darkly Sep 18, 2019
948ebcb
add PHP endpoints and reorganize handler code
eli-darkly Sep 18, 2019
c53aa4b
add Etags for PHP endpoints
eli-darkly Sep 18, 2019
e72bc41
Merge pull request #95 from launchdarkly/eb/ch49539/go1.8-build
eli-darkly Sep 18, 2019
438a652
Merge pull request #96 from launchdarkly/eb/ch28687/debug-logging
eli-darkly Sep 18, 2019
3a2f477
Merge branch 'v5' into eb/ch49814/one-shot
eli-darkly Sep 18, 2019
b926943
Merge pull request #97 from launchdarkly/eb/ch49814/one-shot
eli-darkly Sep 18, 2019
3c8275c
Merge branch 'v5' into eb/ch45210/php-endpoints
eli-darkly Sep 18, 2019
3e1ea1f
use hash of flag keys+versions as all flags etag; add etag prefix
eli-darkly Sep 18, 2019
8348559
better tests for etag behavior
eli-darkly Sep 18, 2019
552e709
Merge pull request #98 from launchdarkly/eb/ch45210/php-endpoints
eli-darkly Sep 18, 2019
7cad3f4
add TTL property
eli-darkly Sep 18, 2019
27e429b
set Expires instead of Cache-Control
eli-darkly Sep 18, 2019
9688cc7
Merge pull request #99 from launchdarkly/eb/ch45210/php-ttl
eli-darkly Sep 18, 2019
f8b7aa0
Merge pull request #74 from e96wic/dependency-upgrade
eli-darkly Sep 19, 2019
419bd45
Merge branch 'contrib' of github.com:launchdarkly/ld-relay into v5
eli-darkly Sep 19, 2019
39b78e8
typo
eli-darkly Sep 19, 2019
4c28596
merge from public after release
LaunchDarklyCI Sep 19, 2019
ee8c73c
update SDK, update readme regarding infinite cache & DB recovery beha…
eli-darkly Oct 10, 2019
14864e0
add experiment/trackReason logic for client-side eval (#101)
eli-darkly Oct 11, 2019
d71bed2
merge from public after release
LaunchDarklyCI Oct 11, 2019
ec054ce
Merge branch 'v5' of github.com:launchdarkly/ld-relay into v5
eli-darkly Nov 1, 2019
85d4395
Merge branch 'v5' of github.com:launchdarkly/ld-relay into contrib
eli-darkly Nov 1, 2019
8aa8822
bump to alpine 3.10.2 (#102)
bwoskow-ld Nov 5, 2019
3231db8
merge from public after release
LaunchDarklyCI Nov 5, 2019
592fd0d
Merge pull request #70 from mightyguava/v5
eli-darkly Nov 6, 2019
e9d7454
Merge branch 'contrib' of github.com:launchdarkly/ld-relay into v5
eli-darkly Nov 6, 2019
e95f54b
update to Go SDK 4.13.1 for database caching improvements
eli-darkly Nov 7, 2019
63b30b5
Merge branch 'v5' of github.com:launchdarkly/ld-relay into v5
bwoskow-ld Nov 7, 2019
dc799a1
Merge branch 'v5' of github.com:launchdarkly/ld-relay-private into v5
bwoskow-ld Nov 7, 2019
0b799ed
Merge pull request #103 from launchdarkly/eb/ch54562/sdk-update-caching
eli-darkly Nov 7, 2019
c5bef82
merge from public after release
LaunchDarklyCI Nov 7, 2019
1bfee7a
make DynamoDB endpoint URL configurable
eli-darkly Dec 10, 2019
97da3df
Merge pull request #104 from launchdarkly/eb/ch58399/dynamodb-url
eli-darkly Dec 11, 2019
50d9974
retroactively add missing changelog item for 5.8.2
eli-darkly Dec 20, 2019
9387c9d
vendor in latest prometheus/client_golang (#105)
Dec 20, 2019
0e20481
add CI test for Prometheus exporter (#106)
eli-darkly Dec 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ defaults:
go tool cover -html=$CIRCLE_ARTIFACTS/coverage.txt -o $CIRCLE_ARTIFACTS/coverage.html
fi
when: always
- run:
name: Run Prometheus endpoint test
command: ./scripts/test-prometheus-endpoint.sh
- run:
name: lint
command: |
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
All notable changes to the LaunchDarkly Relay will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).

## [5.8.2] - 2019-11-07
### Changed:
- Updated to a newer version of the OpenCensus Prometheus exporter. (Thanks, [mightyguava](https://github.com/launchdarkly/ld-relay/pull/70!))
### Fixed:
- When using a persistent feature store (Redis, etc.), if multiple clients request flags at the same time when the flag data is not in the cache, Relay will coalesce these requests so only a single database query is done.


## [5.8.1] - 2019-11-05
### Fixed:
- The `README` incorrectly referred to an environment variable as `DYNAMODB_ENABLED` when it is really `USE_DYNAMODB`. (Thanks, [estraph](https://github.com/launchdarkly/ld-relay/pull/79)!)
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,11 @@ Property in file | Environment var | Type | Default | Description
------------------- | ------------------ | :-----: | :------ | -----------
`enabled` | `USE_DYNAMODB` | Boolean | `false` | Enables DynamoDB.
`tableName` | `DYNAMODB_TABLE` | String | | The DynamoDB table name, if you are using the same table for all environments. Otherwise, omit this and specify it in each environment section. (Note, credentials and region are controlled by the usual AWS environment variables and/or local AWS configuration files.)
`url` | `DYNAMODB_URL` | String | | The service endpoint if you are using a local DynamoDB instance instead of the regular service.
`localTtl` | `CACHE_TTL` | Number | `30000` | Length of time (in milliseconds) that database items can be cached in memory.

The AWS credentials and region for DynamoDB are not part of the Relay configuration; they should be set using either the standard AWS environment variables or a local AWS configuration file, as documented for [the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html).

### File section: `[Consul]`

Property in file | Environment var | Type | Default | Description
Expand Down Expand Up @@ -211,8 +214,8 @@ Property in file | Environment var | Type | Default | Description
Property in file | Environment var | Type | Default | Description
---------------- | ------------------- | :-----: | :------ | -----------
`enabled` | `USE_PROMETHEUS` | Boolean | `false` | If true, enables exporting traces to Prometheus.
`port` | `PROMETHEUS_PORT` | Number | `8031` | The port that the Relay Proxy will listen to `/metrics` on.
`prefix` | `PROMETHEUS_PREFIX` | String | | The metrics prefix to be used by Prometheus.
`port` | `PROMETHEUS_PORT` | Number | `8031` | The port that the Relay Proxy will provide the `/metrics` endpoint on.
`prefix` | `PROMETHEUS_PREFIX` | String | | The metrics prefix to be used by Prometheus.

### File section: `[Proxy]`

Expand Down
4 changes: 3 additions & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ type ConsulConfig struct {
type DynamoDBConfig struct {
Enabled bool
TableName string
Url string
LocalTtl int
}

Expand Down Expand Up @@ -227,7 +228,7 @@ var DefaultConfig = Config{
BaseUri: defaultBaseURI,
StreamUri: defaultStreamURI,
HeartbeatIntervalSecs: defaultHeartbeatIntervalSecs,
Port: defaultPort,
Port: defaultPort,
},
Events: events.Config{
Capacity: defaultEventCapacity,
Expand Down Expand Up @@ -402,6 +403,7 @@ func LoadConfigFromEnvironment(c *Config) error {
maybeSetFromEnvBool(&c.DynamoDB.Enabled, "USE_DYNAMODB")
if c.DynamoDB.Enabled {
maybeSetFromEnv(&c.DynamoDB.TableName, "DYNAMODB_TABLE")
maybeSetFromEnv(&c.DynamoDB.Url, "DYNAMODB_URL")
maybeSetFromEnvInt(&c.DynamoDB.LocalTtl, "CACHE_TTL", &errs)
}

Expand Down
2 changes: 2 additions & 0 deletions config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,14 @@ func TestConfigFromEnvironmentWithDynamoDB(t *testing.T) {
c.DynamoDB = DynamoDBConfig{
Enabled: true,
TableName: "table",
Url: "http://localhost:8000",
LocalTtl: 3000,
}
},
map[string]string{
"USE_DYNAMODB": "1",
"DYNAMODB_TABLE": "table",
"DYNAMODB_URL": "http://localhost:8000",
"CACHE_TTL": "3000",
},
)
Expand Down
6 changes: 5 additions & 1 deletion internal/metrics/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ func registerPrometheusExporter(options ExporterOptions) error {
port = o.Port
}

exporter, err := prometheus.NewExporter(prometheus.Options{Namespace: o.Prefix})
logPrometheusError := func(e error) {
logging.Error.Printf("Prometheus exporter error: %s", e)
}

exporter, err := prometheus.NewExporter(prometheus.Options{Namespace: o.Prefix, OnError: logPrometheusError})
if err != nil {
return err
}
Expand Down
18 changes: 16 additions & 2 deletions relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
"sync"
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
redigo "github.com/garyburd/redigo/redis"
"github.com/gorilla/mux"
"github.com/gregjones/httpcache"
Expand Down Expand Up @@ -538,8 +540,20 @@ func createFeatureStore(c Config, envConfig *EnvConfig) (ld.FeatureStoreFactory,
return nil, errors.New("TableName property must be specified for DynamoDB, either globally or per environment")
}
logging.Info.Printf("Using DynamoDB feature store: %s with prefix: %s", tableName, envConfig.Prefix)
return lddynamodb.NewDynamoDBFeatureStoreFactory(tableName, lddynamodb.Prefix(envConfig.Prefix),
lddynamodb.CacheTTL(time.Duration(c.DynamoDB.LocalTtl)*time.Millisecond), lddynamodb.Logger(logging.Info))
options := []lddynamodb.FeatureStoreOption{
lddynamodb.Prefix(envConfig.Prefix),
lddynamodb.CacheTTL(time.Duration(c.DynamoDB.LocalTtl) * time.Millisecond),
lddynamodb.Logger(logging.Info),
}
if c.DynamoDB.Url != "" {
awsOptions := session.Options{
Config: aws.Config{
Endpoint: aws.String(c.DynamoDB.Url),
},
}
options = append(options, lddynamodb.SessionOptions(awsOptions))
}
return lddynamodb.NewDynamoDBFeatureStoreFactory(tableName, options...)
}
return ld.NewInMemoryFeatureStoreFactory(), nil
}
105 changes: 105 additions & 0 deletions scripts/test-prometheus-endpoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# !/bin/bash

# This script performs a smoke test for Relay data export to Prometheus. It does not run Prometheus,
# but starts Relay with Prometheus export enabled and then verifies that a metric is available from
# Relay's /metrics endpoint.

set -e

FAKE_LD_PORT=8100
RELAY_PORT=8101
RELAY_METRICS_PORT=8102

# Start a fake LaunchDarkly service endpoint that simply returns a single empty stream put event -
# that's enough to ensure that the SDK client can initialize. The nc command will close the socket
# after responding, so the SDK will go into "reconnecting" mode, but that shouldn't affect our test.
TEMP_FILE_STREAM_DATA=$(mktemp)
cat >${TEMP_FILE_STREAM_DATA} <<EOF
HTTP/1.1 200 OK
Content-Type: text/event-stream

event: put
data: {"data":{}}


EOF

if [ "$OSTYPE" == "linux-gnu" ]; then
nc -l -p ${FAKE_LD_PORT} <"${TEMP_FILE_STREAM_DATA}" >/dev/null &
else
nc -l ${FAKE_LD_PORT} <"${TEMP_FILE_STREAM_DATA}" >/dev/null &
fi

go build ./cmd/ld-relay

# start Relay as a background process
echo "starting Relay"
PORT=${RELAY_PORT} \
STREAM_URI=http://localhost:${FAKE_LD_PORT} \
LD_LOG_LEVEL="debug" \
LD_LOG_LEVEL_test="none" \
LD_ENV_test="fake-sdk-key" \
LD_CLIENT_SIDE_ID_test="fake-env-id" \
USE_PROMETHEUS=1 \
PROMETHEUS_PORT=${RELAY_METRICS_PORT} \
./ld-relay --from-env &
RELAY_PID=$!
trap "kill ${RELAY_PID}" exit

# wait for relay to start
echo
echo "waiting for Relay /status endpoint"
fail_count=0
max_attempts=10
while true; do
curl --silent --show-error --fail http://localhost:${RELAY_PORT}/status >/dev/null && break
let "fail_count += 1"
if [[ ${fail_count} -gt ${max_attempts} ]]; then
echo "Relay did not start after ${max_attempts} seconds; failing"
exit 1
fi
echo "...Relay not ready, retrying"
sleep 1
done
echo "Relay started"

# make an SDK endpoint request, causing request metric to be incremented (we don't care about the output)
echo
echo "querying Relay SDK endpoint to generate a metric"
fail_count=0
max_attempts=10
while true; do
curl --fail --silent -X REPORT -H 'content-type:application/json' --data '{"key":"test-user"}' \
http://localhost:${RELAY_PORT}/sdk/evalx/fake-env-id/user >/dev/null && break
let "fail_count += 1"
if [[ ${fail_count} -gt ${max_attempts} ]]; then
echo "SDK client did not start after ${max_attempts} seconds; failing"
exit 1
fi
echo "...client not ready, retrying"
sleep 1
done
echo "OK"

# hit the Prometheus exporter endpoint - allow a couple of retries since there can be a lag for the data
echo
echo "querying Relay /metrics endpoint"
TEMP_FILE_METRICS=$(mktemp)
fail_count=0
max_attempts=10
while true; do
curl --fail --silent http://localhost:${RELAY_METRICS_PORT}/metrics >${TEMP_FILE_METRICS} # endpoint should return 200 even if there's no data
grep 'env="test",method="REPORT",platformCategory="browser",route="_sdk_evalx_{envId}_user"' <${TEMP_FILE_METRICS} && break
let "fail_count += 1"
if [[ $fail_count -gt ${max_attempts} ]]; then
echo "metrics did not show up after ${max_attempts} seconds; failing"
echo
echo "last output from metrics endpoint was:"
cat "${TEMP_FILE_METRICS}"
exit 1
fi
echo "...got no data, retrying"
sleep 1
done
echo "got metrics data from endpoint:"
cat "${TEMP_FILE_METRICS}"
18 changes: 0 additions & 18 deletions vendor/github.com/prometheus/client_golang/AUTHORS.md

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 59 additions & 14 deletions vendor/github.com/prometheus/client_golang/prometheus/collector.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading