Skip to content

Support service correlation for mirroring spans#431

Merged
sanket-mundra merged 15 commits intomainfrom
serviceToServiceCorrelation
Jan 30, 2024
Merged

Support service correlation for mirroring spans#431
sanket-mundra merged 15 commits intomainfrom
serviceToServiceCorrelation

Conversation

@sanket-mundra
Copy link
Copy Markdown
Contributor

@sanket-mundra sanket-mundra commented Oct 12, 2023

Description

BREAKING CHANGE: Added a new state store in raw-spans-grouper: peer-identity-to-span-metadata-store

Testing

Please describe the tests that you ran to verify your changes. Please summarize what did you test and what needs to be tested e.g. deployed and tested helm chart locally.

Checklist:

  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules

Documentation

Make sure that you have documented corresponding changes in this repository or hypertrace docs repo if required.

@sanket-mundra sanket-mundra requested a review from a team as a code owner October 12, 2023 19:31
@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 12, 2023

Codecov Report

Attention: 106 lines in your changes are missing coverage. Please review.

Comparison is base (70faf7e) 79.88% compared to head (0912315) 79.53%.
Report is 32 commits behind head on main.

❗ Current head 0912315 differs from pull request most recent head 3a217cf. Consider uploading reports for the commit 3a217cf to get more accurate results

Files Patch % Lines
...cher/enrichment/clients/DefaultClientRegistry.java 0.00% 37 Missing ⚠️
.../trace/reader/attributes/DefaultValueResolver.java 54.76% 15 Missing and 4 partials ⚠️
...rtrace/core/rawspansgrouper/RawSpansProcessor.java 87.70% 4 Missing and 11 partials ⚠️
...race/core/rawspansgrouper/TraceEmitPunctuator.java 76.47% 9 Missing and 3 partials ⚠️
...rawspansgrouper/validator/IpIdentityValidator.java 0.00% 3 Missing and 2 partials ⚠️
...e/core/spannormalizer/rawspan/ByPassPredicate.java 28.57% 2 Missing and 3 partials ⚠️
.../accessor/entities/TraceEntityAccessorBuilder.java 0.00% 4 Missing ⚠️
.../accessor/entities/DefaultTraceEntityAccessor.java 93.02% 1 Missing and 2 partials ⚠️
...wspansgrouper/validator/PeerIdentityValidator.java 40.00% 2 Missing and 1 partial ⚠️
...nrichedspan/constants/utils/EnrichedSpanUtils.java 66.66% 1 Missing ⚠️
... and 2 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #431      +/-   ##
============================================
- Coverage     79.88%   79.53%   -0.36%     
- Complexity     1419     1427       +8     
============================================
  Files           128      130       +2     
  Lines          5569     5692     +123     
  Branches        512      533      +21     
============================================
+ Hits           4449     4527      +78     
- Misses          884      912      +28     
- Partials        236      253      +17     
Flag Coverage Δ
unit 79.53% <72.75%> (-0.36%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Comment thread raw-spans-grouper/helm/values.yaml Outdated
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Comment thread raw-spans-grouper/helm/templates/raw-spans-grouper-config.yaml Outdated
Comment thread raw-spans-grouper/helm/values.yaml Outdated
Comment thread span-normalizer/span-normalizer-api/src/main/avro/trace-identity/IpIdentity.avdl Outdated
@github-actions

This comment has been minimized.

@@ -0,0 +1,6 @@
@namespace("org.hypertrace.core.spannormalizer")
protocol SpanMetadataProtocol {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

move it to raw-spans-grouper

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There is plan to merge grouper and normaliser, so keeping it together for now.

@@ -0,0 +1,15 @@
@namespace("org.hypertrace.core.spannormalizer")
protocol PeerIdentityProtocol {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same move to raw spans grouper

Comment thread span-normalizer/span-normalizer-api/src/main/avro/SpanMetadata.avdl
HexUtils.getHex(event.getEventId()),
event.getServiceName());

event
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i think we should add this in enrichedAttributes not attribute map. @skjindal93 I believe enriched attributes are for anything that traceable resolves and add to the span

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

adding to enriched attributes since we changed the attribute name to PEER_SERVICE_NAME

}

String agentType =
attributeMap
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do we have access to EnrichedSpanUtils here? it generally has all this functions

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

but that is enriched attribute right? here we will not have the enriched attributes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Using the SpanAttributeUtils.getStringAttributeWithDefault()

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

skjindal93
skjindal93 previously approved these changes Jan 25, 2024
}
implementation(project(":span-normalizer:span-normalizer-api"))
implementation(project(":semantic-convention-utils"))
implementation(project(":hypertrace-trace-enricher:enriched-span-constants"))
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.

Looks like this changes should be part of Trace-Enricher.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We introduced new Attrs in EnrichedSpanConstants and populating them here. So, added dependency

Timestamps timestamps =
traceLatencyMeter.trackEndToEndLatencyTimestamps(
currentTimeMs, firstEntry ? currentTimeMs : traceState.getTraceStartTimestamp());
StructuredTrace trace =
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.

We build structureTrace in two places - 1) TraceEmitPuncutator 2) Bypass condition.

This seems a third place. What is the condition for this - it's not very clear. Will the same trace be also emitted via TraceEmitPuncuator.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, the same trace be also emitted via TraceEmitPuncuator as we return in the caller function:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added a comment

trace.emit.punctuator.frequency = 15s

peer.correlation = {
enabled.customers = ["*"]
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.

add a separate var: enable.all.customers = true or false

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is the test app.conf, so added * in config. In the actual app.conf it is empty. What is the need of enable.all.customers, we can handle both using the same config.

@@ -0,0 +1,14 @@
@namespace("org.hypertrace.core.spannormalizer")
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.

This requires in raw-spans-grouper. Shouldn't this be part of raw-spans-grouper

Copy link
Copy Markdown
Contributor Author

@sanket-mundra sanket-mundra Jan 29, 2024

Choose a reason for hiding this comment

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

There were some avros also like: TraceState defined here that were getting used in raw-spans-grouper, so introduced them in a common place. What was the idea behind defining them earlier here? Should we move rest of them also to raw-spans-grouper then?

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

}

Event event = value.getEvent();
// spans whose trace is not created by ByPass flow, their trace will be created in below
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.

Note: For now, it is controlled by customer_id. But, we should check if this is a mirroring agent or singleton trace.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@Override
public boolean test(TraceIdentity traceIdentity, RawSpan rawSpan) {
// tenant level spans bypass override
if (bypassOverrideTenants.contains(rawSpan.getCustomerId())
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.

bypassExclusionTenants or excludeTenantsFromBypass

{{- end }}

{{- if hasKey .Values.spanNormalizerConfig.processor "bypassOverrideTenants" }}
bypass.override.tenants = "{{ .Values.spanNormalizerConfig.processor.bypassOverrideTenants | toJson }}"
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.

bypass.exclusion.tenants.

@github-actions

This comment has been minimized.

@sanket-mundra sanket-mundra merged commit fc4d7c0 into main Jan 30, 2024
@sanket-mundra sanket-mundra deleted the serviceToServiceCorrelation branch January 30, 2024 05:57
@github-actions
Copy link
Copy Markdown

Unit Test Results

  79 files  +1    79 suites  +1   1m 7s ⏱️ ±0s
420 tests +2  420 ✔️ +2  0 💤 ±0  0 ❌ ±0 

Results for commit fc4d7c0. ± Comparison against base commit b9f458f.

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.

4 participants