"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createLoggingPartialSuccessResponseHandler = void 0;
/*
 * Copyright The OpenTelemetry Authors
 * SPDX-License-Identifier: Apache-2.0
 */
const api_1 = require("@opentelemetry/api");
function isPartialSuccessResponse(response) {
    return Object.prototype.hasOwnProperty.call(response, 'partialSuccess');
}
/**
 * Default response handler that logs a partial success to the console.
 */
function createLoggingPartialSuccessResponseHandler() {
    return {
        handleResponse(response) {
            // Partial success MUST never be an empty object according the specification
            // see https://opentelemetry.io/docs/specs/otlp/#partial-success
            if (response == null ||
                !isPartialSuccessResponse(response) ||
                response.partialSuccess == null ||
                Object.keys(response.partialSuccess).length === 0) {
                return;
            }
            api_1.diag.warn('Received Partial Success response:', JSON.stringify(response.partialSuccess));
        },
    };
}
exports.createLoggingPartialSuccessResponseHandler = createLoggingPartialSuccessResponseHandler;//# sourceMappingURL=/node_modules/@opentelemetry/otlp-exporter-base/build/src/logging-response-handler.js.map