Skip to content

Add MemcacheIntegration - #1981

Merged
bwoebi merged 3 commits into
masterfrom
bob/add-memcache
Mar 20, 2023
Merged

Add MemcacheIntegration#1981
bwoebi merged 3 commits into
masterfrom
bob/add-memcache

Conversation

@bwoebi

@bwoebi bwoebi commented Mar 20, 2023

Copy link
Copy Markdown
Collaborator

Description

This adds an integration for Memcache, analogous to the Memcached integration we have.

Readiness checklist

  • (only for Members) Changelog has been added to the release document.
  • Tests added for this feature/bug.

Reviewer checklist

  • Appropriate labels assigned.
  • Milestone is set.
  • Changelog has been added to the release document. For community contributors the reviewer is in charge of this task.

@bwoebi bwoebi added this to the 0.86.0 milestone Mar 20, 2023
@bwoebi
bwoebi requested a review from a team as a code owner March 20, 2023 11:42
Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
@bwoebi
bwoebi force-pushed the bob/add-memcache branch from 769361e to 760dcbf Compare March 20, 2023 12:19

@pierotibou pierotibou left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

With one question mainly around type

Comment thread ext/integrations/integrations.h Outdated
bool (*is_analytics_enabled)(void);
double (*get_sample_rate)(void);
void *aux[5];
void *aux[7];

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🪄

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Guess I could leave a comment :-D

use DDTrace\Integrations\Guzzle\GuzzleIntegration;
use DDTrace\Integrations\Laravel\LaravelIntegration;
use DDTrace\Integrations\Lumen\LumenIntegration;
use DDTrace\Integrations\Memcached\MemcachedIntegration;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why do we replace the old one? Shouldn't we just add the new one?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I see, the refactoring functionality of PHPStorm replaced too many things. Well spotted. (And no, the new one should not be added, that's for PHP 5.)


public function init()
{
if (!extension_loaded('memcache')) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nitpicking

Suggested change
if (!extension_loaded('memcache')) {
if (!extension_loaded($NAME)) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

which $NAME? That's the literal name of the extension.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You define a const NAME at the top, can't it be used here ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Because that's the name of the integration, not the name of the extension. (Also syntax is self::NAME)

public function setCommonData(SpanData $span, $command)
{
$span->name = "Memcache.$command";
$span->type = Type::MEMCACHE;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should we really have a different type for memcache and memcached? We have 2 integrations for Redis in .NET that we both give a Redis type, same for GraphQL.
So I think we should stick with memcached

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I don't know. For db.system I have twice memcached. I can change it for type too if you want to.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

So no spec but we should use memcached, as it is what the agent expects (even though useless in that case). Cf https://cs.github.com/DataDog/datadog-agent/blob/9110db10f209e52ae630b9173aef8d54b770116b/pkg/trace/agent/obfuscate.go?q=ObfuscateMemcachedString#L71

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Okay, will change.


/**
* Add the servers to the span metadata.
*

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🙇

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

What does that emoji mean?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you for the comments

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Oh, I just copied that comment from the MemcachedIntegration.

@bwoebi
bwoebi merged commit 70b461a into master Mar 20, 2023
@bwoebi
bwoebi deleted the bob/add-memcache branch March 20, 2023 21:50
@Anilm3 Anilm3 mentioned this pull request Mar 22, 2023
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.

2 participants