Skip to content

Commit 57f5ea5

Browse files
authored
update skywalking protocol v8.4.0 (#59)
1 parent cbab740 commit 57f5ea5

13 files changed

+58
-50
lines changed

bazel/repositories.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ def cpp2sky_dependencies():
1111
def skywalking_data_collect_protocol():
1212
http_archive(
1313
name = "skywalking_data_collect_protocol",
14-
sha256 = "8158e095b9b37c39e18938fe08bd4fca6f2b8e16763ff21fe8118d79241a6e0b",
15-
urls = ["https://github.com/apache/skywalking-data-collect-protocol/archive/v8.3.0.tar.gz"],
16-
strip_prefix = "skywalking-data-collect-protocol-8.3.0",
14+
sha256 = "edfa970394511213eacc8055b4c13e4e9773e9196122a49e0db68f6162f67dff",
15+
urls = ["https://github.com/apache/skywalking-data-collect-protocol/archive/v8.4.0.tar.gz"],
16+
strip_prefix = "skywalking-data-collect-protocol-8.4.0",
1717
)
1818

1919
def com_github_grpc_grpc():

cpp2sky/tracing_context.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class TracingSpan {
3333
/**
3434
* Generate Apache SkyWalking native span object from current segment span.
3535
*/
36-
virtual SpanObject createSpanObject() = 0;
36+
virtual skywalking::v3::SpanObject createSpanObject() = 0;
3737

3838
/**
3939
* Get span ID.
@@ -63,12 +63,12 @@ class TracingSpan {
6363
/**
6464
* Get span type.
6565
*/
66-
virtual SpanType spanType() const = 0;
66+
virtual skywalking::v3::SpanType spanType() const = 0;
6767

6868
/**
6969
* Get span layer.
7070
*/
71-
virtual SpanLayer spanLayer() const = 0;
71+
virtual skywalking::v3::SpanLayer spanLayer() const = 0;
7272

7373
/**
7474
* Get error occurred or not.
@@ -94,7 +94,7 @@ class TracingSpan {
9494
/**
9595
* Get logs.
9696
*/
97-
virtual const std::vector<Log>& logs() const = 0;
97+
virtual const std::vector<skywalking::v3::Log>& logs() const = 0;
9898

9999
/**
100100
* Get operation name.
@@ -137,12 +137,12 @@ class TracingSpan {
137137
* have parent span, like root node of span tree. Exit span has opposite
138138
* meaning, like leaf node of span tree.
139139
*/
140-
virtual void setSpanType(SpanType type) = 0;
140+
virtual void setSpanType(skywalking::v3::SpanType type) = 0;
141141

142142
/**
143143
* Set span layer. It supports only HTTP request tracing currently.
144144
*/
145-
virtual void setSpanLayer(SpanLayer layer) = 0;
145+
virtual void setSpanLayer(skywalking::v3::SpanLayer layer) = 0;
146146

147147
/**
148148
* If error had caused on this span, This should be called.
@@ -248,7 +248,7 @@ class TracingContext {
248248
/**
249249
* Generate Apache SkyWalking native segment object.
250250
*/
251-
virtual SegmentObject createSegmentObject() = 0;
251+
virtual skywalking::v3::SegmentObject createSegmentObject() = 0;
252252

253253
/**
254254
* If called, all spans belongs to this segment will be skipped analysis.

docker-compose.dev.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ services:
2121
soft: -1
2222
hard: -1
2323
oap:
24-
image: apache/skywalking-oap-server:8.1.0-es7
24+
image: apache/skywalking-oap-server:8.4.0-es7
2525
depends_on:
2626
- elasticsearch
2727
links:
@@ -43,7 +43,7 @@ services:
4343
retries: 3
4444
start_period: 40s
4545
ui:
46-
image: apache/skywalking-ui:8.1.0
46+
image: apache/skywalking-ui:8.4.0
4747
depends_on:
4848
- oap
4949
links:

e2e-docker/Dockerfile.tool

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM openjdk:8
22

33
WORKDIR /tests
44

5-
ARG COMMIT_HASH=8a48c49b4420df5c9576d2aea178b2ebcb7ecd09
5+
ARG COMMIT_HASH=8db606f3470cce75c1b013ae498ac93b862b75b7
66

77
ADD https://github.com/apache/skywalking-agent-test-tool/archive/${COMMIT_HASH}.tar.gz .
88

requirements.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
asgiref==3.2.10
22
aiofiles==0.6.0
3+
aiohttp==3.7.3
34
attrs==19.3.0
45
blindspin==2.0.1
56
certifi==2020.6.20
@@ -37,10 +38,12 @@ py==1.9.0
3738
pymongo==3.11.0
3839
PyMySQL==0.10.0
3940
pyparsing==2.4.7
41+
pyramid==1.10.5
4042
pytest==6.0.1
4143
pytz==2020.1
4244
PyYAML==5.3.1
4345
redis==3.5.3
46+
requests==2.24.0
4447
rfc3986==1.4.0
4548
sanic==20.9.1
4649
six==1.15.0
@@ -57,5 +60,4 @@ wrapt==1.12.1
5760
zipp==3.1.0
5861
zope.event==4.4
5962
zope.interface==5.1.0
60-
apache-skywalking==0.4.0
61-
zope.interface==5.1.0
63+
apache-skywalking==0.5.0

source/grpc_async_client_impl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void* toTag(TaggedStream* stream) { return reinterpret_cast<void*>(stream); }
3030
TaggedStream* deTag(void* stream) { return static_cast<TaggedStream*>(stream); }
3131

3232
TracerStubImpl::TracerStubImpl(std::shared_ptr<grpc::Channel> channel)
33-
: stub_(TraceSegmentReportService::NewStub(channel)) {}
33+
: stub_(skywalking::v3::TraceSegmentReportService::NewStub(channel)) {}
3434

3535
std::unique_ptr<grpc::ClientAsyncWriter<TracerRequestType>>
3636
TracerStubImpl::createWriter(grpc::ClientContext* ctx,

source/grpc_async_client_impl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434

3535
namespace cpp2sky {
3636

37-
using TracerRequestType = SegmentObject;
38-
using TracerResponseType = Commands;
37+
using TracerRequestType = skywalking::v3::SegmentObject;
38+
using TracerResponseType = skywalking::v3::Commands;
3939

4040
class TracerStubImpl final
4141
: public TracerStub<TracerRequestType, TracerResponseType> {
@@ -48,7 +48,7 @@ class TracerStubImpl final
4848
grpc::CompletionQueue* cq, void* tag) override;
4949

5050
private:
51-
std::unique_ptr<TraceSegmentReportService::Stub> stub_;
51+
std::unique_ptr<skywalking::v3::TraceSegmentReportService::Stub> stub_;
5252
};
5353

5454
class GrpcAsyncSegmentReporterStream;

source/tracer_impl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323
namespace cpp2sky {
2424

25-
using TracerRequestType = SegmentObject;
26-
using TracerResponseType = Commands;
25+
using TracerRequestType = skywalking::v3::SegmentObject;
26+
using TracerResponseType = skywalking::v3::Commands;
2727

2828
class TracerImpl : public Tracer {
2929
public:

source/tracing_context_impl.cc

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ TracingSpanImpl::TracingSpanImpl(int32_t span_id,
2828
TracingContext& parent_tracing_context)
2929
: span_id_(span_id), parent_tracing_context_(parent_tracing_context) {}
3030

31-
SpanObject TracingSpanImpl::createSpanObject() {
32-
SpanObject obj;
31+
skywalking::v3::SpanObject TracingSpanImpl::createSpanObject() {
32+
skywalking::v3::SpanObject obj;
3333

3434
obj.set_spanid(span_id_);
3535
obj.set_parentspanid(parent_span_id_);
@@ -49,7 +49,7 @@ SpanObject TracingSpanImpl::createSpanObject() {
4949
auto* entry = obj.mutable_refs()->Add();
5050
// TODO(shikugawa): cpp2sky only supports cross process propagation right
5151
// now. So It is correct to specify this.
52-
entry->set_reftype(RefType::CrossProcess);
52+
entry->set_reftype(skywalking::v3::RefType::CrossProcess);
5353
entry->set_traceid(parent_span->traceId());
5454
entry->set_parenttracesegmentid(parent_span->traceSegmentId());
5555
entry->set_parentservice(parent_span->service());
@@ -82,7 +82,7 @@ void TracingSpanImpl::addLog(std::string key, std::string value) {
8282
void TracingSpanImpl::addLog(std::string key, std::string value,
8383
TimePoint<SystemTime> current_time) {
8484
assert(!finished_);
85-
Log l;
85+
skywalking::v3::Log l;
8686
l.set_time(current_time.fetch());
8787
auto* entry = l.add_data();
8888
entry->set_key(key);
@@ -93,7 +93,7 @@ void TracingSpanImpl::addLog(std::string key, std::string value,
9393
void TracingSpanImpl::addLog(std::string key, std::string value,
9494
TimePoint<SteadyTime> current_time) {
9595
assert(!finished_);
96-
Log l;
96+
skywalking::v3::Log l;
9797
l.set_time(current_time.fetch());
9898
auto* entry = l.add_data();
9999
entry->set_key(key);
@@ -175,7 +175,7 @@ TracingContextImpl::TracingContextImpl(const std::string& service_name,
175175
TracingSpanPtr TracingContextImpl::createExitSpan(TracingSpanPtr parent_span) {
176176
auto current_span = createSpan();
177177
current_span->setParentSpanId(parent_span->spanId());
178-
current_span->setSpanType(SpanType::Exit);
178+
current_span->setSpanType(skywalking::v3::SpanType::Exit);
179179
return current_span;
180180
}
181181

@@ -186,7 +186,7 @@ TracingSpanPtr TracingContextImpl::createEntrySpan() {
186186

187187
auto current_span = createSpan();
188188
current_span->setParentSpanId(-1);
189-
current_span->setSpanType(SpanType::Entry);
189+
current_span->setSpanType(skywalking::v3::SpanType::Entry);
190190
return current_span;
191191
}
192192

@@ -201,7 +201,7 @@ std::optional<std::string> TracingContextImpl::createSW8HeaderValue(
201201
}
202202
target_span = spans_.back();
203203
}
204-
if (target_span->spanType() != SpanType::Exit) {
204+
if (target_span->spanType() != skywalking::v3::SpanType::Exit) {
205205
return std::nullopt;
206206
}
207207
return encodeSpan(target_span, target_address);
@@ -232,7 +232,7 @@ TracingSpanPtr TracingContextImpl::createSpan() {
232232
auto current_span = std::make_shared<TracingSpanImpl>(spans_.size(), *this);
233233

234234
// It supports only HTTP request tracing.
235-
current_span->setSpanLayer(SpanLayer::Http);
235+
current_span->setSpanLayer(skywalking::v3::SpanLayer::Http);
236236
if (should_skip_analysis_) {
237237
current_span->setSkipAnalysis();
238238
}
@@ -241,8 +241,9 @@ TracingSpanPtr TracingContextImpl::createSpan() {
241241
return current_span;
242242
}
243243

244-
SegmentObject TracingContextImpl::createSegmentObject() {
245-
SegmentObject obj;
244+
skywalking::v3::SegmentObject TracingContextImpl::createSegmentObject() {
245+
skywalking::v3::SegmentObject obj;
246+
246247
obj.set_traceid(trace_id_);
247248
obj.set_tracesegmentid(trace_segment_id_);
248249
obj.set_service(service_);

source/tracing_context_impl.h

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,26 @@ class TracingSpanImpl : public TracingSpan {
2525
public:
2626
TracingSpanImpl(int32_t span_id, TracingContext& parent_tracing_context);
2727

28-
SpanObject createSpanObject() override;
28+
skywalking::v3::SpanObject createSpanObject() override;
2929

3030
#pragma region Getters
3131
int32_t spanId() const override { return span_id_; }
3232
int32_t parentSpanId() const override { return parent_span_id_; }
3333
int64_t startTime() const override { return start_time_; }
3434
int64_t endTime() const override { return end_time_; }
3535
const std::string& peer() const override { return peer_; }
36-
SpanType spanType() const override { return type_; }
37-
SpanLayer spanLayer() const override { return layer_; }
36+
skywalking::v3::SpanType spanType() const override { return type_; }
37+
skywalking::v3::SpanLayer spanLayer() const override { return layer_; }
3838
bool errorStatus() const override { return is_error_; }
3939
bool skipAnalysis() const override { return skip_analysis_; }
4040
int32_t componentId() const override { return component_id_; }
4141
const std::vector<std::pair<std::string, std::string>>& tags()
4242
const override {
4343
return tags_;
4444
}
45-
const std::vector<Log>& logs() const override { return logs_; }
45+
const std::vector<skywalking::v3::Log>& logs() const override {
46+
return logs_;
47+
}
4648
bool finished() const override { return finished_; }
4749
std::string operationName() const override { return operation_name_; }
4850
#pragma endregion
@@ -68,8 +70,10 @@ class TracingSpanImpl : public TracingSpan {
6870
assert(!finished_);
6971
peer_ = std::move(remote_address);
7072
}
71-
void setSpanType(SpanType type) override { type_ = type; }
72-
void setSpanLayer(SpanLayer layer) override { layer_ = layer; }
73+
void setSpanType(skywalking::v3::SpanType type) override { type_ = type; }
74+
void setSpanLayer(skywalking::v3::SpanLayer layer) override {
75+
layer_ = layer;
76+
}
7377
void setErrorStatus() override { is_error_ = true; }
7478
void setSkipAnalysis() override { skip_analysis_ = true; }
7579
void addTag(std::string key, std::string value) override {
@@ -93,15 +97,15 @@ class TracingSpanImpl : public TracingSpan {
9397
int64_t end_time_ = 0;
9498
std::string operation_name_;
9599
std::string peer_;
96-
SpanType type_;
97-
SpanLayer layer_;
100+
skywalking::v3::SpanType type_;
101+
skywalking::v3::SpanLayer layer_;
98102
// ComponentId is predefined by SkyWalking OAP. The range of id is 9000~9999
99103
// on C++ language SDK. Based on
100104
// https://github.com/apache/skywalking/blob/master/docs/en/guides/Component-library-settings.md
101105
int32_t component_id_ = 9000;
102106
bool is_error_ = false;
103107
std::vector<std::pair<std::string, std::string>> tags_;
104-
std::vector<Log> logs_;
108+
std::vector<skywalking::v3::Log> logs_;
105109
bool skip_analysis_ = false;
106110
bool finished_ = false;
107111

@@ -151,7 +155,7 @@ class TracingContextImpl : public TracingContext {
151155
std::optional<std::string> createSW8HeaderValue(
152156
TracingSpanPtr parent_span,
153157
const std::string_view target_address) override;
154-
SegmentObject createSegmentObject() override;
158+
skywalking::v3::SegmentObject createSegmentObject() override;
155159
void setSkipAnalysis() override { should_skip_analysis_ = true; }
156160
bool skipAnalysis() override { return should_skip_analysis_; }
157161
bool readyToSend() override;

0 commit comments

Comments
 (0)