GithubHelp home page GithubHelp logo

Constructor guards about php-datadogstatsd HOT 3 OPEN

datadog avatar datadog commented on May 30, 2024
Constructor guards

from php-datadogstatsd.

Comments (3)

gh123man avatar gh123man commented on May 30, 2024 1

Sounds reasonable to me.
Feel free to open a PR or if you feel like the contribution is non-trivial we can discuss the approach here.

from php-datadogstatsd.

Lewiscowles1986 avatar Lewiscowles1986 commented on May 30, 2024

Okay, so I have a candidate proposal that does not mess with the existing logic, but reorganizes it a bit, gets coverage of new code based upon that; I Hope it not too adventurous, and has some (separated commits) for other things that came up in solving this, but are entirely optional, and can be dropped.

https://github.com/Lewiscowles1986/php-datadogstatsd/tree/feature/injectable-transport

  • Proposed code changes (minimal, interface based)
  • Test fix (I was authoring on Windows, and it was a pain, I could not run tests. It's 2-liner)
  • GitHub actions (until I'd fixed, I actually had a really slow feedback loop)
  • Editor config and git attributes
  • Proposed Documentation (words are hard, forgive me if it's not perfect).
  • Update to support PHP 8.0 & 8.1 thanks to Yoast

Tests

  • PHP 5.6 - PHP 8.1
  • Linting, Code-Style

The actual guard portion of this, doesn't have to be owned by this repo. In the README.md I added a section with example to bypass the magic, re-using the Ipv4Udp transport that is part of this PR, so that an example of instrumenting the control I was looking for (bypassing the magic in current constructor) is available.

I'm not 💯 sure about the construct with single method interface, but felt that opening and closing the socket separately to the functionality; could make some future testing easier. I Also didn't want to open a long-lived socket (although the classes don't hint at that, the way they are used in one place enforces for-now).

The interfaces are pretty stripped-back to deal with PHP 5.6 minimum. Not sure where DataDog is going with that, but I think users would get a lot of benefit rolling up to only 7.4 & 8+ in a future release.

from php-datadogstatsd.

gh123man avatar gh123man commented on May 30, 2024

Thanks for the comprehensive work. For our record keeping, can you please update the PR description with everything you mentioned above?

Also thanks for including the fixes for php 8 + PHPUnit.

Ill leave the rest of my feedback in the PR itself.

from php-datadogstatsd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.