-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
32fbd35
commit 02dc53c
Showing
17 changed files
with
485 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Submodule protocol
updated
4 files
+1 −1 | .github/workflows/ci.yaml | |
+359 −0 | ebpf/accesslog.proto | |
+3 −3 | ebpf/profiling/Continuous.proto | |
+5 −0 | language-agent/JVMMetric.proto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
from skywalking import Layer, Component | ||
from skywalking.trace.carrier import Carrier | ||
from skywalking.trace.context import get_context | ||
from skywalking.trace.tags import TagMqTopic, TagMqBroker | ||
|
||
link_vector = ['https://github.com/apache/pulsar-client-python'] | ||
support_matrix = { | ||
'pulsar-client': { | ||
'>=3.8': ['3.3.0'] | ||
} | ||
} | ||
note = """""" | ||
|
||
|
||
def install(): | ||
from pulsar import Producer | ||
from pulsar import Consumer | ||
from pulsar import Client | ||
|
||
__init = Client.__init__ | ||
_send = Producer.send | ||
_receive = Consumer.receive | ||
_peer = '' | ||
|
||
def get_peer(): | ||
return _peer | ||
|
||
def set_peer(value): | ||
nonlocal _peer | ||
_peer = value | ||
|
||
def _sw_init(self, service_url): | ||
__init(self, service_url) | ||
set_peer(service_url) | ||
|
||
def _sw_send_func(_send): | ||
def _sw_send(this, content, | ||
properties=None, | ||
partition_key=None, | ||
sequence_id=None, | ||
replication_clusters=None, | ||
disable_replication=False, | ||
event_timestamp=None, | ||
deliver_at=None, | ||
deliver_after=None, | ||
): | ||
topic = this._producer.topic().split('/')[-1] | ||
with get_context().new_exit_span(op=f'Pulsar/Topic/{topic}/Producer', peer=get_peer(), | ||
component=Component.PulsarProducer) as span: | ||
span.tag(TagMqTopic(topic)) | ||
span.tag(TagMqBroker(get_peer())) | ||
span.layer = Layer.MQ | ||
|
||
carrier = span.inject() | ||
if properties is None: | ||
properties = {} | ||
for item in carrier: | ||
properties[item.key] = item.val | ||
|
||
return _send(this, content, properties=properties, partition_key=partition_key, | ||
sequence_id=sequence_id, replication_clusters=replication_clusters, | ||
disable_replication=disable_replication, event_timestamp=event_timestamp, | ||
deliver_at=deliver_at, deliver_after=deliver_after) | ||
|
||
return _sw_send | ||
|
||
def _sw_receive_func(_receive): | ||
def _sw_receive(this, timeout_millis=None): | ||
res = _receive(this, timeout_millis=timeout_millis) | ||
if res: | ||
topic = res.topic_name().split('/')[-1] | ||
properties = res.properties() | ||
carrier = Carrier() | ||
for item in carrier: | ||
if item.key in properties.keys(): | ||
val = res.properties().get(item.key) | ||
if val is not None: | ||
item.val = val | ||
|
||
with get_context().new_entry_span(op=f'Pulsar/Topic/{topic}/Consumer', carrier=carrier) as span: | ||
span.tag(TagMqTopic(topic)) | ||
span.tag(TagMqBroker(get_peer())) | ||
span.layer = Layer.MQ | ||
span.component = Component.PulsarConsumer | ||
return res | ||
|
||
return _sw_receive | ||
|
||
Client.__init__ = _sw_init | ||
Producer.send = _sw_send_func(_send) | ||
Consumer.receive = _sw_receive_func(_receive) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
version: '2.1' | ||
|
||
services: | ||
collector: | ||
extends: | ||
service: collector | ||
file: ../../docker-compose.base.yml | ||
|
||
pulsar-server: | ||
image: apachepulsar/pulsar:3.2.0 | ||
hostname: pulsar-server | ||
ports: | ||
- 6650:6650 | ||
- 8080:8080 | ||
networks: | ||
- beyond | ||
command: ["bash","-c", "bin/pulsar standalone"] | ||
healthcheck: | ||
test: ["CMD", "nc", "-nz", "127.0.0.1", "8080"] | ||
interval: 5s | ||
timeout: 60s | ||
retries: 120 | ||
|
||
producer: | ||
extends: | ||
service: agent | ||
file: ../../docker-compose.base.yml | ||
ports: | ||
- 9090:9090 | ||
volumes: | ||
- .:/app | ||
command: ['bash', '-c', 'pip install flask && pip install -r /app/requirements.txt && sw-python run python3 /app/services/producer.py'] | ||
healthcheck: | ||
test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/9090"] | ||
interval: 5s | ||
timeout: 60s | ||
retries: 120 | ||
depends_on: | ||
collector: | ||
condition: service_healthy | ||
pulsar-server: | ||
condition: service_healthy | ||
consumer: | ||
condition: service_healthy | ||
environment: | ||
SW_AGENT_NAME: producer | ||
SW_AGENT_LOGGING_LEVEL: INFO | ||
|
||
consumer: | ||
extends: | ||
service: agent | ||
file: ../../docker-compose.base.yml | ||
ports: | ||
- 9091:9091 | ||
volumes: | ||
- .:/app | ||
command: ['bash', '-c', 'pip install flask && pip install -r /app/requirements.txt && sw-python run python3 /app/services/consumer.py'] | ||
healthcheck: | ||
test: ["CMD", "bash", "-c", "ps -ef | grep /app/services/consumer | grep -v grep"] | ||
interval: 5s | ||
timeout: 60s | ||
retries: 120 | ||
depends_on: | ||
collector: | ||
condition: service_healthy | ||
pulsar-server: | ||
condition: service_healthy | ||
environment: | ||
SW_AGENT_NAME: consumer | ||
SW_AGENT_LOGGING_LEVEL: INFO | ||
|
||
networks: | ||
beyond: |
Oops, something went wrong.