Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ae20ec8
Include resource attributes as metrics tags
robertcoltheart Mar 2, 2024
bfb9401
Tidy xmldoc
robertcoltheart Mar 2, 2024
0a0ef68
Fit lint error
robertcoltheart Mar 2, 2024
f6f10ba
Merge branch 'main' into feature/resource-attribute-tags
robertcoltheart Mar 2, 2024
5ddf850
Revert resource attribute labels
robertcoltheart Mar 6, 2024
0a930da
Merge branch 'feature/resource-attribute-tags' of https://github.com/…
robertcoltheart Mar 6, 2024
1fd739b
Tidy PR diff
robertcoltheart Mar 6, 2024
f08dd85
Handle buffer overflow
robertcoltheart Mar 6, 2024
bcb5195
Merge branch 'main' into feature/resource-attribute-tags
robertcoltheart Mar 6, 2024
24f298d
Fix changelog
robertcoltheart Mar 6, 2024
79202c8
Cache target info buffer
robertcoltheart Mar 9, 2024
042ad04
Fix array copy
robertcoltheart Mar 9, 2024
c421b82
Update changelog
robertcoltheart Mar 9, 2024
198576f
Better write performance
robertcoltheart Mar 15, 2024
c383c04
Merge branch 'main' into feature/resource-attribute-tags
robertcoltheart Mar 15, 2024
7ccddaa
Merge branch 'main' into feature/resource-attribute-tags
vishweshbankwar Mar 19, 2024
9f62f61
Update src/OpenTelemetry.Exporter.Prometheus.HttpListener/Internal/Pr…
robertcoltheart Mar 21, 2024
fec5a35
Update CHANGELOG.md
robertcoltheart Mar 21, 2024
8a298c3
Update CHANGELOG.md
robertcoltheart Mar 21, 2024
529335f
Update CHANGELOG.md
robertcoltheart Mar 21, 2024
1881c43
Update CHANGELOG.md
robertcoltheart Mar 21, 2024
44e9121
Fix wrong comparison
robertcoltheart Mar 21, 2024
a5b09da
Fix linter
robertcoltheart Mar 21, 2024
317ce4c
Merge branch 'main' into feature/resource-attribute-tags
utpilla Mar 21, 2024
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
Prev Previous commit
Next Next commit
Better write performance
  • Loading branch information
robertcoltheart committed Mar 15, 2024
commit 198576f22804712595d46f70ea6afc6c20c291a4
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal sealed class PrometheusCollectionManager
private readonly HashSet<string> scopes;
private int metricsCacheCount;
private byte[] buffer = new byte[85000]; // encourage the object to live in LOH (large object heap)
private byte[] targetInfoBuffer;
private int targetInfoBufferLength = -1; // zero or positive when target_info has been written for the first time
private int globalLockState;
private ArraySegment<byte> previousDataView;
private DateTime? previousDataViewGeneratedAtUtc;
Expand Down Expand Up @@ -272,16 +272,13 @@ private ExportResult OnCollect(Batch<Metric> metrics)

private int WriteTargetInfo()
{
if (this.targetInfoBuffer == null)
if (this.targetInfoBufferLength < 0)
{
while (true)
{
try
{
var cursor = PrometheusSerializer.WriteTargetInfo(this.buffer, 0, this.exporter.Resource);

this.targetInfoBuffer = new byte[cursor];
Array.Copy(this.buffer, 0, this.targetInfoBuffer, 0, cursor);
this.targetInfoBufferLength = PrometheusSerializer.WriteTargetInfo(this.buffer, 0, this.exporter.Resource);

break;
}
Expand All @@ -294,14 +291,8 @@ private int WriteTargetInfo()
}
}
}
else
{
// Buffer will always be large enough for the target_info at this point because we've already
// previously written to the buffer (increasing it as needed) and copied out the target_info buffer.
this.targetInfoBuffer.CopyTo(this.buffer, 0);
}

return this.targetInfoBuffer.Length;
return this.targetInfoBufferLength;
}

private bool IncreaseBufferSize()
Expand Down