-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add docs about map fields #65
base: main
Are you sure you want to change the base?
Changes from 7 commits
6dafdf2
cf26a74
ed58e1f
17adffc
0811f80
b661c0c
b4fc056
48b12ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
title: 'Map fields' | ||
description: 'This page explains what map fields are and how to query them.' | ||
tags: ['axiom documentation', 'documentation', 'axiom', 'map fields', 'object fields', 'data types'] | ||
--- | ||
|
||
Map fields are a special type of field that can hold a collection of nested key-value pairs within a single field. You can think of the content of a map field as a JSON object. | ||
|
||
## Benefits of map fields | ||
|
||
The benefit of map fields is that you can store additional attributes without adding more fields. This is particularly useful when the shape of your data is unpredictable (for example, additional attributes added by an OpenTelemetry instrumentation). Using map fields means that you can avoid reaching the field limit of a dataset and improve query performance. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "by OpenTelemetry instrumentation" sounds more natural i think |
||
|
||
## Custom attributes in tracing datasets | ||
|
||
If you use [OpenTelemetry](/send-data/opentelemetry) to send data to Axiom, you find some attributes in the `attributes.custom` map field. The reason is that instrumentation libraries can add hundreds or even thousands of arbitrary attributes to spans. Storing each custom attribute in a separate field would significantly increase the number of fields in your dataset. To keep the number of fields in your dataset under control, Axiom places all custom attributes in the single `attributes.custom` map field. | ||
|
||
## Use map fields in queries | ||
|
||
The example query below uses the map field `attributes.http.url` to filter results: | ||
|
||
```kusto | ||
['otel-demo-traces'] | ||
| where ['attributes.http.url'] == 'http://opentelemetry-demo-frontendproxy:8080/api/cart' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a string field, not a map (given it's being compared against a string value) |
||
``` | ||
|
||
[Run in playground](https://play.axiom.co/axiom-play-qf1k/explorer?initForm=%7b%22apl%22%3a%22%5b%27otel-demo-traces%27%5d%5cn%7c%20where%20%5b%27attributes.http.url%27%5d%20%3d%3d%20%27http%3a%2f%2fopentelemetry-demo-frontendproxy%3a8080%2fapi%2fcart%27%22%2c%22queryOptions%22%3a%7b%22quickRange%22%3a%2230d%22%7d%7d) | ||
|
||
To access `http.protocol` inside the `attributes.custom` map field, use the syntax `['MAP_FIELD_NAME']['INDEX_TO_MAP_FIELD']` instead: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the bracketing only needs to happen when there's dots (or other special chars) in the name if the field is called for example |
||
|
||
```kusto | ||
['otel-demo-traces'] | ||
| where ['attributes.custom']['http.protocol'] == 'HTTP/1.1' | ||
``` | ||
|
||
[Run in playground](https://play.axiom.co/axiom-play-qf1k/explorer?initForm=%7b%22apl%22%3a%22%5b%27otel-demo-traces%27%5d%5cn%7c%20where%20%5b%27attributes.custom%27%5d%5b%27http.protocol%27%5d%20%3d%3d%20%27HTTP%2f1.1%27%22%2c%22queryOptions%22%3a%7b%22quickRange%22%3a%2230d%22%7d%7d) | ||
|
||
## Add custom fields | ||
|
||
The possibility to add custom fields is coming in early 2025. To express interest in the feature, [contact Axiom](https://axiom.co/contact). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should also mention drawbacks - querying them uses more query gbms, there's no visibility into them from the schema (ie autocomplete will not know what properties are inside the map)