-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[extension][ecsobserver] Init ECS service discovery using docker label #2734
Conversation
|
This is the first (divided) implementation PR for #1395. In order to reduce the size of the pr, the feature is incomplete. - mock api client is used, no actual aws api calls - Only docker label based filter/matcher is included - Extension impl under `ecsobserver` is excluded Those excluded logic are tested in other branches, so it works with real API end to end (eventually). The package is located under internal/aws/ecssd because - it can be used by other aws specific packages - we may extract it out to a standalone repo in the future as it can run as a binary and support other prometheus compatiable collectors as a sidecar
cf211b3
to
b70159f
Compare
I guess the bot should have assigned it to @jrcamp The lint error is strange
|
Codecov Report
@@ Coverage Diff @@
## main #2734 +/- ##
==========================================
+ Coverage 90.53% 91.42% +0.88%
==========================================
Files 444 457 +13
Lines 21984 22450 +466
==========================================
+ Hits 19904 20525 +621
+ Misses 1618 1434 -184
- Partials 462 491 +29
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
- ignore *.actual.yaml and only check in *.expected.yaml
@pingleig overall looks good. Can somebody at AWS review first? Quite a lot of code. |
@jrcamp thanks! I just asked in internal channel for review. There should be some follow up PRs, those should be smaller because most interface and large struct definitions are in this PR. |
internal/aws/ecssd/docker_label.go
Outdated
func (d *DockerLabelConfig) Init() error { | ||
// It's possible to support it in the future, but for now just fail at config, | ||
// so user don't need to wonder which port is used in the exported target. | ||
if len(d.MetricsPorts) != 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it is not supported now, can we remove CommonExporterConfig
it in DockerLabelConfig
? will it misleading customers by just looking Config
structure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to split the shared config because docker label is just one of three matchers, though its behaviour is pretty different from service and task based matcher so we could give it another struct like ExportConfigWithoutPorts
. I plan to delay the change for next pr when service & task are added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I think since we are going to have open-telemetry/opentelemetry-collector#2802 it's better to put the validate logic here instead of removing it from struct. Because if user use metrics_ports
for docker label and it's not in the struct, it will throw unmarshal error without telling why it is not there while it is supported for other filters. Though in the long term I think docker label should become part of common export config as well, you can discover based on service name and pick port based on docker label in task definition, we are just trying to be consistent with cloudwatch agent's behaviour here at this moment.
There is no plan to reuse it in other aws related components
Also fix go fmt problems ...
oops, windows test failed because of It seems when git checkout, the file |
The expected file is converted to \r\n during git checkout, however the generated file is still using \n. This only happens on circle ci's windows environemnt. See https://circleci.com/blog/circleci-config-teardown-how-we-write-our-circleci-config-at-circleci/#main:~:text=Line%20endings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM in general. pls address the comments. Thanks!
- Fix typo - Add more comment on how the matcher merge logic works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks!
@pingleig Can we find a way to split this up more? I just don't have the cycles to digest such a large PR all in one. |
@jrcamp it's doable, but in that case I don't think I can meet the requirement for test coverage because they will not work end to end (even in unit test). If that's ok I can create a new pr for just structs. |
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
Close it since half of the PR is split into #2939 and I plan create a new PR for the remaining stuff instead of rebasing on this branch. |
Split from open-telemetry#2734 - Get port number from label value - Check if the port number exists in container definition
Split from #2734 - Get port number from label value - Check if the port number exists in container definition
Description:
This is the first (divided) implementation PR for #1395. In order to reduce the size of the pr, the feature is incomplete.
ecsobserver
is excluded, it's a thin wrapper.Those excluded logic are tested in other branches, so it works with real API end to end (eventually).
The package is located under internal/aws/ecssd(relocated to extension because currently there is no other aws related component reusing it)Link to tracking Issue:
Testing:
unit test
Documentation:
No new doc, see #2377 for existing doc
Known issues
job
in service discovery output will cause scrape error, Prometheus Job and Instance labels opentelemetry-collector#575 so a new config is added and default toprometheus_job