Commit Graph

578 Commits

Author SHA1 Message Date
Orne Brocaar
0f9674ec0a Change log from warn > debug.
This was changed from error to warn, but a debug is better as there is
not really something to warn the user about and with many devices
this might become very noisy.
2023-11-23 13:25:06 +00:00
Orne Brocaar
8e6079ec9c Fix sending empty downlink to Relay (adr_ack_req=true).
In case a Relay would send an uplink with adr_ack_req=true, this would
not result in an empty downlink in case there is no downlink to relay
back to the relay end-device.
2023-11-23 13:10:10 +00:00
Orne Brocaar
3538145e3d Add allow roaming option to device-profile. 2023-11-23 08:53:47 +00:00
Orne Brocaar
f13a5f492c Bump version to 4.6.0-test.3 2023-11-22 11:28:00 +00:00
Orne Brocaar
c0cd3a3361 Remove env variables from example config.
Initially this was added to make development using Docker Compose easier.
However, in my experience Docker Compose is not great for the reason
that there might be environmental differences between Rust running in
Compose and Rust running outside Compose (if using VSCode with Rust
plugin, then rust-analyzer will perform checks in the background). This
and 'cross' not working properly in Compose was the reason to migrate
to nix, as it provides a reproducible environment for development that
can also be used by VSCode (using the Nix environment selector
extension) and GitHub Actions (for the CI pipeline).

As the chirpstack-docker repository provides its own configuration files,
these files are not included in the Dockerfile and because we are
rewriting these env variables anyway to 'localhost' in the .deb and .rpm
post-installation script, it is better to set these to localhost by
default.

