Skip to content

Commit 42987f1

Browse files
author
Ignacio Bonafonte
authored
Merge branch 'main' into bryce/otelp-metrics
2 parents d638ad2 + aed9e44 commit 42987f1

File tree

7 files changed

+9
-13
lines changed

7 files changed

+9
-13
lines changed

Examples/Datadog Sample/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ let exporterConfiguration = ExporterConfiguration(
3535
serviceName: "Opentelemetry exporter Example",
3636
resource: "Opentelemetry exporter",
3737
applicationName: "SimpleExample",
38-
applicationVersion: "0.0.1",
38+
applicationVersion: "1.0.0",
3939
environment: "test",
4040
clientToken: clientKey,
4141
apiKey: apikey,

Sources/Exporters/DatadogExporter/ExporterConfiguration.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ public struct ExporterConfiguration {
2323
/// The name of the service, resource, version,... that will be reported to the backend.
2424
var serviceName: String
2525
var resource: String
26-
var applicationName: String
27-
var applicationVersion: String
26+
var applicationName: String
27+
var version: String
2828
var environment: String
2929

3030
/// Either the RUM client token (which supports RUM, Logging and APM) or regular client token, only for Logging and APM.
@@ -51,7 +51,7 @@ public struct ExporterConfiguration {
5151
self.serviceName = serviceName
5252
self.resource = resource
5353
self.applicationName = applicationName
54-
self.applicationVersion = applicationVersion
54+
self.version = applicationVersion
5555
self.environment = environment
5656
self.clientToken = clientToken
5757
self.apiKey = apiKey

Sources/Exporters/DatadogExporter/Logs/LogEncoder.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ internal struct DDLog: Encodable {
8888
self.loggerName = attributes.removeValue(forKey: "loggerName")?.description ?? "logger"
8989
self.loggerVersion = "1.0" // loggerVersion
9090
self.threadName = attributes.removeValue(forKey: "threadName")?.description ?? "unkown"
91-
self.applicationVersion = configuration.applicationVersion
91+
self.applicationVersion = configuration.version
9292

9393
self.attributes = LogAttributes(userAttributes: event.attributes, internalAttributes: internalAttributes)
9494
self.tags = nil // tags

Sources/Exporters/DatadogExporter/Logs/LogsExporter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ internal class LogsExporter {
7777
.contentTypeHeader(contentType: .textPlainUTF8),
7878
.userAgentHeader(
7979
appName: configuration.applicationName,
80-
appVersion: configuration.applicationVersion,
80+
appVersion: configuration.version,
8181
device: Device.current
8282
)
8383
])

Sources/Exporters/DatadogExporter/Metrics/MetricsExporter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ internal class MetricsExporter {
6767
.contentTypeHeader(contentType: .textPlainUTF8),
6868
.userAgentHeader(
6969
appName: configuration.applicationName,
70-
appVersion: configuration.applicationVersion,
70+
appVersion: configuration.version,
7171
device: Device.current
7272
),
7373
])

Sources/Exporters/DatadogExporter/Spans/SpanEncoder.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ internal struct DDSpan: Encodable {
6262

6363
// MARK: - Meta
6464

65-
let tracerVersion: String
6665
let applicationVersion: String
6766

6867
/// Custom tags, received from user
@@ -107,8 +106,7 @@ internal struct DDSpan: Encodable {
107106
let spanType = spanData.attributes["type"] ?? spanData.attributes["db.type"]
108107
self.type = spanType?.description ?? spanData.kind.rawValue
109108

110-
self.tracerVersion = "1.0" // spanData.tracerVersion
111-
self.applicationVersion = "0.0.1" // spanData.applicationVersion
109+
self.applicationVersion = configuration.version
112110
self.tags = spanData.attributes.filter {
113111
!DDSpan.errorTagKeys.contains($0.key)
114112
}.mapValues { $0 }
@@ -144,7 +142,6 @@ internal struct SpanEncoder {
144142

145143
case source = "meta._dd.source"
146144
case applicationVersion = "meta.version"
147-
case tracerVersion = "meta.tracer.version"
148145
}
149146

150147
/// Coding keys for dynamic `Span` attributes specified by user.
@@ -201,7 +198,6 @@ internal struct SpanEncoder {
201198
private func encodeDefaultMeta(_ span: DDSpan, to container: inout KeyedEncodingContainer<StaticCodingKeys>) throws {
202199
// NOTE: RUMM-299 only string values are supported for `meta.*` attributes
203200
try container.encode(Constants.ddsource, forKey: .source)
204-
try container.encode(span.tracerVersion, forKey: .tracerVersion)
205201
try container.encode(span.applicationVersion, forKey: .applicationVersion)
206202
}
207203

Sources/Exporters/DatadogExporter/Spans/SpansExporter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ internal class SpansExporter {
6767
.contentTypeHeader(contentType: .textPlainUTF8),
6868
.userAgentHeader(
6969
appName: configuration.applicationName,
70-
appVersion: configuration.applicationVersion,
70+
appVersion: configuration.version,
7171
device: Device.current
7272
)
7373
])

0 commit comments

Comments
 (0)