Skip to content

pkg/trace/{api,agent,pb}: introduce new client payload formats: TracerPayload & TraceChunk#9474

Closed
Barbayar wants to merge 5 commits intoDataDog:mainfrom
Barbayar:barbayar.dashzeveg/trace-payload-refactor
Closed

pkg/trace/{api,agent,pb}: introduce new client payload formats: TracerPayload & TraceChunk#9474
Barbayar wants to merge 5 commits intoDataDog:mainfrom
Barbayar:barbayar.dashzeveg/trace-payload-refactor

Conversation

@Barbayar
Copy link
Copy Markdown
Contributor

@Barbayar Barbayar commented Oct 12, 2021

What does this PR do?

1. Updates the trace payload from agent to backend

Before:

message TracePayload {
        string hostName = 1;
        string env = 2;
        repeated APITrace traces = 3;
        repeated Span transactions = 4;
}

After:

message TracePayload {
        string hostName = 1;
        string env = 2;
        repeated Span transactions = 4;
        repeated TracerPayload tracerPayloads = 5;
        map<string, string> tags = 6;
        string agentVersion = 7;
}

On backend, we would like to receive the payloads from the tracer as they are.
We also updated the payload from tracer to agent.

Before:

[][]*Span

After:

message TraceChunk {
	repeated Span spans = 1;
	map<string, string> tags = 2;
	int32 priority = 3;
	string origin = 4;
}

message TracerPayload {
	repeated TraceChunk chunks = 1;
	map<string, string> tags = 2;
	string service = 3;
	int64 traceCount = 4;
	string containerID = 5;
	string lang = 6;
	string langVersion = 7;
	string langInterpreter = 8;
	string langInterpreterVendor = 9;
	string tracerVersion = 10;
	bool computedTopLevel = 11;
	bool computedStats = 12;
	int32 sequence = 13;
	string runtimeID = 14;
}

2. Adds a new endpoint to receive the payload in new format from tracers

  • /v0.6/traces

3. [serverless] Sets global tags at agent payload level instead of each span

  • we can propagate the global tags on backend
  • it helps the customers to reduce their traffic to us

4. [container] Sets container tags at tracer payload level instead of each top level span

  • we can propagate container tags on backend
  • it helps the customers to reduce their traffic to us

5. Removes redundant data

  • Removes _dd.origin tag from each spans as it's set at trace chunk level
  • Removes _sampling_priority_v1 tag from each spans as it's set at trace chunk level

6. Removed Transactions from the payload from agent to backend

Spans in Transactions are a subset of spans in TracerPayloads. Instead of duplicating them in Transactions, we decided to keep them in TracerPayload, and just mark them with _dd.analyzed.

Motivation

We would like receive the following information from the tracer to enrich our features.

  • agent tags
  • tracer tags
  • trace tags

To do that, we need to receive two level of structured data from tracer instead of [][]*Span.

Additional Notes

This PR doesn't contain any logical change. But, there will be 2 more PRs after this one gets merged.

  • A new endpoint in trace-agent that receives structured payload from traces
  • A new trace payload format we are going to use in future intake

Describe how to test your changes

As this PR doesn't introduce a new feature,

  • making sure it didn't break anything
  • making sure the performance wasn't degraded

in the usual environment should enough for the test.

RFC

Checklist

  • A release note has been added or the changelog/no-changelog label has been applied.
  • The need-change/operator and need-change/helm labels has been applied if applicable.
  • The appropriate team/.. label has been applied, if known.
  • If known, an appropriate milestone has been selected; otherwise the Triage milestone is set.
  • The config template has been updated if applicable.

Note: Adding GitHub labels is only possible for contributors with write access.

@Barbayar Barbayar requested a review from a team as a code owner October 12, 2021 09:40
@bits-bot
Copy link
Copy Markdown
Collaborator

bits-bot commented Oct 12, 2021

CLA assistant check
All committers have signed the CLA.

@raphaelgavache raphaelgavache added this to the 7.33.0 milestone Oct 12, 2021
@raphaelgavache raphaelgavache added changelog/no-changelog No changelog entry needed team/agent-apm trace-agent labels Oct 12, 2021
Copy link
Copy Markdown
Contributor

@gbbr gbbr left a comment

Choose a reason for hiding this comment

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

This is ok by me. Just a small curiosity around the conversion code.