The post-installation rewrite to 'localhost' is causing issues on
upgrade (#295). If we only do the rewrite on initial installation, then
we run in an other issue; the package-manager will prompt that the
config file has changed (from 'localhost' to '$MQTT_BROKER_HOST' for
example) and will ask if you would like to overwrite or not. If the
end-user would accept the config changes without looking at the diff
this would break the installation as most likely, these environment are
not set (which is why we were rewriting these to 'localhost' in the first
place).
2023-11-22 11:10:13 +00:00
Orne Brocaar
5fd56e7e3c Bump version to 4.6.0-test.2 2023-11-20 12:33:52 +00:00
Orne Brocaar
940790add1 Update Rust to 1.74.0. 2023-11-20 12:09:02 +00:00
Orne Brocaar
1e619f90a0 Fix fmt issue. 2023-11-15 12:58:22 +00:00
Orne Brocaar
f7cd5a5a58 Get all device data in one query.
Instead of querying the device, device-profile, tenant and application
in separate queries.
2023-11-15 12:49:13 +00:00
Orne Brocaar
f81b868a31 ui: Reload device on change event.
Fixes #319.
2023-11-13 14:17:45 +00:00
Orne Brocaar
464937169b ui: Make device metric name optional.
If enabled, metrics will be automatically detected and created based on
the decoded payload. The key will be set, but the name is left blank for
the user to configure. This can be confusing as it leads to validation
errors in the device-profile form if the name is not filled in.
The UI does show that one of the fields failed to validate, but even
with such notification, it is not clear that users have to check one
of the form tabs which they didn't edit on save.

This makes the name optional and uses the key as fallback such that
saving the form no longer fails in case the name is still blank.

Closes #313.
2023-11-10 16:50:17 +00:00
Conny Andersson
b0ed12a1f5
Add the misspelled UnkownReceiver as a valid ResultCode in BE (#317) 2023-11-10 15:56:01 +00:00
Orne Brocaar
64277b1d9f Simplify AWS SNS integration / reduce dependencies.
This removes the aws-sdk-sns crate (+ dependencies) and refactors the
AWS SNS integration to use reqwest for the API call + aws-sign-v4 for
creating the AWS request signature.
2023-11-09 13:22:10 +00:00
Orne Brocaar
d24c830cd5 backend: Add sender_id to log span. 2023-11-07 12:02:55 +00:00
Orne Brocaar
4d822b56ef backend: Improve request logging. 2023-11-07 11:58:21 +00:00
Orne Brocaar
3b5627f43e Fix join-accept log span.
This shows the actual downlink_id of the join-accept downlink, which can
be correlated with the other log messages (e.g. tx_ack).
2023-11-07 11:15:51 +00:00
Orne Brocaar
500fd0f099 Add additional uplink metrics. 2023-11-07 09:46:02 +00:00
Orne Brocaar
9ea174910f Use unbounded MQTT client channel.
Even with the messages being handled async (tokio::spawn(...)), during
high throughput or a burst of messages, the channel might still fill up
causing messages to be discarded without any error being printed.
2023-11-07 09:46:02 +00:00
Orne Brocaar
b6d390b6ad ui: Fix setting initial tagsMap in TenantForm. 2023-11-07 09:46:02 +00:00
Conny Andersson
3f86bf6e71
backend: Skip serde serialization for Option<T> fields with None value. (#316) 2023-11-06 09:23:22 +00:00
Orne Brocaar
575cf45953 Use Error::Abort for Class-C downlink without first uplink. 2023-11-03 14:30:09 +00:00
Orne Brocaar
529e0cfed2 Use alternate error formatting in ToStatus trait impl. 2023-11-03 14:15:49 +00:00
Orne Brocaar
612662cd0b Fix :: > : in Redis key. 2023-11-02 15:30:34 +00:00
Orne Brocaar
07a6ce8c60 api: Update Go dependencies. 2023-11-02 14:23:31 +00:00
Orne Brocaar
f49fdf1c2c Log incoming Backend Interfaces requests. 2023-11-02 14:07:13 +00:00
Orne Brocaar
a4b775e75a Fix tests after streams > stream rename. 2023-11-02 14:05:52 +00:00
Orne Brocaar
8cca9d0677 backend: Implement BasePayloadResultProvider for BasePayloadResult. 2023-11-02 13:56:43 +00:00
Orne Brocaar
4d2f9828bb Log outgoing Backend Interfaces requests. 2023-11-02 11:50:16 +00:00
Orne Brocaar
2020732459 backend: Add optional logger func to client config. 2023-11-02 11:31:21 +00:00
Orne Brocaar
6931e9adb5 api: Add BackendInterfacesRequest stream message. 2023-11-02 08:36:57 +00:00
Orne Brocaar
36e6d5ccb9 api: Change streams > stream to be consistent. 2023-10-31 14:03:31 +00:00
Orne Brocaar
9596f7c2d0 Group stream modules together. 2023-10-31 13:26:59 +00:00
Orne Brocaar
1d38ae2544 api: Refactor api/request_log.proto to streams/api_requests.proto. 2023-10-31 11:59:07 +00:00
Orne Brocaar
a4da4ab784 api: Refactor api/frame_log.proto into streams/frames.proto. 2023-10-31 11:21:43 +00:00
Orne Brocaar
ec0ecf2044 api: Refactor meta/meta.proto to streams/meta.proto. 2023-10-31 10:19:38 +00:00
Orne Brocaar
09e1ae0263 Refactor JS join_eui to join_eui_prefix.
This makes it possible to use a range of JoinEUIs per Join Server.
Use-cases are either Join Servers using a JoinEUI range or the
configuration of a "catch-all" Join Server prefix ("0000000000000000/0").
2023-10-30 15:44:34 +00:00
Orne Brocaar
091909e8ea Bump version to 4.6.0-test.1 2023-10-26 15:38:37 +01:00
Orne Brocaar
fefa4f8be9 Re-generate API code. 2023-10-26 15:38:37 +01:00
Orne Brocaar
d38062aebd Add preamble and no_crc fields to LoraModulationInfo. 2023-10-26 15:38:37 +01:00
Aaron Shaw
da30e3db96
Remove trailing whitespace in toml config. (#308) 2023-10-25 10:00:20 +01:00
Orne Brocaar
0481b1a5e3 Log full codec error. 2023-10-24 15:21:44 +01:00
Orne Brocaar
3d4455b968 Improve log output.
This improves the log output on the following points:

In case when .context(...) is used, the error printed in the logs would
only show the outer error. This has been improved to show the complete
chain of errors.

In many cases error! and warn! logs were used for logging related to
user input. This is very inconvenient when using log output for
monitoring as it can trigger alerts based on end-user mistakes. While
refactoring the logs, the following criteria has been used:

* error = Messages that need attention and that are within the domain
  of the ChirpStack administrator.
* warn = Messages that should stand out of the other log messages, but
  that might be end-user (or end-device) related. Depending on if you
  have control of the full chain or not, you might or might not want to
  be alerted based on these messages.

Tracing spans have been improved to make it easier to correlate between
log messages and events.
2023-10-24 11:21:20 +01:00
Orne Brocaar
dc5be942d4 api: Re-generate API code. 2023-10-19 17:12:19 +01:00
Orne Brocaar
a087c4c18b Add tags to tenants and applications.
Note that the integration events will contain the application +
device-profile + device tags. Integration events will NOT contain the
tenant tags. Most likely tenant tags will be used to store information
about the tenant, data that is unrelated to the integration events.

Fixes #211.
2023-10-19 17:11:50 +01:00
Orne Brocaar
c7e586a326 Speed up user authorization validation queries.
This is related to the previous commit. This commit refactors the
queries in case of user tokens.
2023-10-18 12:11:06 +01:00
Orne Brocaar
ce5b9fbfd0 Speed up API authorization validation queries.
Using sub-queries, the amount of potentially selected records is
reduced. As well the joins on api_key.tenant_id causes (or might
cause) seq scans, because api_key.tenant_id is nullable.
2023-10-17 14:25:48 +01:00
Orne Brocaar
4e0331dbf4 backend: Add async test with 204 response.
Some NSes might return a 204 instead of a 200 response. This tests makes
sure that this possible behavior is captured in a test.
2023-10-16 15:00:12 +01:00
Orne Brocaar
1f64212923 api: Regenerate API SDKs. 2023-10-16 12:25:53 +01:00
Orne Brocaar
a9e1f02f0f Fix clippy warnings & errors after Rust update. 2023-10-16 12:18:45 +01:00
Orne Brocaar
b4845b5613 api: Rename time to gw_time. Add ns_time.
The gw_time defines the RX time by the gateway, the ns_time defines when
it was received by the NS. The latter could for example help to debug
latency between the GW <> NS.
2023-10-16 12:11:57 +01:00