Send CI job logs
https://http-intake.logs.datadoghq.com/api/v2/cilogshttps://http-intake.logs.us3.datadoghq.com/api/v2/cilogshttps://http-intake.logs.us5.datadoghq.com/api/v2/cilogshttps://http-intake.logs.datadoghq.eu/api/v2/cilogshttps://http-intake.logs.ap1.datadoghq.com/api/v2/cilogshttps://http-intake.logs.ap2.datadoghq.com/api/v2/cilogshttps://http-intake.logs.uk1.datadoghq.com/api/v2/cilogsNot supported in the US1-FED regionNot supported in the US2-FED region개요
Send log lines for a CI job over HTTP. See the CI Visibility Pipelines API for submitting the associated pipeline and job events.
A request can contain one log object or an array of up to 1,000 log objects. The maximum uncompressed request body size is 5.1 MiB.
You can stream log lines while a CI job runs or send them after it finishes. After you submit the completed job event, 20 seconds without a new log line marks the job's logs as complete. Lines sent after that may not appear.
A job can have up to 128 additional attributes and 256 tags. Additional attributes are top-level fields with
string, number, Boolean, or null values. Nested objects and arrays are rejected. Additional attributes and
ddtags apply to all log lines in the job. If an additional attribute has different values on different lines,
the first value received is used. Tags supplied on different lines are combined. A job can contain up to
2,000,000 log records or 1 GiB of message bytes in total.
To reduce request size, send gzip-compressed JSON with the Content-Encoding: gzip header. Retry requests after
a 408, 429, 500, or 503 response.
인수
헤더 파라미터
Content-EncodingHTTP header used to compress the JSON request body.
identity, gzip요청
Body Data (required)
CI job log line or batch in JSON format.
ddtagsComma-separated key:value tags. A job can have up to 256 tags, including repeated keys.
job_id [required]The job event's resource.id, sent through the CI Visibility pipeline API.
line_numberThe line number in the job log. Use 0 or 1 for the first line.
message [required]The non-empty log line message.
pipeline_unique_id [required]The resource.unique_id of the pipeline event, which must also match the job event's
resource.pipeline_unique_id.
provider_nameThe provider name sent with the pipeline event. It defaults to custom when omitted and, when provided,
must be non-empty and cannot contain a comma.
section_nameThe provider-defined section containing this log line, used to display collapsible groups of lines in the CI job log view.
statusThe status of this log line. Any string is accepted. Datadog maps non-empty values to a standard log status. See status mapping.
timestampThe log line time in RFC 3339 format with an explicit timezone. If omitted, the intake time is used. It can be at most 18 hours in the past or 12 hours in the future.
Send batched CI job logs returns "Request accepted for processing" response
[
{
"message": "Starting tests",
"pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
"job_id": "job-456",
"line_number": 1,
"status": "notice",
"section_name": "tests"
},
{
"message": "Tests passed",
"pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
"job_id": "job-456",
"line_number": 2
}
]Send one CI job log returns "Request accepted for processing" response
[
{
"message": "Running go test ./...",
"pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
"job_id": "job-456",
"provider_name": "example-provider",
"line_number": 1,
"status": "warn",
"section_name": "tests",
"ddtags": "runner:linux,architecture:amd64"
}
]응답
Request accepted for processing
No response body
{}Bad Request
Request errors returned by the CI logs intake API.
errorsRequest errors.
detailError details.
statusHTTP status code.
titleError title.
{
"errors": [
{
"detail": "Malformed payload",
"status": "400",
"title": "Bad Request"
}
]
}Unauthorized
Authentication and authorization errors returned by the CI logs intake API.
errorsError messages.
{
"errors": [
"Forbidden",
"API key is missing or invalid"
]
}Forbidden
Authentication and authorization errors returned by the CI logs intake API.
errorsError messages.
{
"errors": [
"Forbidden",
"API key is missing or invalid"
]
}Request Timeout
Request errors returned by the CI logs intake API.
errorsRequest errors.
detailError details.
statusHTTP status code.
titleError title.
{
"errors": [
{
"detail": "Malformed payload",
"status": "400",
"title": "Bad Request"
}
]
}Payload Too Large
Request errors returned by the CI logs intake API.
errorsRequest errors.
detailError details.
statusHTTP status code.
titleError title.
{
"errors": [
{
"detail": "Malformed payload",
"status": "400",
"title": "Bad Request"
}
]
}Too Many Requests
Request errors returned by the CI logs intake API.
errorsRequest errors.
detailError details.
statusHTTP status code.
titleError title.
{
"errors": [
{
"detail": "Malformed payload",
"status": "400",
"title": "Bad Request"
}
]
}코드 예시
Send batched CI job logs returns "Request accepted for processing" response
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
{
"message": "Starting tests",
"pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
"job_id": "job-456",
"line_number": 1,
"status": "notice",
"section_name": "tests"
},
{
"message": "Tests passed",
"pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
"job_id": "job-456",
"line_number": 2
}
]
EOF# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
{
"message": "Starting tests",
"pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
"job_id": "job-456",
"line_number": 1,
"status": "notice",
"section_name": "tests"
},
{
"message": "Tests passed",
"pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
"job_id": "job-456",
"line_number": 2
}
]
EOF# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
{
"message": "Starting tests",
"pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
"job_id": "job-456",
"line_number": 1,
"status": "notice",
"section_name": "tests"
},
{
"message": "Tests passed",
"pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
"job_id": "job-456",
"line_number": 2
}
]
EOF# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
{
"message": "Starting tests",
"pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
"job_id": "job-456",
"line_number": 1,
"status": "notice",
"section_name": "tests"
},
{
"message": "Tests passed",
"pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
"job_id": "job-456",
"line_number": 2
}
]
EOF# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
{
"message": "Starting tests",
"pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
"job_id": "job-456",
"line_number": 1,
"status": "notice",
"section_name": "tests"
},
{
"message": "Tests passed",
"pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
"job_id": "job-456",
"line_number": 2
}
]
EOF# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
{
"message": "Starting tests",
"pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
"job_id": "job-456",
"line_number": 1,
"status": "notice",
"section_name": "tests"
},
{
"message": "Tests passed",
"pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
"job_id": "job-456",
"line_number": 2
}
]
EOF# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
{
"message": "Starting tests",
"pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
"job_id": "job-456",
"line_number": 1,
"status": "notice",
"section_name": "tests"
},
{
"message": "Tests passed",
"pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
"job_id": "job-456",
"line_number": 2
}
]
EOFSend one CI job log returns "Request accepted for processing" response
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
{
"message": "Running go test ./...",
"pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
"job_id": "job-456",
"provider_name": "example-provider",
"line_number": 1,
"status": "warn",
"section_name": "tests",
"ddtags": "runner:linux,architecture:amd64"
}
]
EOF# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
{
"message": "Running go test ./...",
"pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
"job_id": "job-456",
"provider_name": "example-provider",
"line_number": 1,
"status": "warn",
"section_name": "tests",
"ddtags": "runner:linux,architecture:amd64"
}
]
EOF# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
{
"message": "Running go test ./...",
"pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
"job_id": "job-456",
"provider_name": "example-provider",
"line_number": 1,
"status": "warn",
"section_name": "tests",
"ddtags": "runner:linux,architecture:amd64"
}
]
EOF# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
{
"message": "Running go test ./...",
"pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
"job_id": "job-456",
"provider_name": "example-provider",
"line_number": 1,
"status": "warn",
"section_name": "tests",
"ddtags": "runner:linux,architecture:amd64"
}
]
EOF# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
{
"message": "Running go test ./...",
"pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
"job_id": "job-456",
"provider_name": "example-provider",
"line_number": 1,
"status": "warn",
"section_name": "tests",
"ddtags": "runner:linux,architecture:amd64"
}
]
EOF# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
{
"message": "Running go test ./...",
"pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
"job_id": "job-456",
"provider_name": "example-provider",
"line_number": 1,
"status": "warn",
"section_name": "tests",
"ddtags": "runner:linux,architecture:amd64"
}
]
EOF# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
export DD_API_KEY="<DD_API_KEY>"
curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
{
"message": "Running go test ./...",
"pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
"job_id": "job-456",
"provider_name": "example-provider",
"line_number": 1,
"status": "warn",
"section_name": "tests",
"ddtags": "runner:linux,architecture:amd64"
}
]
EOFSend batched CI job logs returns "Request accepted for processing" response
// Send batched CI job logs returns "Request accepted for processing" response
package main
import (
"context"
"encoding/json"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)
func main() {
body := []datadogV2.CILogItem{
{
Message: "Starting tests",
PipelineUniqueId: "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
JobId: "job-456",
LineNumber: datadog.PtrInt64(1),
Status: datadog.PtrString("notice"),
SectionName: datadog.PtrString("tests"),
},
{
Message: "Tests passed",
PipelineUniqueId: "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
JobId: "job-456",
LineNumber: datadog.PtrInt64(2),
},
}
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewCIVisibilityLogsApi(apiClient)
resp, r, err := api.SubmitCILog(ctx, body, *datadogV2.NewSubmitCILogOptionalParameters())
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `CIVisibilityLogsApi.SubmitCILog`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `CIVisibilityLogsApi.SubmitCILog`:\n%s\n", responseContent)
}
Send one CI job log returns "Request accepted for processing" response
// Send one CI job log returns "Request accepted for processing" response
package main
import (
"context"
"encoding/json"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)
func main() {
body := []datadogV2.CILogItem{
{
Message: "Running go test ./...",
PipelineUniqueId: "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
JobId: "job-456",
ProviderName: datadog.PtrString("example-provider"),
LineNumber: datadog.PtrInt64(1),
Status: datadog.PtrString("warn"),
SectionName: datadog.PtrString("tests"),
Ddtags: datadog.PtrString("runner:linux,architecture:amd64"),
},
}
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewCIVisibilityLogsApi(apiClient)
resp, r, err := api.SubmitCILog(ctx, body, *datadogV2.NewSubmitCILogOptionalParameters())
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `CIVisibilityLogsApi.SubmitCILog`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `CIVisibilityLogsApi.SubmitCILog`:\n%s\n", responseContent)
}
Instructions
First install the library and its dependencies and then save the example to main.go and run following commands:
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" go run "main.go"DD_SITE="us3.datadoghq.com" DD_API_KEY="<DD_API_KEY>" go run "main.go"DD_SITE="us5.datadoghq.com" DD_API_KEY="<DD_API_KEY>" go run "main.go"DD_SITE="datadoghq.eu" DD_API_KEY="<DD_API_KEY>" go run "main.go"DD_SITE="ap1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" go run "main.go"DD_SITE="ap2.datadoghq.com" DD_API_KEY="<DD_API_KEY>" go run "main.go"DD_SITE="uk1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" go run "main.go"Send batched CI job logs returns "Request accepted for processing" response
// Send batched CI job logs returns "Request accepted for processing" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CiVisibilityLogsApi;
import com.datadog.api.client.v2.model.CILogItem;
import java.util.Arrays;
import java.util.List;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
CiVisibilityLogsApi apiInstance = new CiVisibilityLogsApi(defaultClient);
List<CILogItem> body =
Arrays.asList(
new CILogItem()
.message("Starting tests")
.pipelineUniqueId("3eacb6f3-ff04-4e10-8a9c-46e6d054024a")
.jobId("job-456")
.lineNumber(1L)
.status("notice")
.sectionName("tests"),
new CILogItem()
.message("Tests passed")
.pipelineUniqueId("3eacb6f3-ff04-4e10-8a9c-46e6d054024a")
.jobId("job-456")
.lineNumber(2L));
try {
apiInstance.submitCILog(body);
} catch (ApiException e) {
System.err.println("Exception when calling CiVisibilityLogsApi#submitCILog");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Send one CI job log returns "Request accepted for processing" response
// Send one CI job log returns "Request accepted for processing" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CiVisibilityLogsApi;
import com.datadog.api.client.v2.model.CILogItem;
import java.util.Collections;
import java.util.List;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
CiVisibilityLogsApi apiInstance = new CiVisibilityLogsApi(defaultClient);
List<CILogItem> body =
Collections.singletonList(
new CILogItem()
.message("Running go test ./...")
.pipelineUniqueId("3eacb6f3-ff04-4e10-8a9c-46e6d054024a")
.jobId("job-456")
.providerName("example-provider")
.lineNumber(1L)
.status("warn")
.sectionName("tests")
.ddtags("runner:linux,architecture:amd64"));
try {
apiInstance.submitCILog(body);
} catch (ApiException e) {
System.err.println("Exception when calling CiVisibilityLogsApi#submitCILog");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Instructions
First install the library and its dependencies and then save the example to Example.java and run following commands:
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" java "Example.java"DD_SITE="us3.datadoghq.com" DD_API_KEY="<DD_API_KEY>" java "Example.java"DD_SITE="us5.datadoghq.com" DD_API_KEY="<DD_API_KEY>" java "Example.java"DD_SITE="datadoghq.eu" DD_API_KEY="<DD_API_KEY>" java "Example.java"DD_SITE="ap1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" java "Example.java"DD_SITE="ap2.datadoghq.com" DD_API_KEY="<DD_API_KEY>" java "Example.java"DD_SITE="uk1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" java "Example.java"Send batched CI job logs returns "Request accepted for processing" response
"""
Send batched CI job logs returns "Request accepted for processing" response
"""
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.ci_visibility_logs_api import CIVisibilityLogsApi
from datadog_api_client.v2.model.ci_log_item import CILogItem
body = [
CILogItem(
message="Starting tests",
pipeline_unique_id="3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
job_id="job-456",
line_number=1,
status="notice",
section_name="tests",
),
CILogItem(
message="Tests passed",
pipeline_unique_id="3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
job_id="job-456",
line_number=2,
),
]
configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = CIVisibilityLogsApi(api_client)
response = api_instance.submit_ci_log(body=body)
print(response)
Send one CI job log returns "Request accepted for processing" response
"""
Send one CI job log returns "Request accepted for processing" response
"""
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.ci_visibility_logs_api import CIVisibilityLogsApi
from datadog_api_client.v2.model.ci_log_item import CILogItem
body = [
CILogItem(
message="Running go test ./...",
pipeline_unique_id="3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
job_id="job-456",
provider_name="example-provider",
line_number=1,
status="warn",
section_name="tests",
ddtags="runner:linux,architecture:amd64",
),
]
configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = CIVisibilityLogsApi(api_client)
response = api_instance.submit_ci_log(body=body)
print(response)
Instructions
First install the library and its dependencies and then save the example to example.py and run following commands:
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" python3 "example.py"DD_SITE="us3.datadoghq.com" DD_API_KEY="<DD_API_KEY>" python3 "example.py"DD_SITE="us5.datadoghq.com" DD_API_KEY="<DD_API_KEY>" python3 "example.py"DD_SITE="datadoghq.eu" DD_API_KEY="<DD_API_KEY>" python3 "example.py"DD_SITE="ap1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" python3 "example.py"DD_SITE="ap2.datadoghq.com" DD_API_KEY="<DD_API_KEY>" python3 "example.py"DD_SITE="uk1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" python3 "example.py"Send batched CI job logs returns "Request accepted for processing" response
# Send batched CI job logs returns "Request accepted for processing" response
require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CIVisibilityLogsAPI.new
body = [
DatadogAPIClient::V2::CILogItem.new({
message: "Starting tests",
pipeline_unique_id: "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
job_id: "job-456",
line_number: 1,
status: "notice",
section_name: "tests",
}),
DatadogAPIClient::V2::CILogItem.new({
message: "Tests passed",
pipeline_unique_id: "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
job_id: "job-456",
line_number: 2,
}),
]
p api_instance.submit_ci_log(body)
Send one CI job log returns "Request accepted for processing" response
# Send one CI job log returns "Request accepted for processing" response
require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CIVisibilityLogsAPI.new
body = [
DatadogAPIClient::V2::CILogItem.new({
message: "Running go test ./...",
pipeline_unique_id: "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
job_id: "job-456",
provider_name: "example-provider",
line_number: 1,
status: "warn",
section_name: "tests",
ddtags: "runner:linux,architecture:amd64",
}),
]
p api_instance.submit_ci_log(body)
Instructions
First install the library and its dependencies and then save the example to example.rb and run following commands:
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" rb "example.rb"DD_SITE="us3.datadoghq.com" DD_API_KEY="<DD_API_KEY>" rb "example.rb"DD_SITE="us5.datadoghq.com" DD_API_KEY="<DD_API_KEY>" rb "example.rb"DD_SITE="datadoghq.eu" DD_API_KEY="<DD_API_KEY>" rb "example.rb"DD_SITE="ap1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" rb "example.rb"DD_SITE="ap2.datadoghq.com" DD_API_KEY="<DD_API_KEY>" rb "example.rb"DD_SITE="uk1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" rb "example.rb"Send batched CI job logs returns "Request accepted for processing" response
// Send batched CI job logs returns "Request accepted for processing" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_ci_visibility_logs::CIVisibilityLogsAPI;
use datadog_api_client::datadogV2::api_ci_visibility_logs::SubmitCILogOptionalParams;
use datadog_api_client::datadogV2::model::CILogItem;
use std::collections::BTreeMap;
#[tokio::main]
async fn main() {
let body = vec![
CILogItem::new(
"job-456".to_string(),
"Starting tests".to_string(),
"3eacb6f3-ff04-4e10-8a9c-46e6d054024a".to_string(),
)
.line_number(1)
.section_name("tests".to_string())
.status("notice".to_string())
.additional_properties(BTreeMap::from([])),
CILogItem::new(
"job-456".to_string(),
"Tests passed".to_string(),
"3eacb6f3-ff04-4e10-8a9c-46e6d054024a".to_string(),
)
.line_number(2)
.additional_properties(BTreeMap::from([])),
];
let configuration = datadog::Configuration::new();
let api = CIVisibilityLogsAPI::with_config(configuration);
let resp = api
.submit_ci_log(body, SubmitCILogOptionalParams::default())
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Send one CI job log returns "Request accepted for processing" response
// Send one CI job log returns "Request accepted for processing" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_ci_visibility_logs::CIVisibilityLogsAPI;
use datadog_api_client::datadogV2::api_ci_visibility_logs::SubmitCILogOptionalParams;
use datadog_api_client::datadogV2::model::CILogItem;
use std::collections::BTreeMap;
#[tokio::main]
async fn main() {
let body = vec![CILogItem::new(
"job-456".to_string(),
"Running go test ./...".to_string(),
"3eacb6f3-ff04-4e10-8a9c-46e6d054024a".to_string(),
)
.ddtags("runner:linux,architecture:amd64".to_string())
.line_number(1)
.provider_name("example-provider".to_string())
.section_name("tests".to_string())
.status("warn".to_string())
.additional_properties(BTreeMap::from([]))];
let configuration = datadog::Configuration::new();
let api = CIVisibilityLogsAPI::with_config(configuration);
let resp = api
.submit_ci_log(body, SubmitCILogOptionalParams::default())
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Instructions
First install the library and its dependencies and then save the example to src/main.rs and run following commands:
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" cargo runDD_SITE="us3.datadoghq.com" DD_API_KEY="<DD_API_KEY>" cargo runDD_SITE="us5.datadoghq.com" DD_API_KEY="<DD_API_KEY>" cargo runDD_SITE="datadoghq.eu" DD_API_KEY="<DD_API_KEY>" cargo runDD_SITE="ap1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" cargo runDD_SITE="ap2.datadoghq.com" DD_API_KEY="<DD_API_KEY>" cargo runDD_SITE="uk1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" cargo run