Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/cmetrics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# CMetrics Version
set(CMT_VERSION_MAJOR 1)
set(CMT_VERSION_MINOR 0)
set(CMT_VERSION_PATCH 6)
set(CMT_VERSION_PATCH 7)
set(CMT_VERSION_STR "${CMT_VERSION_MAJOR}.${CMT_VERSION_MINOR}.${CMT_VERSION_PATCH}")

# Include helpers
Expand Down
22 changes: 3 additions & 19 deletions lib/cmetrics/src/cmt_encode_opentelemetry.c
Original file line number Diff line number Diff line change
Expand Up @@ -1598,27 +1598,11 @@ static Opentelemetry__Proto__Metrics__V1__HistogramDataPoint *

/*
* In the OpenTelemetry Metrics protobuf definition, the `sum` field in HistogramDataPoint is
* marked as `optional`:
*
* https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/metrics/v1/metrics.proto#L456
*
* While `optional` is supported in proto3, the `protobuf-c` project does not handle proto3
* optional scalar fields using `has_*` booleans like the main protobuf implementations.
*
* Instead, `protobuf-c` represents optional fields internally using a synthetic `oneof`.
* This means that in the generated C code, the optional `sum` field is placed inside a union,
* and its presence is tracked using a corresponding `_sum_case` enum field.
*
* To correctly serialize the `sum` field, both the `sum` value and its `_sum_case` must be set:
*
* data_point->sum = some_value;
* data_point->_sum_case = OPENTELEMETRY__PROTO__METRICS__V1__HISTOGRAM_DATA_POINT___SUM_SUM;
*
* Failing to set `_sum_case` will result in the `sum` field being silently omitted from the
* serialized output.
* marked as `optional`. The generated C code uses a `has_sum` boolean to indicate presence.
* Set both so the sum is included in the serialized output.
*/
data_point->sum = sum;
data_point->_sum_case = OPENTELEMETRY__PROTO__METRICS__V1__HISTOGRAM_DATA_POINT___SUM_SUM;
data_point->has_sum = 1;


if (bucket_count > 0) {
Expand Down
12 changes: 6 additions & 6 deletions lib/cprofiles/.github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: true

Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
apt-get install -y build-essential cmake make git
shell: bash

- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: true

Expand All @@ -108,12 +108,12 @@ jobs:
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: true

- name: Build on ${{ matrix.os }} with ${{ matrix.compiler }}
uses: uraimo/run-on-arch-action@v3.0.0
uses: uraimo/run-on-arch-action@v3.0.1
with:
arch: aarch64
distro: ubuntu20.04
Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: true

Expand Down Expand Up @@ -174,7 +174,7 @@ jobs:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: true

Expand Down
6 changes: 3 additions & 3 deletions lib/cprofiles/.github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
name: PR - Shellcheck
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: ludeeus/action-shellcheck@master
with:
ignore_paths: cmake/**
Expand All @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
name: PR - Actionlint
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- run: |
echo "::add-matcher::.github/actionlint-matcher.json"
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
Expand All @@ -29,6 +29,6 @@ jobs:
runs-on: ubuntu-latest
name: PR - Markdownlint
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Run markdownlint
uses: actionshub/markdownlint@v3.1.4
16 changes: 8 additions & 8 deletions lib/cprofiles/.github/workflows/packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
matrix:
format: [ rpm, deb ]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: true

- uses: uraimo/run-on-arch-action@v3.0.0
- uses: uraimo/run-on-arch-action@v3.0.1
name: Build the ${{matrix.format}} packages
with:
arch: aarch64
Expand All @@ -39,7 +39,7 @@ jobs:
echo ${{ matrix.format }} | awk '{print toupper($0)}' | xargs -I{} cpack -G {}

- name: Store the master package artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.format }}-arm64
path: |
Expand All @@ -53,7 +53,7 @@ jobs:
format: [ rpm, deb ]
runs-on: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: true

Expand All @@ -63,7 +63,7 @@ jobs:
echo ${{ matrix.format }} | awk '{print toupper($0)}' | xargs -I{} cpack -G {}

- name: Store the master package artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.format }}-amd64
path: |
Expand All @@ -80,7 +80,7 @@ jobs:
ext: pkg
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: true

Expand All @@ -90,7 +90,7 @@ jobs:
echo ${{ matrix.config.format }} | xargs -I{} cpack -G {}

- name: Store the master package artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.config.format }}-${{matrix.config.arch}}
path: |
Expand All @@ -107,7 +107,7 @@ jobs:
contents: write
steps:
- name: Download all artefacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v7
with:
path: artifacts/

Expand Down
4 changes: 2 additions & 2 deletions lib/cprofiles/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# CMetrics Version
set(CPROF_VERSION_MAJOR 0)
set(CPROF_VERSION_MINOR 1)
set(CPROF_VERSION_PATCH 1)
set(CPROF_VERSION_MINOR 2)
set(CPROF_VERSION_PATCH 0)
set(CPROF_VERSION_STR "${CPROF_VERSION_MAJOR}.${CPROF_VERSION_MINOR}.${CPROF_VERSION_PATCH}")

# Include helpers
Expand Down
7 changes: 6 additions & 1 deletion lib/cprofiles/include/cprofiles/cprof_encode_text.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,21 @@
#define CPROF_ENCODE_TEXT_ALLOCATION_ERROR 1
#define CPROF_ENCODE_TEXT_INVALID_ARGUMENT_ERROR 2

#define CPROF_ENCODE_TEXT_RENDER_DICTIONARIES_AND_INDEXES 0
#define CPROF_ENCODE_TEXT_RENDER_RESOLVED 1

struct cprof_text_encoding_context {
cfl_sds_t output_buffer;
size_t indentation_level;
cfl_sds_t indentation_buffer;
size_t indentation_level_size;
char indentation_character;
int render_mode;
};

int cprof_encode_text_create(cfl_sds_t *result_buffer,
struct cprof *profile);
struct cprof *profile,
int render_mode);

void cprof_encode_text_destroy(cfl_sds_t instance);

Expand Down
Loading
Loading