Skip to content
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

freckle-stats, freckle-ecs #226

Merged
merged 4 commits into from
Jan 21, 2025
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
6 changes: 5 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ jobs:
matrix:
package:
- freckle-app
- freckle-ecs
- freckle-env
- freckle-exception
- freckle-kafka
- freckle-http
- freckle-memcached
- freckle-otel
- freckle-prelude
- freckle-stats

steps:
- uses: actions/checkout@v4
Expand All @@ -39,13 +41,15 @@ jobs:
matrix:
package:
- freckle-app
- freckle-ecs
- freckle-env
- freckle-exception
- freckle-kafka
- freckle-http
- freckle-memcached
- freckle-otel
- freckle-prelude
- freckle-stats

env:
HACKAGE_KEY: ${{ secrets.HACKAGE_UPLOAD_API_KEY }}
Expand All @@ -62,7 +66,7 @@ jobs:

# Upload using our oldest, tested resolver, to set the lowest lower bounds
- name: "Release to Hackage"
run: stack --stack-yaml stack-lts-20.26.yaml upload --pvp-bounds lower ${{ matrix.package }}
run: stack --stack-yaml stack-lts20.yaml upload --pvp-bounds lower ${{ matrix.package }}

- name: "Upload documentation"
run: stack upload --documentation ${{ matrix.package }}
18 changes: 17 additions & 1 deletion freckle-app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
## [_Unreleased_](https://github.com/freckle/freckle-app/compare/freckle-app-v1.21.0.0...main)
## [_Unreleased_](https://github.com/freckle/freckle-app/compare/freckle-app-v1.22.0.0...main)

## [v1.22.0.0](https://github.com/freckle/freckle-app/compare/freckle-app-v1.21.0.0...freckle-app-v1.22.0.0)

`Freckle.App.Stats` has moved to a separate package `freckle-stats`.

When migrating to `freckle-stats`, note that the instance

```hs
instance HasStatsClient site => HasStatsClient (HandlerData child site) where
statsClientL = envL . siteL . statsClientL
```

has been removed. If you are using Yesod, you may need to copy this definition
into your own code.

`Freckle.App.Ecs` has moved to a separate package `freckle-ecs`.

## [v1.21.0.0](https://github.com/freckle/freckle-app/compare/freckle-app-v1.20.3.0...freckle-app-v1.21.0.0)

Expand Down
13 changes: 4 additions & 9 deletions freckle-app/freckle-app.cabal
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
cabal-version: 1.22

-- This file has been generated from package.yaml by hpack version 0.36.0.
-- This file has been generated from package.yaml by hpack version 0.37.0.
--
-- see: https://github.com/sol/hpack

name: freckle-app
version: 1.21.0.0
version: 1.22.0.0
synopsis: Haskell application toolkit used at Freckle
description: Please see README.md
category: Utils
Expand Down Expand Up @@ -35,15 +35,12 @@ library
Freckle.App.Bugsnag.SqlError
Freckle.App.Csv
Freckle.App.Database
Freckle.App.Ecs
Freckle.App.Faktory.ProducerPool
Freckle.App.Ghci
Freckle.App.GlobalCache
Freckle.App.Json.Empty
Freckle.App.Random
Freckle.App.Scientist
Freckle.App.Stats
Freckle.App.Stats.Rts
Freckle.App.Test
Freckle.App.Test.DocTest
Freckle.App.Test.Hspec.AnnotatedException
Expand Down Expand Up @@ -116,17 +113,15 @@ library
, conduit-extra
, containers
, cookie
, datadog
, doctest
, ekg-core
, exceptions
, extra
, faktory
, freckle-env
, freckle-exception
, freckle-http
, freckle-otel
, freckle-prelude
, freckle-stats
, hs-opentelemetry-api
, hs-opentelemetry-instrumentation-persistent
, hs-opentelemetry-instrumentation-wai
Expand Down Expand Up @@ -157,7 +152,6 @@ library
, servant-server
, template-haskell
, text
, time
, transformers
, transformers-base
, typed-process
Expand Down Expand Up @@ -245,6 +239,7 @@ test-suite spec
, cassava
, conduit
, freckle-app
, freckle-stats
, hs-opentelemetry-api
, hspec
, http-types
Expand Down
8 changes: 5 additions & 3 deletions freckle-app/library/Freckle/App/Yesod.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,20 @@ import Freckle.App.Stats qualified as Stats
import Network.HTTP.Types (ResponseHeaders, status503)
import Network.Wai qualified as W
import Yesod.Core.Handler (HandlerFor, sendWaiResponse)
import Yesod.Core.Types (HandlerContents)
import Yesod.Core.Types (HandlerContents, HandlerData)

-- | Catch 'SqlError' when queries are canceled due to timeout and respond 503
--
-- Also logs and increments a metric.
respondQueryCanceled
:: HasStatsClient site => HandlerFor site res -> HandlerFor site res
:: HasStatsClient (HandlerData site site)
=> HandlerFor site res
-> HandlerFor site res
respondQueryCanceled = respondQueryCanceledHeaders []

-- | 'respondQueryCanceledHeaders' but adding headers to the 503 response
respondQueryCanceledHeaders
:: HasStatsClient site
:: HasStatsClient (HandlerData site site)
=> ResponseHeaders
-> HandlerFor site res
-> HandlerFor site res
Expand Down
8 changes: 3 additions & 5 deletions freckle-app/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: freckle-app
version: 1.21.0.0
version: 1.22.0.0

maintainer: Freckle Education
category: Utils
Expand Down Expand Up @@ -94,17 +94,15 @@ library:
- conduit-extra
- containers
- cookie
- datadog
- doctest
- ekg-core
- exceptions
- extra
- faktory
- freckle-env
- freckle-exception
- freckle-http
- freckle-otel
- freckle-prelude
- freckle-stats
- hs-opentelemetry-api
- hs-opentelemetry-instrumentation-persistent
- hs-opentelemetry-instrumentation-wai
Expand Down Expand Up @@ -135,7 +133,6 @@ library:
- semigroupoids
- template-haskell
- text
- time
- transformers
- transformers-base
- typed-process
Expand Down Expand Up @@ -165,6 +162,7 @@ tests:
- cassava
- conduit
- freckle-app
- freckle-stats
- hs-opentelemetry-api
- hspec
- http-types
Expand Down
5 changes: 5 additions & 0 deletions freckle-ecs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## [_Unreleased_](https://github.com/freckle/freckle-app/compare/freckle-ecs-v0.0.0.0...main)

## [v0.0.0.0](https://github.com/freckle/freckle-app/tree/freckle-ecs-v0.0.0.0/freckle-ecs)

First release, sprouted from `freckle-app-1.21.0.0`.
21 changes: 21 additions & 0 deletions freckle-ecs/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2021-2024 Renaissance Learning Inc

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions freckle-ecs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# freckle-ecs

Small utility for Amazon Elastic Container Service
56 changes: 56 additions & 0 deletions freckle-ecs/freckle-ecs.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
cabal-version: 1.18

-- This file has been generated from package.yaml by hpack version 0.37.0.
--
-- see: https://github.com/sol/hpack

name: freckle-ecs
version: 0.0.0.0
synopsis: Small utility for Amazon Elastic Container Service
description: Please see README.md
category: Prelude
homepage: https://github.com/freckle/freckle-app#readme
bug-reports: https://github.com/freckle/freckle-app/issues
maintainer: Freckle Education
license: MIT
license-file: LICENSE
build-type: Simple
extra-source-files:
package.yaml
extra-doc-files:
README.md
CHANGELOG.md

source-repository head
type: git
location: https://github.com/freckle/freckle-app

library
exposed-modules:
Freckle.App.Ecs
other-modules:
Paths_freckle_ecs
hs-source-dirs:
library
default-extensions:
DataKinds
DeriveAnyClass
DerivingVia
DerivingStrategies
GADTs
LambdaCase
NoImplicitPrelude
NoMonomorphismRestriction
OverloadedStrings
TypeFamilies
ghc-options: -fignore-optim-changes -fwrite-ide-info -Weverything -Wno-all-missed-specialisations -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missing-kind-signatures -Wno-missing-local-signatures -Wno-missing-safe-haskell-mode -Wno-monomorphism-restriction -Wno-prepositive-qualified-module -Wno-safe -Wno-unsafe
build-depends:
aeson
, base <5
, extra
, freckle-http
, freckle-prelude
, mtl
default-language: GHC2021
if impl(ghc >= 9.8)
ghc-options: -Wno-missing-role-annotations -Wno-missing-poly-kind-signatures
61 changes: 61 additions & 0 deletions freckle-ecs/package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: freckle-ecs
version: 0.0.0.0
maintainer: Freckle Education
category: Prelude
github: freckle/freckle-app
synopsis: Small utility for Amazon Elastic Container Service
description: Please see README.md

extra-doc-files:
- README.md
- CHANGELOG.md

extra-source-files:
- package.yaml

language: GHC2021

ghc-options:
- -fignore-optim-changes
- -fwrite-ide-info
- -Weverything
- -Wno-all-missed-specialisations
- -Wno-missing-exported-signatures # re-enables missing-signatures
- -Wno-missing-import-lists
- -Wno-missing-kind-signatures
- -Wno-missing-local-signatures
- -Wno-missing-safe-haskell-mode
- -Wno-monomorphism-restriction
- -Wno-prepositive-qualified-module
- -Wno-safe
- -Wno-unsafe

when:
- condition: "impl(ghc >= 9.8)"
ghc-options:
- -Wno-missing-role-annotations
- -Wno-missing-poly-kind-signatures

dependencies:
- base < 5

default-extensions:
- DataKinds
- DeriveAnyClass
- DerivingVia
- DerivingStrategies
- GADTs
- LambdaCase
- NoImplicitPrelude
- NoMonomorphismRestriction
- OverloadedStrings
- TypeFamilies

library:
source-dirs: library
dependencies:
- aeson
- extra
- freckle-http
- freckle-prelude
- mtl
5 changes: 5 additions & 0 deletions freckle-stats/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## [_Unreleased_](https://github.com/freckle/freckle-app/compare/freckle-stats-v0.0.0.0...main)

## [v0.0.0.0](https://github.com/freckle/freckle-app/tree/freckle-stats-v0.0.0.0/freckle-stats)

First release, sprouted from `freckle-app-1.21.0.0`.
21 changes: 21 additions & 0 deletions freckle-stats/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2021-2024 Renaissance Learning Inc

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions freckle-stats/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# freckle-stats

An intentionally-leaky StatsD interface to Datadog
Loading
Loading