Skip to content

Commit 1afde3f

Browse files
committed
Added OpenTelementryProtocol/metric/
and stubbed MetricsAdapter & OtelpMetricExporter
1 parent 85e8933 commit 1afde3f

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2020, OpenTelemetry Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
import Foundation
16+
import OpenTelemetryApi
17+
import OpenTelemetrySdk
18+
19+
20+
struct MetricsAdapter {
21+
static func toProtoResourceMetrics(metricDataList: [MetricData]) -> [Opentelemetry_Proto_Metrics_V1_ResourceMetrics] {
22+
return [Opentelemetry_Proto_Metrics_V1_ResourceMetrics()]
23+
}
24+
25+
private static func groupByLibrary(metricDataList: [MetricData]) -> [InstrumentationLibraryInfo : Opentelemetry_Proto_Metrics_V1_ResourceMetrics] {
26+
return results
27+
}
28+
29+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright 2020, OpenTelemetry Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
16+
import Foundation
17+
import GRPC
18+
import OpenTelemetryApi
19+
import OpenTelemetrySdk
20+
21+
public class OtelpMetricExporter : MetricExporter {
22+
23+
let channel : GRPCChannel
24+
let metricClient: Opentelemetry_Proto_Collector_Metrics_V1_MetricsServiceClient
25+
let deadlineMS : Int
26+
27+
public init(channel: GRPCChannel, timeoutMS: Int) {
28+
self.channel = channel
29+
self.deadlineMS = timeoutMS
30+
self.metricClient = Opentelemetry_Proto_Collector_Metrics_V1_MetricsServiceClient(channel: self.channel)
31+
}
32+
33+
34+
public func export(metrics: [Metric], shouldCancel: (() -> Bool)?) -> MetricExporterResultCode {
35+
return .success
36+
}
37+
38+
39+
40+
41+
}

0 commit comments

Comments
 (0)