Comment thread pkg/trace/api/api.go Outdated
@gbbr gbbr changed the title [trace-agent] Updates the message structure between 'api' and 'agent' pkg/trace/{api,agent,pb}: introduce new client payload formats: TracerPayload & TraceChunk Oct 13, 2021
Comment thread pkg/trace/pb/trace.go Outdated
Comment thread pkg/trace/api/api.go Outdated
Comment thread pkg/trace/api/api.go Outdated
Comment thread pkg/trace/api/api.go Outdated
Comment thread pkg/trace/api/api.go Outdated
Comment thread pkg/trace/api/api.go Outdated
Comment thread pkg/trace/agent/agent.go Outdated
Comment thread pkg/trace/agent/agent.go Outdated
Comment thread pkg/trace/api/api.go Outdated
Comment thread pkg/trace/agent/agent.go Outdated
Comment thread pkg/trace/agent/agent_test.go Outdated
Comment thread pkg/trace/agent/agent_test.go Outdated
Comment thread pkg/trace/agent/agent_test.go Outdated
Comment thread pkg/trace/api/api.go Outdated
Comment thread pkg/trace/api/api.go Outdated
Comment thread pkg/trace/api/api.go Outdated
Comment thread pkg/trace/agent/agent.go Outdated
@Barbayar Barbayar force-pushed the barbayar.dashzeveg/trace-payload-refactor branch from 64af360 to 753749c Compare October 22, 2021 14:10
Comment thread pkg/trace/api/api.go Outdated
@Barbayar Barbayar force-pushed the barbayar.dashzeveg/trace-payload-refactor branch from 40bebf0 to 4d2271d Compare October 25, 2021 13:17
Comment thread pkg/trace/sampler/sampler.go Outdated
@Barbayar Barbayar force-pushed the barbayar.dashzeveg/trace-payload-refactor branch from 4d2271d to 2d55eda Compare October 25, 2021 13:53
Comment thread pkg/trace/agent/agent.go Outdated
Comment thread pkg/trace/agent/agent.go Outdated
Comment thread pkg/trace/agent/agent.go Outdated
Comment thread pkg/trace/sampler/sampler.go Outdated
@Barbayar Barbayar requested a review from gbbr October 26, 2021 12:26
Comment thread pkg/trace/event/processor.go Outdated
Comment thread pkg/trace/agent/agent.go Outdated
Copy link
Copy Markdown
Contributor

@gbbr gbbr left a comment

Choose a reason for hiding this comment

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

I've skimmed through the PR and left some comments. I'm not done, I'm yet to review the writer and some other bits, but I'm submitting them so you can get a head start.

Comment thread pkg/trace/agent/agent.go Outdated
Comment thread pkg/trace/agent/agent.go Outdated
Comment thread pkg/trace/agent/agent.go Outdated
Comment thread pkg/trace/agent/agent.go Outdated
Comment thread pkg/trace/agent/agent.go Outdated
Comment thread pkg/trace/sampler/sampler.go Outdated
Comment thread pkg/trace/stats/concentrator_test.go Outdated
Comment thread pkg/trace/test/testsuite/chunking_test.go Outdated
Comment thread pkg/trace/test/testsuite/events_test.go Outdated
Comment thread pkg/trace/test/testsuite/events_test.go Outdated
@Barbayar Barbayar force-pushed the barbayar.dashzeveg/trace-payload-refactor branch from fbd3c0c to c74ac0d Compare October 29, 2021 15:22
Comment thread pkg/trace/writer/trace.go Outdated
Comment thread pkg/trace/writer/trace.go Outdated
Comment thread pkg/trace/writer/trace.go Outdated
Comment thread pkg/trace/api/api.go Outdated
Comment thread pkg/trace/agent/agent.go Outdated
Comment thread pkg/trace/writer/trace.go Outdated
Comment thread pkg/trace/agent/agent.go Outdated
Comment thread pkg/trace/pb/tracer_payload.proto Outdated
Comment thread pkg/trace/event/processor.go Outdated
@Barbayar Barbayar force-pushed the barbayar.dashzeveg/trace-payload-refactor branch from 5a4e693 to db18b57 Compare November 2, 2021 23:56
@Barbayar Barbayar requested a review from gbbr November 3, 2021 08:44
@Barbayar Barbayar force-pushed the barbayar.dashzeveg/trace-payload-refactor branch from db18b57 to 2b61072 Compare November 3, 2021 10:11
@j-rufino
Copy link
Copy Markdown
Contributor

j-rufino commented Nov 3, 2021

Hi,

As discussed offline, this PR changes are coupled to (and blocked by) related changes

import "span.proto";
import "tracer_payload.proto";

message TracePayload {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we should call this AgentPayload, like in the RFC. WDYT?

@Barbayar Barbayar closed this Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/no-changelog No changelog entry needed team/agent-apm trace-agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants