Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -54,70 +54,6 @@ internal class AWSServiceHelper
{ "DataSourceId", AWSSemanticConventions.AttributeAWSBedrockDataSourceId },
};

// for Bedrock Agent operations, we map each supported operation to one resource: Agent, DataSource, or KnowledgeBase
internal static List<string> BedrockAgentAgentOps = new List<string>
{
"CreateAgentActionGroup",
"CreateAgentAlias",
"DeleteAgentActionGroup",
"DeleteAgentAlias",
"DeleteAgent",
"DeleteAgentVersion",
"GetAgentActionGroup",
"GetAgentAlias",
"GetAgent",
"GetAgentVersion",
"ListAgentActionGroups",
"ListAgentAliases",
"ListAgentKnowledgeBases",
"ListAgentVersions",
"PrepareAgent",
"UpdateAgentActionGroup",
"UpdateAgentAlias",
"UpdateAgent",
};

internal static List<string> BedrockAgentKnowledgeBaseOps = new List<string>
{
"AssociateAgentKnowledgeBase",
"CreateDataSource",
"DeleteKnowledgeBase",
"DisassociateAgentKnowledgeBase",
"GetAgentKnowledgeBase",
"GetKnowledgeBase",
"ListDataSources",
"UpdateAgentKnowledgeBase",
};

internal static List<string> BedrockAgentDataSourceOps = new List<string>
{
"DeleteDataSource",
"GetDataSource",
"UpdateDataSource",
};

internal static IReadOnlyDictionary<string, string> OperationNameToResourceMap()
{
var operationClassMap = new Dictionary<string, string>();

foreach (var op in BedrockAgentKnowledgeBaseOps)
{
operationClassMap[op] = "KnowledgeBaseId";
}

foreach (var op in BedrockAgentDataSourceOps)
{
operationClassMap[op] = "DataSourceId";
}

foreach (var op in BedrockAgentAgentOps)
{
operationClassMap[op] = "AgentId";
}

return operationClassMap;
}

internal static string GetAWSServiceName(IRequestContext requestContext)
=> Utils.RemoveAmazonPrefixFromServiceName(requestContext.ServiceMetaData.ServiceId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,26 +320,6 @@ private static void AddDynamoTableArnAttribute(Activity activity, AmazonWebServi
}
}

private static void AddBedrockAgentResponseAttribute(Activity activity, AmazonWebServiceResponse response, string parameter)
{
var responseObject = response.GetType().GetProperty(Utils.RemoveSuffix(parameter, "Id"));
if (responseObject != null)
{
var attributeObject = responseObject.GetValue(response);
if (attributeObject != null)
{
var property = attributeObject.GetType().GetProperty(parameter);
if (property != null)
{
if (AWSServiceHelper.ParameterAttributeMap.TryGetValue(parameter, out var attribute))
{
activity.SetTag(attribute, property.GetValue(attributeObject));
}
}
}
}
}

private static void AddStatusCodeToActivity(Activity activity, int status_code)
{
activity.SetTag(AWSSemanticConventions.AttributeHttpStatusCode, status_code);
Expand Down
Loading