Skip to content

Commit 0dcf007

Browse files
author
Ignacio Bonafonte
committed
Update OTLP protocol to lates 0.7.0 version: Only addition of Opentelemetry_Proto_Metrics_V1_DoubleSummary
1 parent 13c5810 commit 0dcf007

File tree

4 files changed

+247
-10
lines changed

4 files changed

+247
-10
lines changed

Sources/Exporters/OpenTelemetryProtocol/proto/common.pb.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ public struct Opentelemetry_Proto_Common_V1_InstrumentationLibrary {
213213
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
214214
// methods supported on all messages.
215215

216+
/// An empty instrumentation library name means the name is unknown.
216217
public var name: String = String()
217218

218219
public var version: String = String()

Sources/Exporters/OpenTelemetryProtocol/proto/logs.pb.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP
3737
public enum Opentelemetry_Proto_Logs_V1_SeverityNumber: SwiftProtobuf.Enum {
3838
public typealias RawValue = Int
3939

40-
/// UNSPECIFIED is the default SeverityNumber, it MUST not be used.
40+
/// UNSPECIFIED is the default SeverityNumber, it MUST NOT be used.
4141
case unspecified // = 0
4242
case trace // = 1
4343
case trace2 // = 2
@@ -216,7 +216,7 @@ public struct Opentelemetry_Proto_Logs_V1_ResourceLogs {
216216
// methods supported on all messages.
217217

218218
/// The resource for the logs in this message.
219-
/// If this field is not set then no resource info is known.
219+
/// If this field is not set then resource info is unknown.
220220
public var resource: Opentelemetry_Proto_Resource_V1_Resource {
221221
get {return _storage._resource ?? Opentelemetry_Proto_Resource_V1_Resource()}
222222
set {_uniqueStorage()._resource = newValue}
@@ -246,7 +246,8 @@ public struct Opentelemetry_Proto_Logs_V1_InstrumentationLibraryLogs {
246246
// methods supported on all messages.
247247

248248
/// The instrumentation library information for the logs in this message.
249-
/// If this field is not set then no library info is known.
249+
/// Semantically when InstrumentationLibrary isn't set, it is equivalent with
250+
/// an empty instrumentation library name (unknown).
250251
public var instrumentationLibrary: Opentelemetry_Proto_Common_V1_InstrumentationLibrary {
251252
get {return _storage._instrumentationLibrary ?? Opentelemetry_Proto_Common_V1_InstrumentationLibrary()}
252253
set {_uniqueStorage()._instrumentationLibrary = newValue}

Sources/Exporters/OpenTelemetryProtocol/proto/metrics.pb.swift

Lines changed: 240 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public enum Opentelemetry_Proto_Metrics_V1_AggregationTemporality: SwiftProtobuf
6868
/// t_0+2 with a value of 2.
6969
case delta // = 1
7070

71-
/// CUMULATIVE is an AggregationTemporality for a metic aggregator which
71+
/// CUMULATIVE is an AggregationTemporality for a metric aggregator which
7272
/// reports changes since a fixed start time. This means that current values
7373
/// of a CUMULATIVE metric depend on all previous measurements since the
7474
/// start time. Because of this, the sender is required to retain this state
@@ -180,7 +180,8 @@ public struct Opentelemetry_Proto_Metrics_V1_InstrumentationLibraryMetrics {
180180
// methods supported on all messages.
181181

182182
/// The instrumentation library information for the metrics in this message.
183-
/// If this field is not set then no library info is known.
183+
/// Semantically when InstrumentationLibrary isn't set, it is equivalent with
184+
/// an empty instrumentation library name (unknown).
184185
public var instrumentationLibrary: Opentelemetry_Proto_Common_V1_InstrumentationLibrary {
185186
get {return _storage._instrumentationLibrary ?? Opentelemetry_Proto_Common_V1_InstrumentationLibrary()}
186187
set {_uniqueStorage()._instrumentationLibrary = newValue}
@@ -220,11 +221,11 @@ public struct Opentelemetry_Proto_Metrics_V1_InstrumentationLibraryMetrics {
220221
/// +------------+
221222
/// |name |
222223
/// |description |
223-
/// |unit | +---------------------------+
224-
/// |data |---> |Gauge, Sum, Histogram, ... |
225-
/// +------------+ +---------------------------+
224+
/// |unit | +------------------------------------+
225+
/// |data |---> |Gauge, Sum, Histogram, Summary, ... |
226+
/// +------------+ +------------------------------------+
226227
///
227-
/// Data [One of Gauge, Sum, Histogram, ...]
228+
/// Data [One of Gauge, Sum, Histogram, Summary, ...]
228229
/// +-----------+
229230
/// |... | // Metadata about the Data.
230231
/// |points |--+
@@ -355,6 +356,14 @@ public struct Opentelemetry_Proto_Metrics_V1_Metric {
355356
set {_uniqueStorage()._data = .doubleHistogram(newValue)}
356357
}
357358

359+
public var doubleSummary: Opentelemetry_Proto_Metrics_V1_DoubleSummary {
360+
get {
361+
if case .doubleSummary(let v)? = _storage._data {return v}
362+
return Opentelemetry_Proto_Metrics_V1_DoubleSummary()
363+
}
364+
set {_uniqueStorage()._data = .doubleSummary(newValue)}
365+
}
366+
358367
public var unknownFields = SwiftProtobuf.UnknownStorage()
359368

360369
/// Data determines the aggregation type (if any) of the metric, what is the
@@ -381,6 +390,7 @@ public struct Opentelemetry_Proto_Metrics_V1_Metric {
381390
case doubleSum(Opentelemetry_Proto_Metrics_V1_DoubleSum)
382391
case intHistogram(Opentelemetry_Proto_Metrics_V1_IntHistogram)
383392
case doubleHistogram(Opentelemetry_Proto_Metrics_V1_DoubleHistogram)
393+
case doubleSummary(Opentelemetry_Proto_Metrics_V1_DoubleSummary)
384394

385395
#if !swift(>=4.1)
386396
public static func ==(lhs: Opentelemetry_Proto_Metrics_V1_Metric.OneOf_Data, rhs: Opentelemetry_Proto_Metrics_V1_Metric.OneOf_Data) -> Bool {
@@ -391,6 +401,7 @@ public struct Opentelemetry_Proto_Metrics_V1_Metric {
391401
case (.doubleSum(let l), .doubleSum(let r)): return l == r
392402
case (.intHistogram(let l), .intHistogram(let r)): return l == r
393403
case (.doubleHistogram(let l), .doubleHistogram(let r)): return l == r
404+
case (.doubleSummary(let l), .doubleSummary(let r)): return l == r
394405
default: return false
395406
}
396407
}
@@ -522,6 +533,24 @@ public struct Opentelemetry_Proto_Metrics_V1_DoubleHistogram {
522533
public init() {}
523534
}
524535

536+
/// DoubleSummary metric data are used to convey quantile summaries,
537+
/// a Prometheus (see: https://prometheus.io/docs/concepts/metric_types/#summary)
538+
/// and OpenMetrics (see: https://github.com/OpenObservability/OpenMetrics/blob/4dbf6075567ab43296eed941037c12951faafb92/protos/prometheus.proto#L45)
539+
/// data type. These data points cannot always be merged in a meaningful way.
540+
/// While they can be useful in some applications, histogram data points are
541+
/// recommended for new applications.
542+
public struct Opentelemetry_Proto_Metrics_V1_DoubleSummary {
543+
// SwiftProtobuf.Message conformance is added in an extension below. See the
544+
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
545+
// methods supported on all messages.
546+
547+
public var dataPoints: [Opentelemetry_Proto_Metrics_V1_DoubleSummaryDataPoint] = []
548+
549+
public var unknownFields = SwiftProtobuf.UnknownStorage()
550+
551+
public init() {}
552+
}
553+
525554
/// IntDataPoint is a single data point in a timeseries that describes the
526555
/// time-varying values of a int64 metric.
527556
public struct Opentelemetry_Proto_Metrics_V1_IntDataPoint {
@@ -758,6 +787,77 @@ public struct Opentelemetry_Proto_Metrics_V1_DoubleHistogramDataPoint {
758787
public init() {}
759788
}
760789

790+
/// DoubleSummaryDataPoint is a single data point in a timeseries that describes the
791+
/// time-varying values of a Summary metric.
792+
public struct Opentelemetry_Proto_Metrics_V1_DoubleSummaryDataPoint {
793+
// SwiftProtobuf.Message conformance is added in an extension below. See the
794+
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
795+
// methods supported on all messages.
796+
797+
/// The set of labels that uniquely identify this timeseries.
798+
public var labels: [Opentelemetry_Proto_Common_V1_StringKeyValue] = []
799+
800+
/// start_time_unix_nano is the last time when the aggregation value was reset
801+
/// to "zero". For some metric types this is ignored, see data types for more
802+
/// details.
803+
///
804+
/// The aggregation value is over the time interval (start_time_unix_nano,
805+
/// time_unix_nano].
806+
///
807+
/// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
808+
/// 1970.
809+
///
810+
/// Value of 0 indicates that the timestamp is unspecified. In that case the
811+
/// timestamp may be decided by the backend.
812+
public var startTimeUnixNano: UInt64 = 0
813+
814+
/// time_unix_nano is the moment when this aggregation value was reported.
815+
///
816+
/// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
817+
/// 1970.
818+
public var timeUnixNano: UInt64 = 0
819+
820+
/// count is the number of values in the population. Must be non-negative.
821+
public var count: UInt64 = 0
822+
823+
/// sum of the values in the population. If count is zero then this field
824+
/// must be zero.
825+
public var sum: Double = 0
826+
827+
/// (Optional) list of values at different quantiles of the distribution calculated
828+
/// from the current snapshot. The quantiles must be strictly increasing.
829+
public var quantileValues: [Opentelemetry_Proto_Metrics_V1_DoubleSummaryDataPoint.ValueAtQuantile] = []
830+
831+
public var unknownFields = SwiftProtobuf.UnknownStorage()
832+
833+
/// Represents the value at a given quantile of a distribution.
834+
///
835+
/// To record Min and Max values following conventions are used:
836+
/// - The 1.0 quantile is equivalent to the maximum value observed.
837+
/// - The 0.0 quantile is equivalent to the minimum value observed.
838+
///
839+
/// See the following issue for more context:
840+
/// https://github.com/open-telemetry/opentelemetry-proto/issues/125
841+
public struct ValueAtQuantile {
842+
// SwiftProtobuf.Message conformance is added in an extension below. See the
843+
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
844+
// methods supported on all messages.
845+
846+
/// The quantile of a distribution. Must be in the interval
847+
/// [0.0, 1.0].
848+
public var quantile: Double = 0
849+
850+
/// The value at the given quantile of a distribution.
851+
public var value: Double = 0
852+
853+
public var unknownFields = SwiftProtobuf.UnknownStorage()
854+
855+
public init() {}
856+
}
857+
858+
public init() {}
859+
}
860+
761861
/// A representation of an exemplar, which is a sample input int measurement.
762862
/// Exemplars also hold information about the environment when the measurement
763863
/// was recorded, for example the span and trace ID of the active span when the
@@ -996,6 +1096,7 @@ extension Opentelemetry_Proto_Metrics_V1_Metric: SwiftProtobuf.Message, SwiftPro
9961096
7: .standard(proto: "double_sum"),
9971097
8: .standard(proto: "int_histogram"),
9981098
9: .standard(proto: "double_histogram"),
1099+
11: .standard(proto: "double_summary"),
9991100
]
10001101

10011102
fileprivate class _StorageClass {
@@ -1079,6 +1180,14 @@ extension Opentelemetry_Proto_Metrics_V1_Metric: SwiftProtobuf.Message, SwiftPro
10791180
}
10801181
try decoder.decodeSingularMessageField(value: &v)
10811182
if let v = v {_storage._data = .doubleHistogram(v)}
1183+
case 11:
1184+
var v: Opentelemetry_Proto_Metrics_V1_DoubleSummary?
1185+
if let current = _storage._data {
1186+
try decoder.handleConflictingOneOf()
1187+
if case .doubleSummary(let m) = current {v = m}
1188+
}
1189+
try decoder.decodeSingularMessageField(value: &v)
1190+
if let v = v {_storage._data = .doubleSummary(v)}
10821191
default: break
10831192
}
10841193
}
@@ -1109,6 +1218,8 @@ extension Opentelemetry_Proto_Metrics_V1_Metric: SwiftProtobuf.Message, SwiftPro
11091218
try visitor.visitSingularMessageField(value: v, fieldNumber: 8)
11101219
case .doubleHistogram(let v)?:
11111220
try visitor.visitSingularMessageField(value: v, fieldNumber: 9)
1221+
case .doubleSummary(let v)?:
1222+
try visitor.visitSingularMessageField(value: v, fieldNumber: 11)
11121223
case nil: break
11131224
}
11141225
}
@@ -1343,6 +1454,35 @@ extension Opentelemetry_Proto_Metrics_V1_DoubleHistogram: SwiftProtobuf.Message,
13431454
}
13441455
}
13451456

1457+
extension Opentelemetry_Proto_Metrics_V1_DoubleSummary: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
1458+
public static let protoMessageName: String = _protobuf_package + ".DoubleSummary"
1459+
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1460+
1: .standard(proto: "data_points"),
1461+
]
1462+
1463+
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
1464+
while let fieldNumber = try decoder.nextFieldNumber() {
1465+
switch fieldNumber {
1466+
case 1: try decoder.decodeRepeatedMessageField(value: &self.dataPoints)
1467+
default: break
1468+
}
1469+
}
1470+
}
1471+
1472+
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
1473+
if !self.dataPoints.isEmpty {
1474+
try visitor.visitRepeatedMessageField(value: self.dataPoints, fieldNumber: 1)
1475+
}
1476+
try unknownFields.traverse(visitor: &visitor)
1477+
}
1478+
1479+
public static func ==(lhs: Opentelemetry_Proto_Metrics_V1_DoubleSummary, rhs: Opentelemetry_Proto_Metrics_V1_DoubleSummary) -> Bool {
1480+
if lhs.dataPoints != rhs.dataPoints {return false}
1481+
if lhs.unknownFields != rhs.unknownFields {return false}
1482+
return true
1483+
}
1484+
}
1485+
13461486
extension Opentelemetry_Proto_Metrics_V1_IntDataPoint: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
13471487
public static let protoMessageName: String = _protobuf_package + ".IntDataPoint"
13481488
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
@@ -1591,6 +1731,100 @@ extension Opentelemetry_Proto_Metrics_V1_DoubleHistogramDataPoint: SwiftProtobuf
15911731
}
15921732
}
15931733

