Skip to content

Commit

Permalink
POC - Now starting on metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff committed Feb 28, 2024
1 parent d147b62 commit 5d65ac2
Show file tree
Hide file tree
Showing 14 changed files with 503 additions and 90 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#pragma once

#include "opentelemetry/sdk/configuration/headers_configuration.h"
#include "opentelemetry/sdk/configuration/metric_exporter_configuration.h"
#include "opentelemetry/sdk/configuration/metric_exporter_configuration_visitor.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace sdk
{
namespace configuration
{

class ConsoleMetricExporterConfiguration : public MetricExporterConfiguration
{
public:
ConsoleMetricExporterConfiguration() = default;
~ConsoleMetricExporterConfiguration() override = default;

void Accept(MetricExporterConfigurationVisitor *visitor) const override
{
visitor->VisitConsole(this);
}
};

} // namespace configuration
} // namespace sdk
OPENTELEMETRY_END_NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#pragma once

#include "opentelemetry/sdk/configuration/document_node.h"
#include "opentelemetry/sdk/configuration/metric_exporter_configuration.h"
#include "opentelemetry/sdk/configuration/metric_exporter_configuration_visitor.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace sdk
{
namespace configuration
{

class ExtensionMetricExporterConfiguration : public MetricExporterConfiguration
{
public:
ExtensionMetricExporterConfiguration() = default;
~ExtensionMetricExporterConfiguration() override = default;

void Accept(MetricExporterConfigurationVisitor *visitor) const override
{
visitor->VisitExtension(this);
}

std::string name;
std::unique_ptr<DocumentNode> node;
};

} // namespace configuration
} // namespace sdk
OPENTELEMETRY_END_NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

#pragma once

#include <memory>
#include <vector>

#include "opentelemetry/sdk/configuration/metric_reader_configuration.h"
#include "opentelemetry/sdk/configuration/view_configuration.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
Expand All @@ -14,6 +19,8 @@ namespace configuration
class MeterProviderConfiguration
{
public:
std::vector<std::unique_ptr<MetricReaderConfiguration>> readers;
std::vector<std::unique_ptr<ViewConfiguration>> views;
};

} // namespace configuration
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#pragma once

#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace sdk
{
namespace configuration
{
class MetricExporterConfigurationVisitor;

class MetricExporterConfiguration
{
public:
MetricExporterConfiguration() = default;
virtual ~MetricExporterConfiguration() = default;

virtual void Accept(MetricExporterConfigurationVisitor *visitor) const = 0;
};

} // namespace configuration
} // namespace sdk
OPENTELEMETRY_END_NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#pragma once

#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace sdk
{
namespace configuration
{

class OtlpMetricExporterConfiguration;
class ConsoleMetricExporterConfiguration;
class PrometheusMetricExporterConfiguration;
class ExtensionMetricExporterConfiguration;

class MetricExporterConfigurationVisitor
{
public:
MetricExporterConfigurationVisitor() = default;
virtual ~MetricExporterConfigurationVisitor() = default;

virtual void VisitOtlp(const OtlpMetricExporterConfiguration *model) = 0;
virtual void VisitConsole(const ConsoleMetricExporterConfiguration *model) = 0;
virtual void VisitPrometheus(const PrometheusMetricExporterConfiguration *model) = 0;
virtual void VisitExtension(const ExtensionMetricExporterConfiguration *model) = 0;
};

} // namespace configuration
} // namespace sdk
OPENTELEMETRY_END_NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#pragma once

#include <memory>

#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace sdk
{
namespace configuration
{

class MetricReaderConfiguration
{
public:
MetricReaderConfiguration() = default;
virtual ~MetricReaderConfiguration() = default;
};

} // namespace configuration
} // namespace sdk
OPENTELEMETRY_END_NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#pragma once

#include "opentelemetry/sdk/configuration/headers_configuration.h"
#include "opentelemetry/sdk/configuration/metric_exporter_configuration.h"
#include "opentelemetry/sdk/configuration/metric_exporter_configuration_visitor.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace sdk
{
namespace configuration
{

class OtlpMetricExporterConfiguration : public MetricExporterConfiguration
{
public:
OtlpMetricExporterConfiguration() = default;
~OtlpMetricExporterConfiguration() override = default;

void Accept(MetricExporterConfigurationVisitor *visitor) const override
{
visitor->VisitOtlp(this);
}

std::string protocol;
std::string endpoint;
std::string certificate;
std::string client_key;
std::string client_certificate;
std::unique_ptr<HeadersConfiguration> headers;
std::string compression;
size_t timeout;
std::string temporality_preference;
int default_histogram_aggregation; // FIXME enum
bool insecure;
};

} // namespace configuration
} // namespace sdk
OPENTELEMETRY_END_NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#pragma once

#include <memory>

#include "opentelemetry/sdk/configuration/metric_exporter_configuration.h"
#include "opentelemetry/sdk/configuration/metric_reader_configuration.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace sdk
{
namespace configuration
{

class PeriodicMetricReaderConfiguration : public MetricReaderConfiguration
{
public:
PeriodicMetricReaderConfiguration() = default;
~PeriodicMetricReaderConfiguration() override = default;

size_t interval;
size_t timeout;
std::unique_ptr<MetricExporterConfiguration> exporter;
};

} // namespace configuration
} // namespace sdk
OPENTELEMETRY_END_NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#pragma once

#include "opentelemetry/sdk/configuration/headers_configuration.h"
#include "opentelemetry/sdk/configuration/metric_exporter_configuration.h"
#include "opentelemetry/sdk/configuration/metric_exporter_configuration_visitor.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace sdk
{
namespace configuration
{

class PrometheusMetricExporterConfiguration : public MetricExporterConfiguration
{
public:
PrometheusMetricExporterConfiguration() = default;
~PrometheusMetricExporterConfiguration() override = default;

void Accept(MetricExporterConfigurationVisitor *visitor) const override
{
visitor->VisitPrometheus(this);
}

std::string host;
size_t port;
bool without_units;
bool without_type_suffix;
bool without_scope_info;
};

} // namespace configuration
} // namespace sdk
OPENTELEMETRY_END_NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#pragma once

#include <memory>

#include "opentelemetry/sdk/configuration/metric_exporter_configuration.h"
#include "opentelemetry/sdk/configuration/metric_reader_configuration.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace sdk
{
namespace configuration
{

class PullMetricReaderConfiguration : public MetricReaderConfiguration
{
public:
PullMetricReaderConfiguration() = default;
~PullMetricReaderConfiguration() override = default;

std::unique_ptr<MetricExporterConfiguration> exporter;
};

} // namespace configuration
} // namespace sdk
OPENTELEMETRY_END_NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ class RymlDocumentNode : public DocumentNode
ryml::ConstNodeRef GetRequiredRymlChildNode(const std::string &name);
ryml::ConstNodeRef GetRymlChildNode(const std::string &name);

std::string GetRequiredRaw(const std::string &name);
std::pair<bool, std::string> GetRaw(const std::string &name);

ryml::ConstNodeRef m_node;
};

Expand Down
23 changes: 23 additions & 0 deletions sdk/include/opentelemetry/sdk/configuration/view_configuration.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#pragma once

#include <memory>

#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace sdk
{
namespace configuration
{

class ViewConfiguration
{
public:
};

} // namespace configuration
} // namespace sdk
OPENTELEMETRY_END_NAMESPACE
Loading

0 comments on commit 5d65ac2

Please sign in to comment.