Skip to content

Commit

Permalink
Change variables separator to comma (#156)
Browse files Browse the repository at this point in the history
* Change env separator to comma

* fix tests' separators

* fix integration tests

* update docs

Co-authored-by: Paulo Janotti <pjanotti@splunk.com>
  • Loading branch information
RassK and pjanotti authored Apr 29, 2021
1 parent b8e6e9e commit 1ee0e6b
Show file tree
Hide file tree
Showing 22 changed files with 41 additions and 41 deletions.
10 changes: 5 additions & 5 deletions docs/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Use these environment variables to configure the tracing library:
| `OTEL_TRACE_BATCH_INTERVAL` | The batch interval in milliseconds for the serialization queue. | `100` |
| `OTEL_MAX_TRACES_PER_SECOND` | The number of traces allowed to be submitted per second. | `100` |
| `OTEL_TRACE_STARTUP_LOGS` | Enable to activate diagnostic log at stratup. | `true` |
| `OTEL_TRACE_SAMPLING_RULES` | Semi-colon separated list of sampling rules taht enabled custom sampling rules based on regular expressions. The rule is matched in order of specification. The first match in a list is used. The item "sample_rate" is required in decimal format. The item "service" is optional in regular expression format, to match on service name. The item "name" is optional in regular expression format, to match on operation name. | `'[{"sample_rate":0.5, "service":"cart.*"}];[{"sample_rate":0.2, "name":"http.request"}]'` |
| `OTEL_TRACE_SAMPLING_RULES` | Comma separated list of sampling rules taht enabled custom sampling rules based on regular expressions. The rule is matched in order of specification. The first match in a list is used. The item "sample_rate" is required in decimal format. The item "service" is optional in regular expression format, to match on service name. The item "name" is optional in regular expression format, to match on operation name. | `'[{"sample_rate":0.5, "service":"cart.*"}],[{"sample_rate":0.2, "name":"http.request"}]'` |
| `OTEL_TRACE_SAMPLE_RATE` | The global rate for the sampler. | |
| `OTEL_DOGSTATSD_PORT` | The port of the targeted StatsD server. | `8125` |
| `OTEL_TRACE_METRICS_ENABLED` | Enable to activate internal metrics sent to DogStatsD. | `false` |
Expand Down Expand Up @@ -55,12 +55,12 @@ Use these environment variables to configure the tracing library:
| `OTEL_MAX_LOGFILE_SIZE` | The maximum size for tracer log files, in bytes. | `10 MB` |
| `OTEL_TRACE_LOG_PATH` | The path of the profiler log file. | Linux: `/var/log/OTEL/dotnet/dotnet-profiler.log`<br>Windows: `%ProgramData%"\OTEL .NET Tracing\logs\dotnet-profiler.log` |
| `OTEL_DIAGNOSTIC_SOURCE_ENABLED` | Enable to generate troubleshooting logs with the `System.Diagnostics.DiagnosticSource` class. | `true` |
| `OTEL_DISABLED_INTEGRATIONS` | The integrations you want to disable, if any, separated by a semi-colon. These are the supported integrations: AspNetMvc, AspNetWebApi2, DbCommand, ElasticsearchNet5, ElasticsearchNet6, GraphQL, HttpMessageHandler, IDbCommand, MongoDb, NpgsqlCommand, OpenTracing, ServiceStackRedis, SqlCommand, StackExchangeRedis, Wcf, WebRequest | |
| `OTEL_DISABLED_INTEGRATIONS` | The integrations you want to disable, if any, separated by a comma. These are the supported integrations: AspNetMvc, AspNetWebApi2, DbCommand, ElasticsearchNet5, ElasticsearchNet6, GraphQL, HttpMessageHandler, IDbCommand, MongoDb, NpgsqlCommand, OpenTracing, ServiceStackRedis, SqlCommand, StackExchangeRedis, Wcf, WebRequest | |
| `OTEL_CONVENTION` | Sets the semantic and trace id conventions for the tracer. Available values are: `Datadog` (64bit trace id), `OpenTelemetry` (128 bit trace id). | `Datadog` |
| `OTEL_PROPAGATORS` | Semicolon separated list of the propagators for the tracer. Available propagators are: `Datadog`, `B3`, `W3C`. The Tracer will try to execute extraction in the given order. | `Datadog` |
| `OTEL_PROPAGATORS` | Comma separated list of the propagators for the tracer. Available propagators are: `Datadog`, `B3`, `W3C`. The Tracer will try to execute extraction in the given order. | `Datadog` |
| `OTEL_TRACE_DOMAIN_NEUTRAL_INSTRUMENTATION` | Sets whether to intercept method calls when the caller method is inside a domain-neutral assembly. This is recommended when instrumenting IIS applications. | `false` |
| `OTEL_PROFILER_PROCESSES` | Sets the filename of executables the profiler can attach to. If not defined (default), the profiler will attach to any process. Supports multiple values separated with semi-colons, for example: `MyApp.exe;dotnet.exe` | |
| `OTEL_PROFILER_EXCLUDE_PROCESSES` | Sets the filename of executables the profiler cannot attach to. If not defined (default), the profiler will attach to any process. Supports multiple values separated with semi-colons, for example: `MyApp.exe;dotnet.exe` | |
| `OTEL_PROFILER_PROCESSES` | Sets the filename of executables the profiler can attach to. If not defined (default), the profiler will attach to any process. Supports multiple values separated with comma, for example: `MyApp.exe,dotnet.exe` | |
| `OTEL_PROFILER_EXCLUDE_PROCESSES` | Sets the filename of executables the profiler cannot attach to. If not defined (default), the profiler will attach to any process. Supports multiple values separated with comma, for example: `MyApp.exe,dotnet.exe` | |


### Linux
Expand Down
16 changes: 8 additions & 8 deletions src/Datadog.Trace.ClrProfiler.Native/environment_variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const WSTRING tracing_enabled = WStr("OTEL_TRACE_ENABLED");
const WSTRING debug_enabled = WStr("OTEL_TRACE_DEBUG");

// Sets the paths to integration definition JSON files.
// Supports multiple values separated with semi-colons, for example:
// "C:\Program Files\OpenTelemetry .NET AutoInstrumentation\integrations.json;D:\temp\test_integrations.json"
// Supports multiple values separated with comma, for example:
// "C:\Program Files\OpenTelemetry .NET AutoInstrumentation\integrations.json,D:\temp\test_integrations.json"
const WSTRING integrations_path = WStr("OTEL_INTEGRATIONS");

// Sets the path to the profiler's home directory, for example:
Expand All @@ -24,14 +24,14 @@ const WSTRING profiler_home_path = WStr("OTEL_DOTNET_TRACER_HOME");

// Sets the filename of executables the profiler can attach to.
// If not defined (default), the profiler will attach to any process.
// Supports multiple values separated with semi-colons, for example:
// "MyApp.exe;dotnet.exe"
// Supports multiple values separated with comma, for example:
// "MyApp.exe,dotnet.exe"
const WSTRING include_process_names = WStr("OTEL_PROFILER_PROCESSES");

// Sets the filename of executables the profiler cannot attach to.
// If not defined (default), the profiler will attach to any process.
// Supports multiple values separated with semi-colons, for example:
// "MyApp.exe;dotnet.exe"
// Supports multiple values separated with comma, for example:
// "MyApp.exe,dotnet.exe"
const WSTRING exclude_process_names = WStr("OTEL_PROFILER_EXCLUDE_PROCESSES");

// Sets the Agent's host. Default is localhost.
Expand All @@ -53,8 +53,8 @@ const WSTRING service_version = WStr("OTEL_VERSION");

// Sets a list of integrations to disable. All other integrations will remain
// enabled. If not set (default), all integrations are enabled. Supports
// multiple values separated with semi-colons, for example:
// "ElasticsearchNet;AspNetWebApi2"
// multiple values separated with comma, for example:
// "ElasticsearchNet,AspNetWebApi2"
const WSTRING disabled_integrations = WStr("OTEL_DISABLED_INTEGRATIONS");

// Sets the path for the profiler's log file.
Expand Down
2 changes: 1 addition & 1 deletion src/Datadog.Trace.ClrProfiler.Native/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ std::vector<WSTRING> GetEnvironmentValues(const WSTRING &name,
}

std::vector<WSTRING> GetEnvironmentValues(const WSTRING &name) {
return GetEnvironmentValues(name, L';');
return GetEnvironmentValues(name, L',');
}

constexpr char HexMap[] = {'0', '1', '2', '3', '4', '5', '6', '7',
Expand Down
2 changes: 1 addition & 1 deletion src/Datadog.Trace.ClrProfiler.Native/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ WSTRING GetEnvironmentValue(const WSTRING &name);
std::vector<WSTRING> GetEnvironmentValues(const WSTRING &name,
const wchar_t delim);

// GetEnvironmentValues calls GetEnvironmentValues with a semicolon delimiter.
// GetEnvironmentValues calls GetEnvironmentValues with a comma delimiter.
std::vector<WSTRING> GetEnvironmentValues(const WSTRING &name);

// Convert Hex to string
Expand Down
10 changes: 5 additions & 5 deletions src/Datadog.Trace/Configuration/ConfigurationKeys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ public static class ConfigurationKeys
/// <summary>
/// Configuration key for a list of integrations to disable. All other integrations remain enabled.
/// Default is empty (all integrations are enabled).
/// Supports multiple values separated with semi-colons.
/// Supports multiple values separated with comma.
/// </summary>
/// <seealso cref="TracerSettings.DisabledIntegrationNames"/>
public const string DisabledIntegrations = "OTEL_DISABLED_INTEGRATIONS";

/// <summary>
/// Configuration key for a list of AdoNet types that will be excluded from automatic instrumentation.
/// Default is empty (all AdoNet types are included in automatic instrumentation).
/// Supports multiple values separated with semi-colons.
/// Supports multiple values separated with comma.
/// </summary>
/// <seealso cref="TracerSettings.AdoNetExcludedTypes"/>
public const string AdoNetExcludedTypes = "OTEL_TRACE_ADONET_EXCLUDED_TYPES";
Expand Down Expand Up @@ -171,7 +171,7 @@ public static class ConfigurationKeys

/// <summary>
/// Configuration key for setting custom sampling rules based on regular expressions.
/// Semi-colon separated list of sampling rules.
/// Comma separated list of sampling rules.
/// The rule is matched in order of specification. The first match in a list is used.
///
/// Per entry:
Expand All @@ -191,7 +191,7 @@ public static class ConfigurationKeys
/// To give a rate of 10% to all traces
/// '[{"sample_rate":0.1}]'
///
/// To configure multiple rules, separate by semi-colon and order from most specific to least specific:
/// To configure multiple rules, separate by comma and order from most specific to least specific:
/// '[{"sample_rate":0.5, "service":"cart.*"}, {"sample_rate":0.2, "name":"http.request"}, {"sample_rate":1.0, "service":"background", "name":"sql.query"}, {"sample_rate":0.1}]'
///
/// If no rules are specified, or none match, default internal sampling logic will be used.
Expand Down Expand Up @@ -296,7 +296,7 @@ public static class ConfigurationKeys
/// <summary>
/// Configuration key for the propagators to be used.
/// Default is <c>Datadog</c>.
/// Supports multiple values separated with semi-colons.
/// Supports multiple values separated with comma.
/// <seealso cref="TracerSettings.Propagators"/>
/// </summary>
public const string Propagators = "OTEL_PROPAGATORS";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Datadog.Trace.Configuration
{
internal static class ConfigurationSourceExtensions
{
private const char Separator = ';';
private const char Separator = ',';

public static IEnumerable<string> GetStrings(this IConfigurationSource source, string key)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void SpansDisabledByAdoNetExcludedTypes(bool enableCallTarget, bool enabl
const string dbType = "fake";
const string expectedOperationName = dbType + ".query";

SetEnvironmentVariable(ConfigurationKeys.AdoNetExcludedTypes, "Samples.FakeDbCommand.FakeCommand;System.Data.Common.DbCommand;System.Data.SqlClient.SqlCommand;Microsoft.Data.SqlClient.SqlCommand;MySql.Data.MySqlClient.MySqlCommand;Npgsql.NpgsqlCommand");
SetEnvironmentVariable(ConfigurationKeys.AdoNetExcludedTypes, "Samples.FakeDbCommand.FakeCommand,System.Data.Common.DbCommand,System.Data.SqlClient.SqlCommand,Microsoft.Data.SqlClient.SqlCommand,MySql.Data.MySqlClient.MySqlCommand,Npgsql.NpgsqlCommand");

int agentPort = TcpPortProvider.GetOpenPort();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void SpansDisabledByAdoNetExcludedTypes(bool enableCallTarget, bool enabl
const string dbType = "sql-server";
const string expectedOperationName = dbType + ".query";

SetEnvironmentVariable(ConfigurationKeys.AdoNetExcludedTypes, "System.Data.SqlClient.SqlCommand;Microsoft.Data.SqlClient.SqlCommand;MySql.Data.MySqlClient.MySqlCommand;Npgsql.NpgsqlCommand");
SetEnvironmentVariable(ConfigurationKeys.AdoNetExcludedTypes, "System.Data.SqlClient.SqlCommand,Microsoft.Data.SqlClient.SqlCommand,MySql.Data.MySqlClient.MySqlCommand,Npgsql.NpgsqlCommand");

string packageVersion = PackageVersions.MicrosoftDataSqlClient.First()[0] as string;
int agentPort = TcpPortProvider.GetOpenPort();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !NET452
#if !NET452
using System.Collections.Generic;
using System.Linq;
using Datadog.Core.Tools;
Expand Down Expand Up @@ -81,7 +81,7 @@ public void SpansDisabledByAdoNetExcludedTypes(bool enableCallTarget, bool enabl
const string dbType = "sql-server";
const string expectedOperationName = dbType + ".query";

SetEnvironmentVariable(ConfigurationKeys.AdoNetExcludedTypes, "System.Data.SQLite.SQLiteCommand;Microsoft.Data.Sqlite.SqliteCommand");
SetEnvironmentVariable(ConfigurationKeys.AdoNetExcludedTypes, "System.Data.SQLite.SQLiteCommand,Microsoft.Data.Sqlite.SqliteCommand");

string packageVersion = PackageVersions.MicrosoftDataSqlite.First()[0] as string;
int agentPort = TcpPortProvider.GetOpenPort();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void SpansDisabledByAdoNetExcludedTypes(bool enableCallTarget, bool enabl
const string dbType = "mysql";
const string expectedOperationName = dbType + ".query";

SetEnvironmentVariable(ConfigurationKeys.AdoNetExcludedTypes, "System.Data.SqlClient.SqlCommand;Microsoft.Data.SqlClient.SqlCommand;MySql.Data.MySqlClient.MySqlCommand;Npgsql.NpgsqlCommand");
SetEnvironmentVariable(ConfigurationKeys.AdoNetExcludedTypes, "System.Data.SqlClient.SqlCommand,Microsoft.Data.SqlClient.SqlCommand,MySql.Data.MySqlClient.MySqlCommand,Npgsql.NpgsqlCommand");

int agentPort = TcpPortProvider.GetOpenPort();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void SpansDisabledByAdoNetExcludedTypes(bool enableCallTarget, bool enabl
const string dbType = "postgres";
const string expectedOperationName = dbType + ".query";

SetEnvironmentVariable(ConfigurationKeys.AdoNetExcludedTypes, "System.Data.SqlClient.SqlCommand;Microsoft.Data.SqlClient.SqlCommand;MySql.Data.MySqlClient.MySqlCommand;Npgsql.NpgsqlCommand");
SetEnvironmentVariable(ConfigurationKeys.AdoNetExcludedTypes, "System.Data.SqlClient.SqlCommand,Microsoft.Data.SqlClient.SqlCommand,MySql.Data.MySqlClient.MySqlCommand,Npgsql.NpgsqlCommand");

string packageVersion = PackageVersions.Npgsql.First()[0] as string;
int agentPort = TcpPortProvider.GetOpenPort();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void SpansDisabledByAdoNetExcludedTypes(bool enableCallTarget, bool enabl
const string dbType = "sql-server";
const string expectedOperationName = dbType + ".query";

SetEnvironmentVariable(ConfigurationKeys.AdoNetExcludedTypes, "System.Data.SqlClient.SqlCommand;Microsoft.Data.SqlClient.SqlCommand;MySql.Data.MySqlClient.MySqlCommand;Npgsql.NpgsqlCommand");
SetEnvironmentVariable(ConfigurationKeys.AdoNetExcludedTypes, "System.Data.SqlClient.SqlCommand,Microsoft.Data.SqlClient.SqlCommand,MySql.Data.MySqlClient.MySqlCommand,Npgsql.NpgsqlCommand");

int agentPort = TcpPortProvider.GetOpenPort();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void SpansDisabledByAdoNetExcludedTypes(bool enableCallTarget, bool enabl
const string dbType = "sql-server";
const string expectedOperationName = dbType + ".query";

SetEnvironmentVariable(ConfigurationKeys.AdoNetExcludedTypes, "System.Data.SqlClient.SqlCommand;Microsoft.Data.SqlClient.SqlCommand;MySql.Data.MySqlClient.MySqlCommand;Npgsql.NpgsqlCommand");
SetEnvironmentVariable(ConfigurationKeys.AdoNetExcludedTypes, "System.Data.SqlClient.SqlCommand,Microsoft.Data.SqlClient.SqlCommand,MySql.Data.MySqlClient.MySqlCommand,Npgsql.NpgsqlCommand");

string packageVersion = PackageVersions.SystemDataSqlClient.First()[0] as string;
int agentPort = TcpPortProvider.GetOpenPort();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !NET452
#if !NET452
using System.Collections.Generic;
using System.Linq;
using Datadog.Core.Tools;
Expand Down Expand Up @@ -73,7 +73,7 @@ public void SpansDisabledByAdoNetExcludedTypes(bool enableCallTarget, bool enabl
const string dbType = "sql-server";
const string expectedOperationName = dbType + ".query";

SetEnvironmentVariable(ConfigurationKeys.AdoNetExcludedTypes, "System.Data.SQLite.SQLiteCommand;Microsoft.Data.Sqlite.SqliteCommand");
SetEnvironmentVariable(ConfigurationKeys.AdoNetExcludedTypes, "System.Data.SQLite.SQLiteCommand,Microsoft.Data.Sqlite.SqliteCommand");

int agentPort = TcpPortProvider.GetOpenPort();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class HttpMessageHandlerTests : TestHelper
public HttpMessageHandlerTests(ITestOutputHelper output)
: base("HttpMessageHandler", output)
{
SetEnvironmentVariable("OTEL_PROPAGATORS", "datadog;b3");
SetEnvironmentVariable("OTEL_PROPAGATORS", "datadog,b3");
SetEnvironmentVariable("OTEL_HTTP_CLIENT_ERROR_STATUSES", "400-499, 502,-343,11-53, 500-500-200");
SetServiceVersion("1.0.0");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public ServiceMappingTests(ITestOutputHelper output)
: base("WebRequest", output)
{
SetEnvironmentVariable("OTEL_TRACE_SERVICE_MAPPING", "some-trace:not-used,http-client:my-custom-client");
SetEnvironmentVariable("OTEL_PROPAGATORS", "datadog;b3");
SetEnvironmentVariable("OTEL_PROPAGATORS", "datadog,b3");
SetServiceVersion("1.0.0");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public WebRequest20Tests(ITestOutputHelper output)
: base("WebRequest.NetFramework20", output)
{
SetServiceVersion("1.0.0");
SetEnvironmentVariable("OTEL_PROPAGATORS", "datadog;b3");
SetEnvironmentVariable("OTEL_PROPAGATORS", "datadog,b3");
}

[Theory]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public WebRequestTests(ITestOutputHelper output)
: base("WebRequest", output)
{
SetServiceVersion("1.0.0");
SetEnvironmentVariable("OTEL_PROPAGATORS", "datadog;b3");
SetEnvironmentVariable("OTEL_PROPAGATORS", "datadog,b3");
}

[Theory]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ TEST(IntegrationLoaderTest, LoadsFromEnvironment) {
)TEXT";
f.close();

auto name = tmpname1.wstring() + L";" + tmpname2.wstring();
auto name = tmpname1.wstring() + L"," + tmpname2.wstring();

SetEnvironmentVariableW(trace::environment::integrations_path.data(), name.data());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static IEnumerable<object[]> GetEnumsData()
{
yield return new object[] { new NameValueCollection { { "example1", "value1" } }, "example2", ArrayHelper.Empty<TestEnum>() };
yield return new object[] { new NameValueCollection { { "example1", "value1" } }, "example1", ArrayHelper.Empty<TestEnum>() };
yield return new object[] { new NameValueCollection { { "example1", "TestValue2;TestValue3;;" } }, "example1", new[] { TestEnum.TestValue2, TestEnum.TestValue3 } };
yield return new object[] { new NameValueCollection { { "example1", "TestValue2,TestValue3,," } }, "example1", new[] { TestEnum.TestValue2, TestEnum.TestValue3 } };
}

[Fact]
Expand Down Expand Up @@ -68,7 +68,7 @@ public void GetString_MultipleValues()
{
var collection = new NameValueCollection
{
{ "example1", "value1;value2;;" }
{ "example1", "value1,value2,," }
};
var cs = new NameValueConfigurationSource(collection);
var result = ConfigurationSourceExtensions.GetStrings(cs, "example1");
Expand Down
Loading

0 comments on commit 1ee0e6b

Please sign in to comment.