Skip to content

Commit e794271

Browse files
committed
fix tls bugs
1 parent d2b51a7 commit e794271

File tree

4 files changed

+28
-39
lines changed

4 files changed

+28
-39
lines changed

veadk/integrations/ve_faas/template/{{cookiecutter.local_dir_name}}/deploy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ async def main():
9595
message = "How is the weather like in Beijing?"
9696
print(f"Test message: {message}")
9797

98-
await _send_msg_with_a2a(cloud_app=cloud_app, message=message)
99-
await _send_msg_with_mcp(cloud_app=cloud_app, message=message)
98+
# await _send_msg_with_a2a(cloud_app=cloud_app, message=message)
99+
# await _send_msg_with_mcp(cloud_app=cloud_app, message=message)
100100

101101

102102
if __name__ == "__main__":

veadk/integrations/ve_tls/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def __prepare_request(
8080
return request
8181

8282

83-
async def ve_tls_request(
83+
def ve_tls_request(
8484
client: TLSService,
8585
api: str,
8686
params: dict | None = None,
@@ -100,10 +100,10 @@ async def ve_tls_request(
100100

101101
url = request.build()
102102

103-
async with httpx.AsyncClient() as session:
103+
with httpx.Client() as session:
104104
while True:
105105
try:
106-
response = await session.request(
106+
response = session.request(
107107
method=method,
108108
url=url,
109109
headers=request.headers,

veadk/integrations/ve_tls/ve_tls.py

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import asyncio
1615
import os
1716

17+
from volcengine.tls.TLSService import TLSService
18+
1819
from veadk.consts import DEFAULT_TLS_LOG_PROJECT_NAME, DEFAULT_TLS_TRACING_INSTANCE_NAME
1920
from veadk.integrations.ve_tls.utils import ve_tls_request
2021
from veadk.utils.logger import get_logger
21-
from volcengine.tls.TLSService import TLSService
2222

2323
logger = get_logger(__name__)
2424

@@ -63,13 +63,11 @@ def get_project_id_by_name(self, project_name: str) -> str:
6363

6464
try:
6565
res = None
66-
res = asyncio.run(
67-
ve_tls_request(
68-
client=self._client,
69-
api="DescribeProjects",
70-
body=request_body,
71-
method="GET",
72-
)
66+
res = ve_tls_request(
67+
client=self._client,
68+
api="DescribeProjects",
69+
body=request_body,
70+
method="GET",
7371
)
7472
projects = res["Projects"]
7573
for project in projects:
@@ -97,10 +95,8 @@ def create_log_project(self, project_name: str) -> str:
9795
"Tags": [{"Key": "provider", "Value": "VeADK"}],
9896
}
9997
try:
100-
res = asyncio.run(
101-
ve_tls_request(
102-
client=self._client, api="CreateProject", body=request_body
103-
)
98+
res = ve_tls_request(
99+
client=self._client, api="CreateProject", body=request_body
104100
)
105101

106102
if res["ErrorCode"] == "ProjectAlreadyExist":
@@ -122,13 +118,11 @@ def get_trace_instance_by_name(self, log_project_id: str, trace_instance_name: s
122118
"TraceInstanceName": trace_instance_name,
123119
}
124120
try:
125-
res = asyncio.run(
126-
ve_tls_request(
127-
client=self._client,
128-
api="DescribeTraceInstances",
129-
body=request_body,
130-
method="GET",
131-
)
121+
res = ve_tls_request(
122+
client=self._client,
123+
api="DescribeTraceInstances",
124+
body=request_body,
125+
method="GET",
132126
)
133127

134128
for instance in res["TraceInstances"]:
@@ -156,12 +150,10 @@ def create_tracing_instance(self, log_project_id: str, trace_instance_name: str)
156150

157151
try:
158152
res = None
159-
res = asyncio.run(
160-
ve_tls_request(
161-
client=self._client,
162-
api="CreateTraceInstance",
163-
body=request_body,
164-
)
153+
res = ve_tls_request(
154+
client=self._client,
155+
api="CreateTraceInstance",
156+
body=request_body,
165157
)
166158

167159
if res["ErrorCode"] == "TopicAlreadyExist":
@@ -173,13 +165,11 @@ def create_tracing_instance(self, log_project_id: str, trace_instance_name: str)
173165
)
174166

175167
# after creation, get the trace instance details
176-
res = asyncio.run(
177-
ve_tls_request(
178-
client=self._client,
179-
api="DescribeTraceInstance",
180-
body={"TraceInstanceID": res["TraceInstanceID"]},
181-
method="GET",
182-
)
168+
res = ve_tls_request(
169+
client=self._client,
170+
api="DescribeTraceInstance",
171+
body={"TraceInstanceID": res["TraceInstanceID"]},
172+
method="GET",
183173
)
184174

185175
return res

veadk/tracing/telemetry/exporters/apmplus_exporter.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ class APMPlusExporter(BaseExporter):
117117
config: APMPlusExporterConfig = Field(default_factory=APMPlusExporterConfig)
118118

119119
def model_post_init(self, context: Any) -> None:
120-
print(self.config)
121120
headers = {
122121
"x-byteapm-appkey": self.config.app_key,
123122
}

0 commit comments

Comments
 (0)