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

SdkBundle: Refactor Configuration #57

Closed
wants to merge 15 commits into from
Closed

Conversation

tidal
Copy link
Member

@tidal tidal commented Apr 2, 2022

closes: open-telemetry/opentelemetry-php#652

  • Separates config validation/normalization for Resource and Trace
  • Abstract away config Validators, Normalizers and Callbacks
  • Adds 100% code coverage for config validation/normalization
  • Refactors some misc tests

@@ -22,17 +24,17 @@ class ExporterDsnParserTest extends TestCase
'password' => 'secret',
];

public function testParseFullDsn()
public function testParseFullDsn(): void
Copy link
Collaborator

Choose a reason for hiding this comment

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

are we missing a cs-fixer rule to enforce snake_case ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, this has never been done in the contrib repo.

Copy link
Collaborator

@brettmc brettmc left a comment

Choose a reason for hiding this comment

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

lgtm - a couple of questions and suggestions that can be actioned or ignored.
We might need some psalm ignores too, it's not happy.

@tidal
Copy link
Member Author

tidal commented Apr 5, 2022

lgtm - a couple of questions and suggestions that can be actioned or ignored.
We might need some psalm ignores too, it's not happy.

I'm working on this. But it will be a bit more than ignores.
The static analysis is really struggling wit this (because the return types dpend on conditions it's not following) , that's why I aready created a lot of those helper methods.
However I want to improve them, as they not really help redability atm.

if (!$returnType instanceof ReflectionNamedType || $returnType->getName() !== self::TYPE_BOOL) {
throw new InvalidArgumentException(
sprintf(
'All provided closures must have boolean return type. Give: "%s"',
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a typo: "Give" -> "Given"

});
}

public static function createExceptionTrigger(array $requiredAttributes): Closure
Copy link
Member Author

Choose a reason for hiding this comment

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

These two still need to be separated into dedicated Closure factories with a simple create methods as in the other one.

@stale
Copy link

stale bot commented Jun 4, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 4, 2022
@stale
Copy link

stale bot commented Jun 11, 2022

This issue has been automatically closed because it has not had recent activity, but it can be reopened. Thank you for your contributions.

@stale stale bot closed this Jun 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[opentelemetry-php-contrib] SdkBundle: Refactor Configuration.php
2 participants