27 Jun 2024 11:15 PM
# Capture OpenTelemetry Span Attributes
curl -X 'POST' \
"https://{environmentid}.live.dynatrace.com/api/v2/settings/objects?validateOnly=false" \
-H 'accept: application/json; charset=utf-8' \
-H "Authorization: Api-Token $DT_WRITE_SETTINGS_TOKEN" \
-H 'Content-Type: application/json; charset=utf-8' \
-d '[ { "schemaId": "builtin:attribute-allow-list", "schemaVersion": "0.0.10", "scope": "environment", "value": { "enabled": true, "key": "gen_ai.request.model" } }, { "schemaId": "builtin:attribute-allow-list", "schemaVersion": "0.0.10", "scope": "environment", "value": { "enabled": true, "key": "gen_ai.system" } }]'
I have this cURL command that I ultimately want to "wrap" into an app and list on the hub. In this way, my users can configure all span attributes in a one-click way.
How do I achieve this? Rework this as Terraform / Monaco and package that way? Python?
If you have any docs, that'd be much appreciated.
Solved! Go to Solution.
28 Jun 2024 02:10 AM - edited 28 Jun 2024 02:15 AM
I have done something similar, for the DocumentService.
Expose a Function in the app that would work as middleware to the environment API settingsObject that would take payload and pass that to the API2 via the SDK. You need only to map the payload with the body of the request.
AFIK a Function is the only way to pass input and also have more freedom with packages.
If you dont require input from the user, just make the function to do the call with the information hardcoded.
import { settingsObjectsClient } from "@dynatrace-sdk/client-classic-environment-v2";
const data =
await settingsObjectsClient.postSettingsObjects({
body: [
{
schemaId:
"builtin:container.built-in-monitoring-rule",
scope: "HOST-D3A3C5A146830A79",
value: {},
},
],
});