-
Notifications
You must be signed in to change notification settings - Fork 1k
Draft: init spring-ai instrumentation #15064
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Cirilla-zmh
wants to merge
2
commits into
open-telemetry:main
Choose a base branch
from
Cirilla-zmh:fea/spring-ai-init
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
...ntelemetry/instrumentation/api/incubator/semconv/genai/GenAiAgentAttributesExtractor.java
This file contains hidden or 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,59 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package io.opentelemetry.instrumentation.api.incubator.semconv.genai; | ||
|
|
||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.AgentIncubatingAttributes.GEN_AI_AGENT_DESCRIPTION; | ||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.AgentIncubatingAttributes.GEN_AI_AGENT_ID; | ||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.AgentIncubatingAttributes.GEN_AI_AGENT_NAME; | ||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.AgentIncubatingAttributes.GEN_AI_DATA_SOURCE_ID; | ||
| import static io.opentelemetry.instrumentation.api.internal.AttributesExtractorUtil.internalSet; | ||
|
|
||
| import io.opentelemetry.api.common.AttributesBuilder; | ||
| import io.opentelemetry.context.Context; | ||
| import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; | ||
| import javax.annotation.Nullable; | ||
|
|
||
| /** | ||
| * Extractor of <a | ||
| * href="https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-agent-spans/">GenAI Agent | ||
| * attributes</a>. | ||
| * | ||
| * <p>This class delegates to a type-specific {@link GenAiAgentAttributesGetter} for individual | ||
| * attribute extraction from request/response objects. | ||
| */ | ||
| public final class GenAiAgentAttributesExtractor<REQUEST, RESPONSE> | ||
| implements AttributesExtractor<REQUEST, RESPONSE> { | ||
|
|
||
| /** Creates the GenAI Agent attributes extractor. */ | ||
| public static <REQUEST, RESPONSE> AttributesExtractor<REQUEST, RESPONSE> create( | ||
| GenAiAgentAttributesGetter<REQUEST, RESPONSE> attributesGetter) { | ||
| return new GenAiAgentAttributesExtractor<>(attributesGetter); | ||
| } | ||
|
|
||
| private final GenAiAgentAttributesGetter<REQUEST, RESPONSE> getter; | ||
|
|
||
| private GenAiAgentAttributesExtractor(GenAiAgentAttributesGetter<REQUEST, RESPONSE> getter) { | ||
| this.getter = getter; | ||
| } | ||
|
|
||
| @Override | ||
| public void onStart(AttributesBuilder attributes, Context parentContext, REQUEST request) { | ||
| internalSet(attributes, GEN_AI_AGENT_ID, getter.getId(request)); | ||
| internalSet(attributes, GEN_AI_AGENT_NAME, getter.getName(request)); | ||
| internalSet(attributes, GEN_AI_AGENT_DESCRIPTION, getter.getDescription(request)); | ||
| internalSet(attributes, GEN_AI_DATA_SOURCE_ID, getter.getDataSourceId(request)); | ||
| } | ||
|
|
||
| @Override | ||
| public void onEnd( | ||
| AttributesBuilder attributes, | ||
| Context context, | ||
| REQUEST request, | ||
| @Nullable RESPONSE response, | ||
| @Nullable Throwable error) { | ||
| // do nothing | ||
| } | ||
| } |
20 changes: 20 additions & 0 deletions
20
...opentelemetry/instrumentation/api/incubator/semconv/genai/GenAiAgentAttributesGetter.java
This file contains hidden or 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,20 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package io.opentelemetry.instrumentation.api.incubator.semconv.genai; | ||
|
|
||
| public interface GenAiAgentAttributesGetter<REQUEST, RESPONSE> { | ||
|
|
||
| String getName(REQUEST request); | ||
|
|
||
| @Nullable | ||
| String getDescription(REQUEST request); | ||
|
|
||
| @Nullable | ||
| String getId(REQUEST request); | ||
|
|
||
| @Nullable | ||
| String getDataSourceId(REQUEST request); | ||
| } |
This file contains hidden or 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
251 changes: 251 additions & 0 deletions
251
.../io/opentelemetry/instrumentation/api/incubator/semconv/genai/GenAiMessagesExtractor.java
This file contains hidden or 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,251 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package io.opentelemetry.instrumentation.api.incubator.semconv.genai; | ||
|
|
||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.GenAiIncubatingAttributes.GEN_AI_INPUT_MESSAGES; | ||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.GenAiIncubatingAttributes.GEN_AI_OPERATION_NAME; | ||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.GenAiIncubatingAttributes.GEN_AI_OUTPUT_MESSAGES; | ||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.GenAiIncubatingAttributes.GEN_AI_OUTPUT_TYPE; | ||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.GenAiIncubatingAttributes.GEN_AI_PROVIDER_NAME; | ||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.GenAiIncubatingAttributes.GEN_AI_REQUEST_CHOICE_COUNT; | ||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.GenAiIncubatingAttributes.GEN_AI_REQUEST_FREQUENCY_PENALTY; | ||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.GenAiIncubatingAttributes.GEN_AI_REQUEST_MAX_TOKENS; | ||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.GenAiIncubatingAttributes.GEN_AI_REQUEST_MODEL; | ||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.GenAiIncubatingAttributes.GEN_AI_REQUEST_PRESENCE_PENALTY; | ||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.GenAiIncubatingAttributes.GEN_AI_REQUEST_SEED; | ||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.GenAiIncubatingAttributes.GEN_AI_REQUEST_STOP_SEQUENCES; | ||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.GenAiIncubatingAttributes.GEN_AI_REQUEST_TEMPERATURE; | ||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.GenAiIncubatingAttributes.GEN_AI_REQUEST_TOP_K; | ||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.GenAiIncubatingAttributes.GEN_AI_REQUEST_TOP_P; | ||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.GenAiIncubatingAttributes.GEN_AI_RESPONSE_FINISH_REASONS; | ||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.GenAiIncubatingAttributes.GEN_AI_RESPONSE_ID; | ||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.GenAiIncubatingAttributes.GEN_AI_RESPONSE_MODEL; | ||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.GenAiIncubatingAttributes.GEN_AI_SYSTEM_INSTRUCTIONS; | ||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.GenAiIncubatingAttributes.GEN_AI_TOOL_DEFINITIONS; | ||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.GenAiIncubatingAttributes.GEN_AI_USAGE_INPUT_TOKENS; | ||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.GenAiIncubatingAttributes.GEN_AI_USAGE_OUTPUT_TOKENS; | ||
| import static io.opentelemetry.instrumentation.api.instrumenter.genai.incubating.GenAiIncubatingAttributes.GenAiEventName.GEN_AI_CLIENT_INFERENCE_OPERATION_DETAILS; | ||
| import static io.opentelemetry.instrumentation.api.internal.AttributesExtractorUtil.internalSet; | ||
| import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.EVENT_NAME; | ||
|
|
||
| import io.opentelemetry.api.common.AttributeKey; | ||
| import io.opentelemetry.api.common.AttributesBuilder; | ||
| import io.opentelemetry.api.logs.LogRecordBuilder; | ||
| import io.opentelemetry.context.Context; | ||
| import io.opentelemetry.instrumentation.api.aliyun.common.JsonMarshaler; | ||
| import io.opentelemetry.instrumentation.api.aliyun.common.provider.GlobalInstanceHolder; | ||
| import io.opentelemetry.instrumentation.api.genai.MessageCaptureOptions; | ||
| import io.opentelemetry.instrumentation.api.genai.MessageCaptureOptions.CaptureMessageStrategy; | ||
| import io.opentelemetry.instrumentation.api.genai.messages.InputMessages; | ||
| import io.opentelemetry.instrumentation.api.genai.messages.OutputMessages; | ||
| import io.opentelemetry.instrumentation.api.genai.messages.SystemInstructions; | ||
| import io.opentelemetry.instrumentation.api.genai.messages.ToolDefinitions; | ||
| import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; | ||
| import io.opentelemetry.instrumentation.api.log.genai.GenAiEventLoggerProvider; | ||
| import java.util.List; | ||
| import java.util.concurrent.atomic.AtomicBoolean; | ||
| import java.util.logging.Level; | ||
| import java.util.logging.Logger; | ||
| import javax.annotation.Nullable; | ||
|
|
||
| public class GenAiMessagesExtractor<REQUEST, RESPONSE> | ||
| implements AttributesExtractor<REQUEST, RESPONSE> { | ||
|
|
||
| private static final Logger LOGGER = Logger.getLogger(GenAiMessagesExtractor.class.getName()); | ||
|
|
||
| /** Creates the GenAI attributes extractor. */ | ||
| public static <REQUEST, RESPONSE> AttributesExtractor<REQUEST, RESPONSE> create( | ||
| GenAiAttributesGetter<REQUEST, RESPONSE> attributesGetter, | ||
| GenAiMessagesProvider<REQUEST, RESPONSE> messagesProvider, | ||
| MessageCaptureOptions messageCaptureOptions, | ||
| String instrumentationName) { | ||
| return new GenAiMessagesExtractor<>( | ||
| attributesGetter, messagesProvider, messageCaptureOptions, instrumentationName); | ||
| } | ||
|
|
||
| private final MessageCaptureOptions messageCaptureOptions; | ||
|
|
||
| private final GenAiAttributesGetter<REQUEST, RESPONSE> getter; | ||
|
|
||
| private final GenAiMessagesProvider<REQUEST, RESPONSE> messagesProvider; | ||
|
|
||
| private final String instrumentationName; | ||
|
|
||
| private final AtomicBoolean lazyInit = new AtomicBoolean(false); | ||
|
|
||
| private JsonMarshaler jsonMarshaler; | ||
|
|
||
| private io.opentelemetry.api.logs.Logger eventLogger; | ||
|
|
||
| private GenAiMessagesExtractor( | ||
| GenAiAttributesGetter<REQUEST, RESPONSE> getter, | ||
| GenAiMessagesProvider<REQUEST, RESPONSE> messagesProvider, | ||
| MessageCaptureOptions messageCaptureOptions, | ||
| String instrumentationName) { | ||
| this.getter = getter; | ||
| this.messagesProvider = messagesProvider; | ||
| this.messageCaptureOptions = messageCaptureOptions; | ||
| this.instrumentationName = instrumentationName; | ||
| } | ||
|
|
||
| @Override | ||
| public void onStart(AttributesBuilder attributes, Context parentContext, REQUEST request) { | ||
| tryInit(); | ||
| if (CaptureMessageStrategy.SPAN_ATTRIBUTES.equals( | ||
| messageCaptureOptions.captureMessageStrategy())) { | ||
| SystemInstructions systemInstructions = messagesProvider.systemInstructions(request, null); | ||
| if (systemInstructions != null) { | ||
| internalSet( | ||
| attributes, | ||
| GEN_AI_SYSTEM_INSTRUCTIONS, | ||
| toJsonString(systemInstructions.getSerializableObject())); | ||
| } | ||
|
|
||
| InputMessages inputMessages = messagesProvider.inputMessages(request, null); | ||
| if (inputMessages != null) { | ||
| internalSet( | ||
| attributes, GEN_AI_INPUT_MESSAGES, toJsonString(inputMessages.getSerializableObject())); | ||
| } | ||
|
|
||
| ToolDefinitions toolDefinitions = messagesProvider.toolDefinitions(request, null); | ||
| if (toolDefinitions != null) { | ||
| internalSet( | ||
| attributes, | ||
| GEN_AI_TOOL_DEFINITIONS, | ||
| toJsonString(toolDefinitions.getSerializableObject())); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public void onEnd( | ||
| AttributesBuilder attributes, | ||
| Context context, | ||
| REQUEST request, | ||
| @Nullable RESPONSE response, | ||
| @Nullable Throwable error) { | ||
| if (CaptureMessageStrategy.SPAN_ATTRIBUTES.equals( | ||
| messageCaptureOptions.captureMessageStrategy())) { | ||
| OutputMessages outputMessages = messagesProvider.outputMessages(request, response); | ||
| if (outputMessages != null) { | ||
| internalSet( | ||
| attributes, | ||
| GEN_AI_OUTPUT_MESSAGES, | ||
| toJsonString(outputMessages.getSerializableObject())); | ||
| } | ||
| } else if (CaptureMessageStrategy.EVENT.equals( | ||
| messageCaptureOptions.captureMessageStrategy())) { | ||
| emitInferenceEvent(context, request, response); | ||
| } | ||
| } | ||
|
|
||
| private void emitInferenceEvent(Context context, REQUEST request, @Nullable RESPONSE response) { | ||
| if (eventLogger != null) { | ||
| LogRecordBuilder builder = | ||
| eventLogger | ||
| .logRecordBuilder() | ||
| .setAttribute(EVENT_NAME, GEN_AI_CLIENT_INFERENCE_OPERATION_DETAILS) | ||
| .setContext(context); | ||
|
|
||
| SystemInstructions systemInstructions = | ||
| messagesProvider.systemInstructions(request, response); | ||
| if (systemInstructions != null) { | ||
| internalSetLogAttribute( | ||
| builder, | ||
| GEN_AI_SYSTEM_INSTRUCTIONS, | ||
| toJsonString(systemInstructions.getSerializableObject())); | ||
| } | ||
| InputMessages inputMessages = messagesProvider.inputMessages(request, response); | ||
| if (inputMessages != null) { | ||
| internalSetLogAttribute( | ||
| builder, GEN_AI_INPUT_MESSAGES, toJsonString(inputMessages.getSerializableObject())); | ||
| } | ||
| ToolDefinitions toolDefinitions = messagesProvider.toolDefinitions(request, null); | ||
| if (toolDefinitions != null) { | ||
| internalSetLogAttribute( | ||
| builder, | ||
| GEN_AI_TOOL_DEFINITIONS, | ||
| toJsonString(toolDefinitions.getSerializableObject())); | ||
| } | ||
| OutputMessages outputMessages = messagesProvider.outputMessages(request, response); | ||
| if (outputMessages != null) { | ||
| internalSetLogAttribute( | ||
| builder, GEN_AI_OUTPUT_MESSAGES, toJsonString(outputMessages.getSerializableObject())); | ||
| } | ||
|
|
||
| internalSetLogAttribute(builder, GEN_AI_OPERATION_NAME, getter.getOperationName(request)); | ||
| internalSetLogAttribute(builder, GEN_AI_OUTPUT_TYPE, getter.getOutputType(request)); | ||
| internalSetLogAttribute(builder, GEN_AI_REQUEST_CHOICE_COUNT, getter.getChoiceCount(request)); | ||
| internalSetLogAttribute(builder, GEN_AI_PROVIDER_NAME, getter.getSystem(request)); | ||
| internalSetLogAttribute(builder, GEN_AI_REQUEST_MODEL, getter.getRequestModel(request)); | ||
| internalSetLogAttribute(builder, GEN_AI_REQUEST_SEED, getter.getRequestSeed(request)); | ||
| internalSetLogAttribute( | ||
| builder, GEN_AI_REQUEST_FREQUENCY_PENALTY, getter.getRequestFrequencyPenalty(request)); | ||
| internalSetLogAttribute( | ||
| builder, GEN_AI_REQUEST_MAX_TOKENS, getter.getRequestMaxTokens(request)); | ||
| internalSetLogAttribute( | ||
| builder, GEN_AI_REQUEST_PRESENCE_PENALTY, getter.getRequestPresencePenalty(request)); | ||
| internalSetLogAttribute( | ||
| builder, GEN_AI_REQUEST_STOP_SEQUENCES, getter.getRequestStopSequences(request)); | ||
| internalSetLogAttribute( | ||
| builder, GEN_AI_REQUEST_TEMPERATURE, getter.getRequestTemperature(request)); | ||
| internalSetLogAttribute(builder, GEN_AI_REQUEST_TOP_K, getter.getRequestTopK(request)); | ||
| internalSetLogAttribute(builder, GEN_AI_REQUEST_TOP_P, getter.getRequestTopP(request)); | ||
|
|
||
| List<String> finishReasons = getter.getResponseFinishReasons(request, response); | ||
| if (finishReasons != null && !finishReasons.isEmpty()) { | ||
| builder.setAttribute(GEN_AI_RESPONSE_FINISH_REASONS, finishReasons); | ||
| } | ||
| internalSetLogAttribute(builder, GEN_AI_RESPONSE_ID, getter.getResponseId(request, response)); | ||
| internalSetLogAttribute( | ||
| builder, GEN_AI_RESPONSE_MODEL, getter.getResponseModel(request, response)); | ||
| internalSetLogAttribute( | ||
| builder, GEN_AI_USAGE_INPUT_TOKENS, getter.getUsageInputTokens(request, response)); | ||
| internalSetLogAttribute( | ||
| builder, GEN_AI_USAGE_OUTPUT_TOKENS, getter.getUsageOutputTokens(request, response)); | ||
| builder.emit(); | ||
| } | ||
| } | ||
|
|
||
| private <T> void internalSetLogAttribute( | ||
| LogRecordBuilder logRecordBuilder, AttributeKey<T> key, @Nullable T value) { | ||
| if (value == null) { | ||
| return; | ||
| } | ||
| logRecordBuilder.setAttribute(key, value); | ||
| } | ||
|
|
||
| private void tryInit() { | ||
| if (lazyInit.get()) { | ||
| return; | ||
| } | ||
|
|
||
| if (lazyInit.compareAndSet(false, true)) { | ||
| jsonMarshaler = GlobalInstanceHolder.getInstance(JsonMarshaler.class); | ||
| if (jsonMarshaler == null) { | ||
| LOGGER.log(Level.WARNING, "failed to init json marshaler, global instance is null"); | ||
| } | ||
|
|
||
| GenAiEventLoggerProvider loggerProvider = | ||
| GlobalInstanceHolder.getInstance(GenAiEventLoggerProvider.class); | ||
|
|
||
| if (loggerProvider == null) { | ||
| LOGGER.log(Level.WARNING, "failed to init event logger, logger provider is null"); | ||
| return; | ||
| } | ||
|
|
||
| eventLogger = loggerProvider.get(instrumentationName); | ||
| } | ||
| } | ||
|
|
||
| private String toJsonString(Object object) { | ||
| if (jsonMarshaler == null) { | ||
| LOGGER.log(Level.INFO, "failed to serialize object, json marshaler is null"); | ||
| return null; | ||
| } | ||
| return jsonMarshaler.toJSONStringNonEmpty(object); | ||
| } | ||
| } | ||
27 changes: 27 additions & 0 deletions
27
...a/io/opentelemetry/instrumentation/api/incubator/semconv/genai/GenAiMessagesProvider.java
This file contains hidden or 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,27 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package io.opentelemetry.instrumentation.api.incubator.semconv.genai; | ||
|
|
||
| import io.opentelemetry.instrumentation.api.genai.messages.InputMessages; | ||
| import io.opentelemetry.instrumentation.api.genai.messages.OutputMessages; | ||
| import io.opentelemetry.instrumentation.api.genai.messages.SystemInstructions; | ||
| import io.opentelemetry.instrumentation.api.genai.messages.ToolDefinitions; | ||
| import javax.annotation.Nullable; | ||
|
|
||
| public interface GenAiMessagesProvider<REQUEST, RESPONSE> { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implementing this interface for gen-ai instrumentation to capture there messages-related attributes/events. |
||
|
|
||
| @Nullable | ||
| InputMessages inputMessages(REQUEST request, @Nullable RESPONSE response); | ||
|
|
||
| @Nullable | ||
| OutputMessages outputMessages(REQUEST request, @Nullable RESPONSE response); | ||
|
|
||
| @Nullable | ||
| SystemInstructions systemInstructions(REQUEST request, @Nullable RESPONSE response); | ||
|
|
||
| @Nullable | ||
| ToolDefinitions toolDefinitions(REQUEST request, @Nullable RESPONSE response); | ||
| } | ||
14 changes: 14 additions & 0 deletions
14
...telemetry/instrumentation/api/incubator/semconv/genai/GenAiOperationAttributesGetter.java
This file contains hidden or 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,14 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package io.opentelemetry.instrumentation.api.incubator.semconv.genai; | ||
|
|
||
| public interface GenAiOperationAttributesGetter<REQUEST, RESPONSE> { | ||
|
|
||
| String getOperationName(REQUEST request); | ||
|
|
||
| @Nullable | ||
| String getOperationTarget(REQUEST request); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to emit event on end, because only here we could access all of attributes we need.