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

Adding static config resource detector for tracing #34944

Merged

Conversation

juanmolle
Copy link
Contributor

Implementation for new trace resource detector.
This new Detector allows to use static config for resource attributes.

Risk Level: low
Testing: yes
Docs Changes: yes
Release Notes: yes
Platform Specific Features: No

Signed-off-by: Juan Manuel Ollé <jolle@mulesoft.com>
Copy link

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @wbpcode
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #34944 was opened by juanmolle.

see: more, trace.

Signed-off-by: Juan Manuel Ollé <jolle@mulesoft.com>
Signed-off-by: Juan Manuel Ollé <jolle@mulesoft.com>
Signed-off-by: Juan Manuel Ollé <jolle@mulesoft.com>
Signed-off-by: Juan Manuel Ollé <jolle@mulesoft.com>
Copy link
Member

@wbpcode wbpcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution. And some comments are added to the implementation.

/lgtm api

Comment on lines 27 to 29
private:
const envoy::extensions::tracers::opentelemetry::resource_detectors::v3::
StaticConfigResourceDetectorConfig config_;
Copy link
Member

@wbpcode wbpcode Jul 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than storing the whole proto config here, I think you could just to store the attributes by a flat_hash_map

Comment on lines 38 to 39
typed_config:
"@type": type.googleapis.com/envoy.extensions.tracers.opentelemetry.resource_detectors.v3.StaticConfigResourceDetectorConfig
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The integration test is a little weird. I think at least we should add a case where valid attributes are work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I just take a look what the other 2 detectors were doing. But I agree the use case you mention is better

@repokitteh-read-only repokitteh-read-only bot removed the api label Jul 1, 2024
@wbpcode
Copy link
Member

wbpcode commented Jul 1, 2024

cc @AlexanderEllis

@wbpcode wbpcode added the waiting label Jul 1, 2024
Signed-off-by: Juan Manuel Ollé <jolle@mulesoft.com>
Signed-off-by: Juan Manuel Ollé <jolle@mulesoft.com>
@juanmolle
Copy link
Contributor Author

/retest

Comment on lines 23 to 25
for (const auto& pair : attributes_) {
const std::string& key = pair.first;
const std::string& value = pair.second;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for(const auto& [key, value] : attributes_) would be simpler.

Copy link
Member

@wbpcode wbpcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only two comments to the implementation and test. Others are fine. Thanks for the update. :)

],
extension_names = ["envoy.tracers.opentelemetry.resource_detectors.static_config"],
deps = [
"//source/exe:main_common_lib",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a good practice to depend the whole main. You should figure out what lib is actually be depended and list the actually dependency here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, sorry, I have copied it and it is not needed this lib at all.

Signed-off-by: Juan Manuel Ollé <jolle@mulesoft.com>
@juanmolle juanmolle requested a review from wbpcode July 3, 2024 12:05
@nezdolik
Copy link
Member

nezdolik commented Jul 8, 2024

@wbpcode friendly ping

@KBaichoo
Copy link
Contributor

Ping @wbpcode

PTAL

wbpcode
wbpcode previously approved these changes Jul 16, 2024
Copy link
Member

@wbpcode wbpcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall. Only one comment to the comment. And please merge the main. Thanks. 🌹

EXPECT_TRUE(resource.attributes_.empty());
}

// Test detector with valid values in attributes config
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: invalid

@wbpcode
Copy link
Member

wbpcode commented Jul 16, 2024

/wait

Signed-off-by: Juan Manuel Ollé <jolle@mulesoft.com>
@juanmolle juanmolle requested a review from wbpcode July 16, 2024 16:05
@wbpcode
Copy link
Member

wbpcode commented Jul 17, 2024

cc @juanmolle Hi, please merge main then we can try to merge it. :)

Signed-off-by: Juan Manuel Ollé <jolle@mulesoft.com>
@juanmolle
Copy link
Contributor Author

My apologies, I didn't understand your comment.

@wbpcode wbpcode merged commit f79b881 into envoyproxy:main Jul 17, 2024
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants