<commit_before>#!/bin/bash

# Accepts three arguments: metric name, value, and type (gauge, count, or rate)
# Usage:
#   send_metric_to_datadog "commcare.foo.bar" 7 "gauge"
# or with optional "tag" argument:
#   send_metric_to_datadog "commcare.foo.bar" 7 "gauge" "domain:foo"
function send_metric_to_datadog() {
    if [ -z "$DATADOG_API_KEY" -o -z "$DATADOG_APP_KEY" ]; then
        return
    fi

    EXTRA_TAG=""
    if [[ "$4" ]]; then
        EXTRA_TAG="\"$4\","
    fi

    if [ -n "$TRAVIS" ]; then
      HOST=travis-ci.org
      CI_ENV=travis
    elif [ -n "$GITHUB_ACTIONS" ]; then
      HOST=github.com
      CI_ENV=github_actions
    else
      HOST=unknown
      CI_ENV=unknown
    fi

    currenttime=$(date +%s)
    curl  -s \
          -X POST \
          -H "Content-type: application/json" \
          -H "DD-API-KEY: ${DATADOG_API_KEY}" \
          -H "DD-APP-KEY: ${DATADOG_APP_KEY}" \
          -d "{ \"series\" :
                [{\"metric\":\"$1\",
                  \"points\":[[$currenttime, $2]],
                  \"type\":\"$3\",
                  \"host\":\"$HOST\",
                  \"tags\":[
                    $EXTRA_TAG
                    \"environment:$CI_ENV\",
                    \"partition:$NOSE_DIVIDED_WE_RUN\"
                  ]}
                ]
              }" \
          "https://app.datadoghq.com/api/v1/series" || true
}<commit_msg>Silence datadog `curl` output which was messing up GitHub workflow group<commit_after>#!/bin/bash

# Accepts three arguments: metric name, value, and type (gauge, count, or rate)
# Usage:
#   send_metric_to_datadog "commcare.foo.bar" 7 "gauge"
# or with optional "tag" argument:
#   send_metric_to_datadog "commcare.foo.bar" 7 "gauge" "domain:foo"
function send_metric_to_datadog() {
    if [ -z "$DATADOG_API_KEY" -o -z "$DATADOG_APP_KEY" ]; then
        return
    fi

    EXTRA_TAG=""
    if [[ "$4" ]]; then
        EXTRA_TAG="\"$4\","
    fi

    if [ -n "$TRAVIS" ]; then
      HOST=travis-ci.org
      CI_ENV=travis
    elif [ -n "$GITHUB_ACTIONS" ]; then
      HOST=github.com
      CI_ENV=github_actions
    else
      HOST=unknown
      CI_ENV=unknown
    fi

    currenttime=$(date +%s)
    curl  -s \
          -X POST \
          -H "Content-type: application/json" \
          -H "DD-API-KEY: ${DATADOG_API_KEY}" \
          -H "DD-APP-KEY: ${DATADOG_APP_KEY}" \
          -d "{ \"series\" :
                [{\"metric\":\"$1\",
                  \"points\":[[$currenttime, $2]],
                  \"type\":\"$3\",
                  \"host\":\"$HOST\",
                  \"tags\":[
                    $EXTRA_TAG
                    \"environment:$CI_ENV\",
                    \"partition:$NOSE_DIVIDED_WE_RUN\"
                  ]}
                ]
              }" \
          "https://app.datadoghq.com/api/v1/series" >/dev/null || true
}
{'fraction_non_alphanumeric': 0.1620956399437412, 'fraction_numerical': 0.005625879043600563, 'mean_word_length': 1.6053113553113554, 'pattern_counts': {'":': 10, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6240716', 'n_tokens_mistral': 1027, 'n_tokens_neox': 958, 'n_words': 189}