1734+
extension Opentelemetry_Proto_Metrics_V1_DoubleSummaryDataPoint: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
1735+
public static let protoMessageName: String = _protobuf_package + ".DoubleSummaryDataPoint"
1736+
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1737+
1: .same(proto: "labels"),
1738+
2: .standard(proto: "start_time_unix_nano"),
1739+
3: .standard(proto: "time_unix_nano"),
1740+
4: .same(proto: "count"),
1741+
5: .same(proto: "sum"),
1742+
6: .standard(proto: "quantile_values"),
1743+
]
1744+
1745+
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
1746+
while let fieldNumber = try decoder.nextFieldNumber() {
1747+
switch fieldNumber {
1748+
case 1: try decoder.decodeRepeatedMessageField(value: &self.labels)
1749+
case 2: try decoder.decodeSingularFixed64Field(value: &self.startTimeUnixNano)
1750+
case 3: try decoder.decodeSingularFixed64Field(value: &self.timeUnixNano)
1751+
case 4: try decoder.decodeSingularFixed64Field(value: &self.count)
1752+
case 5: try decoder.decodeSingularDoubleField(value: &self.sum)
1753+
case 6: try decoder.decodeRepeatedMessageField(value: &self.quantileValues)
1754+
default: break
1755+
}
1756+
}
1757+
}
1758+
1759+
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
1760+
if !self.labels.isEmpty {
1761+
try visitor.visitRepeatedMessageField(value: self.labels, fieldNumber: 1)
1762+
}
1763+
if self.startTimeUnixNano != 0 {
1764+
try visitor.visitSingularFixed64Field(value: self.startTimeUnixNano, fieldNumber: 2)
1765+
}
1766+
if self.timeUnixNano != 0 {
1767+
try visitor.visitSingularFixed64Field(value: self.timeUnixNano, fieldNumber: 3)
1768+
}
1769+
if self.count != 0 {
1770+
try visitor.visitSingularFixed64Field(value: self.count, fieldNumber: 4)
1771+
}
1772+
if self.sum != 0 {
1773+
try visitor.visitSingularDoubleField(value: self.sum, fieldNumber: 5)
1774+
}
1775+
if !self.quantileValues.isEmpty {
1776+
try visitor.visitRepeatedMessageField(value: self.quantileValues, fieldNumber: 6)
1777+
}
1778+
try unknownFields.traverse(visitor: &visitor)
1779+
}
1780+
1781+
public static func ==(lhs: Opentelemetry_Proto_Metrics_V1_DoubleSummaryDataPoint, rhs: Opentelemetry_Proto_Metrics_V1_DoubleSummaryDataPoint) -> Bool {
1782+
if lhs.labels != rhs.labels {return false}
1783+
if lhs.startTimeUnixNano != rhs.startTimeUnixNano {return false}
1784+
if lhs.timeUnixNano != rhs.timeUnixNano {return false}
1785+
if lhs.count != rhs.count {return false}
1786+
if lhs.sum != rhs.sum {return false}
1787+
if lhs.quantileValues != rhs.quantileValues {return false}
1788+
if lhs.unknownFields != rhs.unknownFields {return false}
1789+
return true
1790+
}
1791+
}
1792+
1793+
extension Opentelemetry_Proto_Metrics_V1_DoubleSummaryDataPoint.ValueAtQuantile: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
1794+
public static let protoMessageName: String = Opentelemetry_Proto_Metrics_V1_DoubleSummaryDataPoint.protoMessageName + ".ValueAtQuantile"
1795+
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1796+
1: .same(proto: "quantile"),
1797+
2: .same(proto: "value"),
1798+
]
1799+
1800+
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
1801+
while let fieldNumber = try decoder.nextFieldNumber() {
1802+
switch fieldNumber {
1803+
case 1: try decoder.decodeSingularDoubleField(value: &self.quantile)
1804+
case 2: try decoder.decodeSingularDoubleField(value: &self.value)
1805+
default: break
1806+
}
1807+
}
1808+
}
1809+
1810+
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
1811+
if self.quantile != 0 {
1812+
try visitor.visitSingularDoubleField(value: self.quantile, fieldNumber: 1)
1813+
}
1814+
if self.value != 0 {
1815+
try visitor.visitSingularDoubleField(value: self.value, fieldNumber: 2)
1816+
}
1817+
try unknownFields.traverse(visitor: &visitor)
1818+
}
1819+
1820+
public static func ==(lhs: Opentelemetry_Proto_Metrics_V1_DoubleSummaryDataPoint.ValueAtQuantile, rhs: Opentelemetry_Proto_Metrics_V1_DoubleSummaryDataPoint.ValueAtQuantile) -> Bool {
1821+
if lhs.quantile != rhs.quantile {return false}
1822+
if lhs.value != rhs.value {return false}
1823+
if lhs.unknownFields != rhs.unknownFields {return false}
1824+
return true
1825+
}
1826+
}
1827+
15941828
extension Opentelemetry_Proto_Metrics_V1_IntExemplar: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
15951829
public static let protoMessageName: String = _protobuf_package + ".IntExemplar"
15961830
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [

Sources/Exporters/OpenTelemetryProtocol/proto/trace.pb.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ public struct Opentelemetry_Proto_Trace_V1_InstrumentationLibrarySpans {
7070
// methods supported on all messages.
7171

7272
/// The instrumentation library information for the spans in this message.
73-
/// If this field is not set then no library info is known.
73+
/// Semantically when InstrumentationLibrary isn't set, it is equivalent with
74+
/// an empty instrumentation library name (unknown).
7475
public var instrumentationLibrary: Opentelemetry_Proto_Common_V1_InstrumentationLibrary {
7576
get {return _storage._instrumentationLibrary ?? Opentelemetry_Proto_Common_V1_InstrumentationLibrary()}
7677
set {_uniqueStorage()._instrumentationLibrary = newValue}

0 commit comments

Comments
 (0)