Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/plugins-jdk17-test.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ jobs:
- grizzly-2.3.x-4.x-workthreadpool-scenario
- jetty-11.x-scenario
- jetty-10.x-scenario
- spring-ai-1.x-scenario
steps:
- uses: actions/checkout@v2
with:
Expand Down
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Release Notes.
------------------

* Added support for Lettuce reactive Redis commands.
* Add Spring AI 1.x plugin and GenAI layer.

All issues and pull requests are [here](https://github.com/apache/skywalking/milestone/249?closed=1)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,34 @@ public class ComponentsDefine {

public static final OfficialComponent DMDB_JDBC_DRIVER = new OfficialComponent(163, "Dmdb-jdbc-driver");

public static final OfficialComponent SPRING_AI_UNKNOWN = new OfficialComponent(164, "spring-ai-unknown");

public static final OfficialComponent SPRING_AI_ANTHROPIC = new OfficialComponent(165, "spring-ai-anthropic");

public static final OfficialComponent SPRING_AI_BEDROCK = new OfficialComponent(166, "spring-ai-aws-bedrock");

public static final OfficialComponent SPRING_AI_AZURE_OPENAI = new OfficialComponent(167, "spring-ai-azure-openai");

public static final OfficialComponent SPRING_AI_COHERE = new OfficialComponent(168, "spring-ai-cohere");

public static final OfficialComponent SPRING_AI_DEEPSEEK = new OfficialComponent(169, "spring-ai-deepseek");

public static final OfficialComponent SPRING_AI_GOOGLE_GENAI = new OfficialComponent(170, "spring-ai-gcp-genai");

public static final OfficialComponent SPRING_AI_VERTEXAI = new OfficialComponent(171, "spring-ai-gcp-vertex-ai");

public static final OfficialComponent SPRING_AI_MISTRAL_AI = new OfficialComponent(172, "spring-ai-mistral-ai");

public static final OfficialComponent SPRING_AI_OPENAI = new OfficialComponent(173, "spring-ai-openai");

public static final OfficialComponent SPRING_AI_HUGGINGFACE = new OfficialComponent(174, "spring-ai-huggingface");

public static final OfficialComponent SPRING_AI_MINIMAX = new OfficialComponent(175, "spring-ai-minimax");

public static final OfficialComponent SPRING_AI_OLLAMA = new OfficialComponent(176, "spring-ai-ollama");

public static final OfficialComponent SPRING_AI_ZHIPU_AI = new OfficialComponent(177, "spring-ai-zhipu-ai");

public static final OfficialComponent SPRING_AI = new OfficialComponent(178, "spring-ai");

}
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,96 @@ public static final class HTTP {
*/
public static final StringTag THREAD_CARRIER = new StringTag(24, "thread.carrier");

/**
* GEN_AI_OPERATION_NAME represents the name of the operation being performed
*/
public static final StringTag GEN_AI_OPERATION_NAME = new StringTag(25, "gen_ai.operation.name");

/**
* GEN_AI_PROVIDER_NAME represents the Generative AI provider as identified by the client or server instrumentation.
*/
public static final StringTag GEN_AI_PROVIDER_NAME = new StringTag(26, "gen_ai.provider.name");

/**
* GEN_AI_REQUEST_MODEL represents the name of the GenAI model a request is being made to.
*/
public static final StringTag GEN_AI_REQUEST_MODEL = new StringTag(27, "gen_ai.request.model");

/**
* GEN_AI_TOP_K represents the top_k sampling setting for the GenAI request.
*/
public static final StringTag GEN_AI_TOP_K = new StringTag(28, "gen_ai.request.top_k");

/**
* GEN_AI_TOP_P represents the top_p sampling setting for the GenAI request.
*/
public static final StringTag GEN_AI_TOP_P = new StringTag(29, "gen_ai.request.top_p");

/**
* GEN_AI_TEMPERATURE represents the temperature setting for the GenAI request.
*/
public static final StringTag GEN_AI_TEMPERATURE = new StringTag(30, "gen_ai.request.temperature");

/**
* GEN_AI_TOOL_NAME represents the name of the tool utilized by the agent.
*/
public static final StringTag GEN_AI_TOOL_NAME = new StringTag(31, "gen_ai.tool.name");

/**
* GEN_AI_TOOL_CALL_ARGUMENTS represents the parameters passed to the tool call.
*/
public static final StringTag GEN_AI_TOOL_CALL_ARGUMENTS = new StringTag(32, "gen_ai.tool.call.arguments");

/**
* GEN_AI_TOOL_CALL_RESULT represents the result returned by the tool call (if any and if execution was successful).
*/
public static final StringTag GEN_AI_TOOL_CALL_RESULT = new StringTag(33, "gen_ai.tool.call.result");

/**
* GEN_AI_RESPONSE_MODEL represents the name of the model that generated the response.
*/
public static final StringTag GEN_AI_RESPONSE_MODEL = new StringTag(34, "gen_ai.response.model");

/**
* GEN_AI_RESPONSE_ID represents the unique identifier for the completion.
*/
public static final StringTag GEN_AI_RESPONSE_ID = new StringTag(35, "gen_ai.response.id");

/**
* GEN_AI_USAGE_INPUT_TOKENS represents the number of tokens used in the GenAI input (prompt).
*/
public static final StringTag GEN_AI_USAGE_INPUT_TOKENS = new StringTag(36, "gen_ai.usage.input_tokens");

/**
* GEN_AI_USAGE_OUTPUT_TOKENS represents the number of tokens used in the GenAI response (completion).
*/
public static final StringTag GEN_AI_USAGE_OUTPUT_TOKENS = new StringTag(37, "gen_ai.usage.output_tokens");

/**
* GEN_AI_USAGE_TOTAL_TOKENS represents the total number of tokens used in the GenAI exchange.
*/
public static final StringTag GEN_AI_CLIENT_TOKEN_USAGE = new StringTag(38, "gen_ai.client.token.usage");

/**
* GEN_AI_RESPONSE_FINISH_REASONS represents the array of reasons the model stopped generating tokens.
*/
public static final StringTag GEN_AI_RESPONSE_FINISH_REASONS = new StringTag(39, "gen_ai.response.finish_reasons");

/**
* GEN_AI_STREAM_TTFR represents the time to first response (TTFR) for streaming operations.
*/
public static final StringTag GEN_AI_STREAM_TTFR = new StringTag(40, "gen_ai.stream.ttfr");

/**
* GEN_AI_INPUT_MESSAGES represents the chat history provided to the model as an input.
*/
public static final StringTag GEN_AI_INPUT_MESSAGES = new StringTag(44, "gen_ai.input.messages");

/**
* GEN_AI_OUTPUT_MESSAGES represents the messages returned by the model where each message represents a specific model response (choice, candidate).
*/
public static final StringTag GEN_AI_OUTPUT_MESSAGES = new StringTag(45, "gen_ai.output.messages");

/**
* Creates a {@code StringTag} with the given key and cache it, if it's created before, simply return it without
* creating a new one.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
package org.apache.skywalking.apm.agent.core.context.trace;

public enum SpanLayer {
DB(1), RPC_FRAMEWORK(2), HTTP(3), MQ(4), CACHE(5);
DB(1), RPC_FRAMEWORK(2), HTTP(3), MQ(4), CACHE(5),
GEN_AI(7);

private int code;

Expand Down Expand Up @@ -50,4 +51,8 @@ public static void asHttp(AbstractSpan span) {
public static void asMQ(AbstractSpan span) {
span.setLayer(SpanLayer.MQ);
}

public static void asGenAI(AbstractSpan span) {
span.setLayer(SpanLayer.GEN_AI);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* 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.
*
*/

package org.apache.skywalking.apm.agent.core.util;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

public class GsonUtil {

private static final Gson GSON = new GsonBuilder()
.disableHtmlEscaping()
.create();

public static String toJson(Object src) {
if (src == null) {
return null;
}
return GSON.toJson(src);
}
}
1 change: 1 addition & 0 deletions apm-sniffer/apm-sdk-plugin/spring-plugins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<module>spring-webflux-5.x-webclient-plugin</module>
<module>spring-webflux-6.x-webclient-plugin</module>
<module>resttemplate-commons</module>
<module>spring-ai-1.x-plugin</module>
</modules>
<packaging>pom</packaging>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>spring-plugins</artifactId>
<groupId>org.apache.skywalking</groupId>
<version>9.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>spring-ai-1.x-plugin</artifactId>
<packaging>jar</packaging>

<name>spring-ai-1.x-plugin</name>
<url>http://maven.apache.org</url>

<properties>
<maven.compiler.release>17</maven.compiler.release>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-client-chat</artifactId>
<version>1.1.0</version>
<scope>provided</scope>
</dependency>

</dependencies>
</project>
Loading
Loading