Skip to content

Commit

Permalink
Rename TelemetryV2 to Telemetry (#4751)
Browse files Browse the repository at this point in the history
* Remove V2 suffixes from classes

* Remove TelemetryWrapper in favour of TelemetryData

This was an abstraction over TelemetryDataV1 and TelemetryDataV2, so it's not needed now and just adds complexity

* Remove unused ConfigTelemetryData keys
  • Loading branch information
andrewlock authored Oct 30, 2023
1 parent b3144f5 commit 274c384
Show file tree
Hide file tree
Showing 39 changed files with 308 additions and 399 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="ApplicationTelemetryCollectorV2.cs" company="Datadog">
// <copyright file="ApplicationTelemetryCollector.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>
Expand All @@ -11,17 +11,17 @@

namespace Datadog.Trace.Telemetry.Collectors;

internal class ApplicationTelemetryCollectorV2
internal class ApplicationTelemetryCollector
{
private ApplicationTelemetryDataV2? _applicationData = null;
private HostTelemetryDataV2? _hostData = null;
private ApplicationTelemetryData? _applicationData = null;
private HostTelemetryData? _hostData = null;

public void RecordTracerSettings(
ImmutableTracerSettings tracerSettings,
string defaultServiceName)
{
var frameworkDescription = FrameworkDescription.Instance;
var application = new ApplicationTelemetryDataV2(
var application = new ApplicationTelemetryData(
serviceName: defaultServiceName,
env: tracerSettings.EnvironmentInternal ?? string.Empty, // required, but we don't have it
serviceVersion: tracerSettings.ServiceVersionInternal ?? string.Empty, // required, but we don't have it
Expand All @@ -40,7 +40,7 @@ public void RecordTracerSettings(
}

var host = HostMetadata.Instance;
_hostData = new HostTelemetryDataV2(
_hostData = new HostTelemetryData(
hostname: host.Hostname ?? string.Empty, // this is required, but we don't have it
os: frameworkDescription.OSPlatform,
architecture: frameworkDescription.ProcessArchitecture)
Expand All @@ -55,10 +55,10 @@ public void RecordTracerSettings(
/// <summary>
/// Get the application data. Will be null if not yet initialized.
/// </summary>
public ApplicationTelemetryDataV2? GetApplicationData() => _applicationData;
public ApplicationTelemetryData? GetApplicationData() => _applicationData;

/// <summary>
/// Get the host data. Will be null if not yet initialized.
/// </summary>
public HostTelemetryDataV2? GetHostData() => _hostData;
public HostTelemetryData? GetHostData() => _hostData;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="AppClientConfigurationChangedPayloadV2.cs" company="Datadog">
// <copyright file="AppClientConfigurationChangedPayload.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>
Expand All @@ -8,9 +8,9 @@

namespace Datadog.Trace.Telemetry;

internal class AppClientConfigurationChangedPayloadV2 : IPayload
internal class AppClientConfigurationChangedPayload : IPayload
{
public AppClientConfigurationChangedPayloadV2(ICollection<ConfigurationKeyValue> configuration)
public AppClientConfigurationChangedPayload(ICollection<ConfigurationKeyValue> configuration)
{
Configuration = configuration;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="AppProductChangePayloadV2.cs" company="Datadog">
// <copyright file="AppProductChangePayload.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>
Expand All @@ -7,9 +7,9 @@

namespace Datadog.Trace.Telemetry;

internal class AppProductChangePayloadV2 : IPayload
internal class AppProductChangePayload : IPayload
{
public AppProductChangePayloadV2(ProductsData products)
public AppProductChangePayload(ProductsData products)
{
Products = products;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="AppStartedPayloadV2.cs" company="Datadog">
// <copyright file="AppStartedPayload.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>
Expand All @@ -8,7 +8,7 @@

namespace Datadog.Trace.Telemetry;

internal class AppStartedPayloadV2 : IPayload
internal class AppStartedPayload : IPayload
{
public ProductsData? Products { get; set; }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="ApplicationTelemetryDataV2.cs" company="Datadog">
// <copyright file="ApplicationTelemetryData.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>
Expand All @@ -7,9 +7,9 @@

namespace Datadog.Trace.Telemetry;

internal class ApplicationTelemetryDataV2
internal class ApplicationTelemetryData
{
public ApplicationTelemetryDataV2(string serviceName, string env, string serviceVersion, string tracerVersion, string languageName, string languageVersion, string runtimeName, string runtimeVersion)
public ApplicationTelemetryData(string serviceName, string env, string serviceVersion, string tracerVersion, string languageName, string languageVersion, string runtimeName, string runtimeVersion)
{
ServiceName = serviceName;
Env = env;
Expand Down
27 changes: 0 additions & 27 deletions tracer/src/Datadog.Trace/Telemetry/DTOs/ConfigTelemetryData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,14 @@ namespace Datadog.Trace.Telemetry
{
internal static class ConfigTelemetryData
{
public const string Platform = "platform";
public const string Enabled = "enabled";
public const string AgentUrl = "agent_url";
public const string AgentTraceTransport = "agent_transport";
public const string Debug = "debug";
public const string NativeTracerVersion = "native_tracer_version";
public const string ManagedTracerTfm = "managed_tracer_framework";
public const string AnalyticsEnabled = "analytics_enabled";
public const string SampleRate = "sample_rate";
public const string SamplingRules = "sampling_rules";
public const string LogInjectionEnabled = "logInjection_enabled";
public const string RuntimeMetricsEnabled = "runtimemetrics_enabled";
public const string RoutetemplateResourcenamesEnabled = "routetemplate_resourcenames_enabled";
public const string RoutetemplateExpansionEnabled = "routetemplate_expansion_enabled";
public const string PartialflushEnabled = "partialflush_enabled";
public const string PartialflushMinspans = "partialflush_minspans";
public const string TracerInstanceCount = "tracer_instance_count";
public const string AasConfigurationError = "aas_configuration_error";
public const string SecurityEnabled = "security_enabled";
public const string IastEnabled = "iast_enabled";
public const string FullTrustAppDomain = "environment_fulltrust_appdomain";
public const string TraceMethods = "trace_methods";
public const string StatsComputationEnabled = "stats_computation_enabled";
public const string WcfObfuscationEnabled = "wcf_obfuscation_enabled";
public const string DataStreamsMonitoringEnabled = "data_streams_enabled";
public const string SpanSamplingRules = "span_sampling_rules";
public const string PropagationStyleExtract = "DD_TRACE_PROPAGATION_STYLE_EXTRACT";
public const string PropagationStyleInject = "DD_TRACE_PROPAGATION_STYLE_INJECT";

public const string CloudHosting = "cloud_hosting";
public const string AasSiteExtensionVersion = "aas_siteextensions_version";
public const string AasAppType = "aas_app_type";
public const string AasFunctionsRuntimeVersion = "aas_functions_runtime_version";

public const string OpenTelemetryEnabled = "otel_enabled";

public const string ProfilerLoaded = "profiler_loaded";
public const string CodeHotspotsEnabled = "code_hotspots_enabled";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// <copyright file="HostTelemetryDataV2.cs" company="Datadog">
// <copyright file="HostTelemetryData.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
namespace Datadog.Trace.Telemetry;

internal class HostTelemetryDataV2
internal class HostTelemetryData
{
public HostTelemetryDataV2(string hostname, string os, string architecture)
public HostTelemetryData(string hostname, string os, string architecture)
{
Hostname = hostname;
Os = os;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="TelemetryDataV2.cs" company="Datadog">
// <copyright file="TelemetryData.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>
Expand All @@ -11,15 +11,15 @@ namespace Datadog.Trace.Telemetry
/// DTO that is serialized.
/// Be aware that the property names control serialization
/// </summary>
internal class TelemetryDataV2
internal class TelemetryData
{
public TelemetryDataV2(
public TelemetryData(
string requestType,
long tracerTime,
string runtimeId,
int seqId,
ApplicationTelemetryDataV2 application,
HostTelemetryDataV2 host,
ApplicationTelemetryData application,
HostTelemetryData host,
IPayload? payload)
{
RequestType = requestType;
Expand Down Expand Up @@ -55,9 +55,9 @@ public TelemetryDataV2(
/// </summary>
public int SeqId { get; set; }

public ApplicationTelemetryDataV2 Application { get; set; }
public ApplicationTelemetryData Application { get; set; }

public HostTelemetryDataV2 Host { get; set; }
public HostTelemetryData Host { get; set; }

public IPayload? Payload { get; set; }
}
Expand Down
1 change: 0 additions & 1 deletion tracer/src/Datadog.Trace/Telemetry/ITelemetryController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ internal interface ITelemetryController

/// <summary>
/// Should be called when the status (enabled/disabled) of a product (ASM/Profiler) changed.
/// Only used in Telemetry V2
/// </summary>
void ProductChanged(TelemetryProductType product, bool enabled, ErrorData? error);
}
Expand Down
2 changes: 1 addition & 1 deletion tracer/src/Datadog.Trace/Telemetry/ITelemetryTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal interface ITelemetryTransport
/// <param name="data">The data to send</param>
/// <returns><c>true</c> if the data was sent successfully, or a non-fatal error occurred
/// <c>false</c> if a fatal error occured, and no further telemetry should be sent.</returns>
Task<TelemetryPushResult> PushTelemetry(TelemetryDataV2 data);
Task<TelemetryPushResult> PushTelemetry(TelemetryData data);

string GetTransportInfo();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="TelemetryControllerV2.cs" company="Datadog">
// <copyright file="TelemetryController.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>
Expand All @@ -19,13 +19,13 @@

namespace Datadog.Trace.Telemetry;

internal class TelemetryControllerV2 : ITelemetryController
internal class TelemetryController : ITelemetryController
{
private static readonly IDatadogLogger Log = DatadogLogging.GetLoggerFor<TelemetryControllerV2>();
private readonly TelemetryDataBuilderV2 _dataBuilder = new();
private static readonly IDatadogLogger Log = DatadogLogging.GetLoggerFor<TelemetryController>();
private readonly TelemetryDataBuilder _dataBuilder = new();
private readonly ConcurrentQueue<WorkItem> _queue = new();
private readonly TelemetryDataAggregator _aggregator = new(previous: null);
private readonly ApplicationTelemetryCollectorV2 _application = new();
private readonly ApplicationTelemetryCollector _application = new();
private readonly IConfigurationTelemetry _configuration;
private readonly IDependencyTelemetryCollector _dependencies;
private readonly IntegrationTelemetryCollector _integrations = new();
Expand All @@ -34,16 +34,16 @@ internal class TelemetryControllerV2 : ITelemetryController
private readonly TaskCompletionSource<bool> _processExit = new();
private readonly Task _flushTask;
private readonly Scheduler _scheduler;
private TelemetryTransportManagerV2 _transportManager;
private TelemetryTransportManager _transportManager;
private bool _sendTelemetry;
private bool _isStarted;
private string? _namingVersion;

internal TelemetryControllerV2(
internal TelemetryController(
IConfigurationTelemetry configuration,
IDependencyTelemetryCollector dependencies,
IMetricsTelemetryCollector metrics,
TelemetryTransportManagerV2 transportManager,
TelemetryTransportManager transportManager,
TimeSpan flushInterval)
{
_configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
Expand Down Expand Up @@ -122,7 +122,7 @@ public void DisableSending()
_queue.Enqueue(new WorkItem(WorkItem.ItemType.DisableSending, null));
}

public void SetTransportManager(TelemetryTransportManagerV2 manager)
public void SetTransportManager(TelemetryTransportManager manager)
{
_queue.Enqueue(new WorkItem(WorkItem.ItemType.SetTransportManager, manager));
}
Expand Down Expand Up @@ -168,7 +168,7 @@ private async Task PushTelemetryLoopAsync()
{
case WorkItem.ItemType.SetTransportManager:
_transportManager.Dispose(); // dispose the old one
_transportManager = (TelemetryTransportManagerV2)item.State!;
_transportManager = (TelemetryTransportManager)item.State!;
break;
case WorkItem.ItemType.SetTracerStarted:
_isStarted = true;
Expand Down
Loading

0 comments on commit 274c384

Please sign in to comment.