Skip to content

Commit 7f03e05

Browse files
committed
Respond to comments
1 parent 315af3a commit 7f03e05

File tree

6 files changed

+15
-182
lines changed

6 files changed

+15
-182
lines changed

cassettes/test_tool_events_no_content

Lines changed: 0 additions & 83 deletions
This file was deleted.

cassettes/test_tool_events_no_content.yaml

Lines changed: 0 additions & 83 deletions
This file was deleted.

instrumentation-genai/opentelemetry-instrumentation-vertexai/examples/manual/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=SPAN_AND_EVENT
1616

1717
# Optional hook that will upload prompt and response content to some external destination.
1818
# For example fsspec.
19-
OTEL_INSTRUMENTATION_GENAI_COMPLETION_HOOK = "fsspec"
19+
OTEL_INSTRUMENTATION_GENAI_COMPLETION_HOOK = "upload"
2020

2121
# Required if using a completion hook. The path to upload content to for example gs://my_bucket.
2222
OTEL_INSTRUMENTATION_GENAI_UPLOAD_BASE_PATH = "gs://my_bucket"

instrumentation-genai/opentelemetry-instrumentation-vertexai/examples/zero-code/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=SPAN_AND_EVENT
2222

2323
# Optional hook that will upload prompt and response content to some external destination.
2424
# For example fsspec.
25-
OTEL_INSTRUMENTATION_GENAI_COMPLETION_HOOK = "fsspec"
25+
OTEL_INSTRUMENTATION_GENAI_COMPLETION_HOOK = "upload"
2626

2727
# Required if using a completion hook. The path to upload content to for example gs://my_bucket.
2828
OTEL_INSTRUMENTATION_GENAI_UPLOAD_BASE_PATH = "gs://my_bucket"

instrumentation-genai/opentelemetry-instrumentation-vertexai/src/opentelemetry/instrumentation/vertexai/patch.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def handle_response(
193193
]
194194
if response:
195195
outputs = convert_response_to_output_messages(response)
196-
content = {
196+
content_attributes = {
197197
k: [asdict(x) for x in v]
198198
for k, v in [
199199
(
@@ -207,26 +207,25 @@ def handle_response(
207207
}
208208
if span.is_recording():
209209
span.set_attributes(attributes)
210-
if capture_content in frozenset(
211-
[
212-
ContentCapturingMode.SPAN_AND_EVENT,
213-
ContentCapturingMode.SPAN_ONLY,
214-
]
210+
if capture_content in (
211+
ContentCapturingMode.SPAN_AND_EVENT,
212+
ContentCapturingMode.SPAN_ONLY,
215213
):
216214
span.set_attributes(
217-
{k: json.dumps(v) for k, v in content.items()}
215+
{
216+
k: json.dumps(v)
217+
for k, v in content_attributes.items()
218+
}
218219
)
219220
event = Event(
220221
name="gen_ai.client.inference.operation.details",
221222
)
222223
event.attributes = attributes
223-
if capture_content in frozenset(
224-
[
225-
ContentCapturingMode.SPAN_AND_EVENT,
226-
ContentCapturingMode.EVENT_ONLY,
227-
]
224+
if capture_content in (
225+
ContentCapturingMode.SPAN_AND_EVENT,
226+
ContentCapturingMode.EVENT_ONLY,
228227
):
229-
event.attributes |= content
228+
event.attributes |= content_attributes
230229
self.event_logger.emit(event)
231230
self.completion_hook.on_completion(
232231
inputs=inputs,

instrumentation-genai/opentelemetry-instrumentation-vertexai/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def instrument_with_upload_hook(
199199
os.environ.update(
200200
{
201201
OTEL_SEMCONV_STABILITY_OPT_IN: "gen_ai_latest_experimental",
202-
"OTEL_INSTRUMENTATION_GENAI_COMPLETION_HOOK": "fsspec_upload",
202+
"OTEL_INSTRUMENTATION_GENAI_COMPLETION_HOOK": "upload",
203203
"OTEL_INSTRUMENTATION_GENAI_UPLOAD_BASE_PATH": "memory://",
204204
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT: "SPAN_AND_EVENT",
205205
}

0 commit comments

Comments
 (0)