Skip to content
This repository has been archived by the owner on Jun 14, 2023. It is now read-only.

feat: add mongo plugin #53

Merged
merged 1 commit into from
Nov 16, 2022
Merged

feat: add mongo plugin #53

merged 1 commit into from
Nov 16, 2022

Conversation

elza2
Copy link
Contributor

@elza2 elza2 commented Nov 14, 2022

feat: add mongo plugin

@elza2 elza2 changed the title feat: add mongo plugin (#51) feat: add mongo plugin Nov 14, 2022
@wu-sheng wu-sheng added this to the 1.6.0 milestone Nov 14, 2022
@wu-sheng wu-sheng requested a review from arugal November 14, 2022 11:29
@wu-sheng wu-sheng added the enhancement New feature or request label Nov 14, 2022
@wu-sheng
Copy link
Member

Please update docs for this new plugin.

@elza2
Copy link
Contributor Author

elza2 commented Nov 14, 2022

Please update docs for this new plugin.
ok

@wu-sheng
Copy link
Member

You also should add a link for your plugin in the root readme doc, https://github.com/SkyAPM/go2sky-plugins#trace-plugins

@elza2
Copy link
Contributor Author

elza2 commented Nov 15, 2022

ok

README.md Outdated Show resolved Hide resolved
mongo/mongo.go Outdated
span.SetComponent(ComponentMongo)
span.SetSpanLayer(agentv3.SpanLayer_Database)
span.Tag(go2sky.TagDBType, ComponentMongoDB)
// span.Tag(go2sky.TagDBStatement, evt.Command.String())
Copy link
Member

Choose a reason for hiding this comment

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

What happens for this statement tag?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some message executing the statement will be printed, but it will contain some indeterminate data.

eg.
{"create": "users","lsid": {"id": {"$binary":{"base64":"vtes1313Q1OnEMNazIsA1g==","subType":"04"}}},"$clusterTime": {"clusterTime": {"$timestamp":{"t":"1668405576","i":"1"}},"signature": {"hash": {"$binary":{"base64":"yFFWPXo66l1X7B91uKwSuZ3CMA8=","subType":"00"}},"keyId": {"$numberLong":"7122666363734196228"}}},"$db": “database"}

Copy link
Member

Choose a reason for hiding this comment

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

Yes, tracing is for the internal messages. Could you add some configurations to disable or enable this in the tag?

Copy link
Member

Choose a reason for hiding this comment

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

@elza2 elza2 force-pushed the mongo-plugin branch 2 times, most recently from 665fd9f to 0ab7af0 Compare November 15, 2022 06:54
mongo/mongo.go Outdated
ComponentMongoDB string = "MongoDB"

// Peer peer.
Peer string = "mongo:27017"
Copy link
Member

Choose a reason for hiding this comment

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

Why is peer a static?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Under repair

mongo/mongo.go Outdated
Comment on lines 46 to 47
span, _, err := tracer.CreateLocalSpan(ctx,
go2sky.WithSpanType(go2sky.SpanTypeEntry),
Copy link
Member

Choose a reason for hiding this comment

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

What does local span mean? Especially with span type entry?
Isn't this an exit span?

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. It should be exit span.

span.SetPeer(Peer)
span.SetComponent(ComponentMongo)
span.SetSpanLayer(agentv3.SpanLayer_Database)
span.Tag(go2sky.TagDBType, ComponentMongoDB)
Copy link
Member

Choose a reason for hiding this comment

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

You removed command tag?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

command tag is unpredictable. If necessary, can use Option to customize.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I think an option is good.

Copy link
Member

Choose a reason for hiding this comment

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

Should we wait for this new option?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you mean? Do you want the implementation of Option to be part of the plugin?

Copy link
Member

Choose a reason for hiding this comment

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

I don't have a preference. SkyWalking community just recommends the command tag.
So, I want to check with you, do you plan to add it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, add command tag.

@elza2 elza2 force-pushed the mongo-plugin branch 2 times, most recently from d1e9a46 to 72cbd83 Compare November 15, 2022 08:24
@wu-sheng
Copy link
Member

Could you share what these tags look like? A screenshot or some logs.

@elza2
Copy link
Contributor Author

elza2 commented Nov 15, 2022

截屏2022-11-15 19 52 51
截屏2022-11-15 19 53 21

@wu-sheng
Copy link
Member

wu-sheng commented Nov 15, 2022

Thanks. So, this command is always in the tag, with no option to set.

@elza2
Copy link
Contributor Author

elza2 commented Nov 16, 2022

Yes.

Copy link
Member

@wu-sheng wu-sheng left a comment

Choose a reason for hiding this comment

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

lgtm, @arugal ptal

Copy link
Member

@arugal arugal left a comment

Choose a reason for hiding this comment

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

LGTM

@arugal arugal merged commit 0e97754 into SkyAPM:master Nov 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
3 participants