-
Notifications
You must be signed in to change notification settings - Fork 155
[DBM] Add container tags hash to queries (if enabled) #8061
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 23 commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
9a80cbf
read container tags hash from agent
vandonr 661e5db
[IAST] Use recursive_mutex instead of CS and mutex (#7890)
daniel-romano-DD d565d21
make ContainerMetadata an instance class
vandonr 1ad4b02
use constant in tests
vandonr 37a3ac1
adapt code to instance container metadata
vandonr c93c3a9
Merge remote-tracking branch 'origin/master' into vandonr/process3
vandonr 66630ec
use local instance
vandonr dcb297a
nit
vandonr 653a3a5
fix integration tests
vandonr 4fd01fa
add container tags hash to DBM queries (if enabled)
vandonr d9abd75
use volatile read/write
vandonr a5f3f8d
use collection expression
vandonr c18fc65
add container ID header to MinimalAgentHeaderHelper
vandonr 4ca4fdf
Merge remote-tracking branch 'origin/master' into vandonr/process3
vandonr fdaf436
Merge branch 'vandonr/process3' into vandonr/process2
vandonr 043c8b6
add a class for basehash
vandonr beb1980
use base hash
vandonr a75fa60
rename configuration key (I missed the prefix)
vandonr 18f4461
Merge remote-tracking branch 'origin/master' into vandonr/process2
vandonr 7a738b7
fix merge
vandonr 8ace897
add config to json
vandonr 92e4c6e
Merge remote-tracking branch 'origin/master' into vandonr/process2
vandonr 121cae0
remove files that were removed upstream
vandonr 57d31bb
fix nullability && centralize config check
vandonr 3d5ed34
fix test
vandonr 2161f1f
clean imports in adonet instrumentation
vandonr 2f0eeb2
nits
vandonr 1d2679c
Merge remote-tracking branch 'origin/master' into vandonr/process2
vandonr 3d04aad
replace static init with getter init
vandonr 6af872d
rename basehash for clarity
vandonr d81eb71
apply the same changes to container metadata as in the DSM PR
vandonr 335479d
exclude test that is specific to netcore
vandonr 747be87
Merge remote-tracking branch 'origin/master' into vandonr/process2
vandonr a89cb3f
move tags hash to serviceremapping hash, make it non-static, feed it …
vandonr d3c5d7f
reduce number of modified files
vandonr 900ac90
undo some autoformating
vandonr f1c304e
use url-safe b64
vandonr 91dc0c7
allow SRH injection into tracerManagerFactory
vandonr 44c94a7
fix itest build
vandonr 1c23065
address comments
vandonr d84c674
move setting check up one call in DbScopeFactory
vandonr 65b181a
add tests to the hash class, and change ctor param to ease testing
vandonr e1eac20
mini optim: cut only one =
vandonr e67176d
replace range with slice
vandonr 8fed285
little fixes
vandonr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // <copyright file="BaseHash.cs" company="Datadog"> | ||
| // Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. | ||
| // This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. | ||
| // </copyright> | ||
|
|
||
| #nullable enable | ||
|
|
||
| using System; | ||
| using System.Threading; | ||
| using Datadog.Trace.PlatformHelpers; | ||
| using Datadog.Trace.Util; | ||
|
|
||
| namespace Datadog.Trace; | ||
|
|
||
| /// <summary> | ||
| /// This class is a container for the "base hash", a hash of process tags and container tags. | ||
| /// Used by DBM to retrieve all the tag values from the spans, from just a single parameter (this hash), | ||
| /// Used by DSM in the pathway to identify different sources that could have been service-remapped | ||
| /// </summary> | ||
| internal static class BaseHash | ||
| { | ||
| /// <summary> | ||
| /// Gets the base64 representation of the hash | ||
| /// </summary> | ||
| public static string B64Value | ||
| { | ||
| get => Volatile.Read(ref field); | ||
| private set => Volatile.Write(ref field, value); | ||
| } | ||
|
|
||
| = Recompute(ProcessTags.SerializedTags, ContainerMetadata.Instance.ContainerTagsHash); | ||
vandonr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
vandonr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| public static string Recompute(string processTags, string? containerTagsHash) | ||
| { | ||
| var hash = FnvHash64.GenerateHash(processTags, FnvHash64.Version.V1); | ||
vandonr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if (containerTagsHash != null) | ||
| { | ||
| hash = FnvHash64.GenerateHash(containerTagsHash, FnvHash64.Version.V1, hash); | ||
| } | ||
|
|
||
| return B64Value = Convert.ToBase64String(BitConverter.GetBytes(hash)); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -533,6 +533,15 @@ supportedConfigurations: | |
| Configuration key for setting DBM propagation mode | ||
| Default value is disabled, expected values are either: disabled, service or full | ||
| <seealso cref="Datadog.Trace.Configuration.TracerSettings.DbmPropagationMode"/> | ||
| DD_DBM_INJECT_SQL_BASEHASH: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sigh this configuration key should end with |
||
| - implementation: A | ||
| type: boolean | ||
| default: 'false' | ||
| const_name: DbmInjectSqlBasehash | ||
| documentation: |- | ||
| Configuration key for enabling or disabling the injection of Base Hash in SQL Comments. | ||
| Default value is false (disabled). | ||
| <seealso cref="Datadog.Trace.Configuration.TracerSettings.DbmInjectSqlBasehash"/> | ||
| DD_DIAGNOSTIC_SOURCE_ENABLED: | ||
| - implementation: A | ||
| type: boolean | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.